FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 167 : add to api or make example for clipboard cut/copy/paste
Last modified: 2009-03-03 06:39
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
ASSIGNED
Resolution:
-
Pr
i
ority:
P4
Severity:
enhancement
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
fry
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2005-10-07 20:40
old example/javaworld tip that handles how to do this:
http://www.javaworld.com/javaworld/javatips/jw-javatip61.html
Additional Comment
#1 From winne 2009-02-27 06:05
I suggest a copyImageToClipboard() method in PApplet. Implementing this
method is as easy as pie, but helpful for everyone using Processing:
BufferedImage clipBoardImage = new BufferedImage(width, height,
(g.format == ARGB) ? BufferedImage.TYPE_INT_ARGB :
BufferedImage.TYPE_INT_RGB);
g.loadPixels();
clipBoardImage.setRGB(0, 0, width, height, g.pixels, 0, width);
ImageSelection.copyImageToClipboard(clipBoardImage);
Code "copied" from PImage.saveImageIO().
ImageSelection class can be found at
http://elliotth.blogspot.com/2005/09/copying-images-to-clipboard-with-java.html
(and works flawless with current JRE).
Additional Comment
#2 From fry 2009-02-27 19:02
Thanks, this would be great to add to the 'hacks' section of the site and
much appreciated.
Additional Comment
#3 From winne 2009-03-02 01:45
done.
http://processing.org/hacks/hacks:clipboard
Additional Comment
#4 From fry 2009-03-03 06:39
Cool, thanks for posting. That may just be the correct place for this
feature request, rather than putting it into the core API. Eventually it
might graduate from hacks and into a library, for instance one that
included options for putting text or other types of data onto the clipboard
(but hides the fully over-abstracted methods provided by the Java APIs).
Also FYI, you can get a BufferedImage by calling getImage() on any PImage
object (which includes PGraphics objects, since they subclass PImage).