Re: Programatically creating/saving an NSImage;
Re: Programatically creating/saving an NSImage;
- Subject: Re: Programatically creating/saving an NSImage;
- From: Ricky Sharp <email@hidden>
- Date: Mon, 21 Mar 2005 16:38:08 -0600
On Mar 21, 2005, at 4:31 PM, Matt Budd (Madentec) wrote:
Thanks for the reply. I tried substituting that call to -lockFocus
with this code:
[loTestImage lockFocusOnRepresentation: loTestImageRep];
But still no luck. It now appears that the random bytes/pixels are
going, but for the JPG, I only get a solid-black image, and for the
TIFF, it is all white. In neither of them do I get the red background.
And if I try to do more complicated drawing besides just filling a
rect (i.e. by using a NSBezierPath and -fill for a custom path), that
doesn't show up either....it's still either black or white filled...
Now that I look at it a second time, is there any specific reason for
creating the bitmap rep manually in the first place?
What you could do instead is something like this:
create an NSImage with your size
call lockFocus on the image
draw
call unlockFocus on the image
call bestRepresentationForDevice: on the image
with the rep you get back, get other reps (TIFF, JPG) and save them.
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden