Re: Programatically creating/saving an NSImage;
Re: Programatically creating/saving an NSImage;
- Subject: Re: Programatically creating/saving an NSImage;
- From: Serge Meynard <email@hidden>
- Date: Mon, 21 Mar 2005 19:20:15 -0500
Try
[theImage lockFocus];
// Draw some stuff...
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc]
initWithFocusedViewRect:someRect];
[theImage unlockFocus];
// Manipulate the bitmap etc...
Serge
On Mar 21, 2005, at 17:51, Matt Budd (Madentec) wrote:
Hi Ricky,
I need to create a NSBitmapImageRep, because I want to manipulate the
pixels of the image before I save. In other words, I want to draw
using an NSBezierPath into an NSImage, and then manipulate that
image's pixels, and then save that image to disk. These secondary
manipulations must be done at the pixel level and can't be done at the
NSBezierPath level.
If I don't create the NSBitmapImageRep, the NSImage only has 1
representation, a NSCachedImageRep, of which I can get its pixel info
(through a -bitmapData message or something similar). If I use
-bestRepresentationForDevice:, it returns the only representation,
that NSCachedImageRep.
- Matt
_______________________________________________
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