obtaining raw image data from clipboard
obtaining raw image data from clipboard
- Subject: obtaining raw image data from clipboard
- From: Mary Waller <email@hidden>
- Date: Wed, 26 Mar 2003 13:52:52 +0000
How can I access the raw image data from the pasteboard, using java ?
I've tried various solutions involving NSImage, NSData and
NSBitmapImageRep, the latest being:
NSImage image = new NSImage(NSPasteboard.generalPasteboard()); // OK
here
NSSize size = image.size(); // OK here too - size = {60.0, 69.0}
NSArray reps = image.representations(); // only one,
"com.apple.cocoa.application.NSPICTImageRep"
// so I thought I would try and convert the image using:
try{
NSArray bimreps =
NSBitmapImageRep.imageRepsWithData(image.TIFFRepresentation());
for(int i = 0;i<bimreps.count();i++){
System.out.println(bimreps.objectAtIndex(i).getClass().getName());
}
}
catch(Exception e){
.....
}
but this fails with:
2003-03-26 11:31:57.573 Draw[1369] _NXCreateWindow: error creating
window (1002)
2003-03-26 11:31:57.601 Draw[1369] _initWithWindowNumber: error
creating graphics ctxt object for ctxt:0, window:-1
2003-03-26 11:31:57.622 Draw[1369] *** Assertion failure in -[NSView
lockFocus], AppKit.subproj/NSView.m:2343
which suggests that converting a PICT format involves drawing it to a
view/window first, and I can't create one from Java.
So, bearing in mind that accessing image data on the clipboard only
seems to provide a PICT data format (this is copying from
GraphicConverter), how do I access the raw data for the image?
mwaller
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.