Re: BitMap data format and autorelease
Re: BitMap data format and autorelease
- Subject: Re: BitMap data format and autorelease
- From: Trygve Inda <email@hidden>
- Date: Wed, 12 Mar 2008 20:20:33 +0000
- Thread-topic: BitMap data format and autorelease
>
> On 12 Mar '08, at 12:01 PM, Trygve Inda wrote:
>
>> (1) draw an NSImage into this bitmap
>> (2) draw some semi-opaque text over the bitmap
>
> As I said, call -lockFocus on the imagerep. Then issue drawing
> commands (just as though you were in a view's -drawRect: method). Then
> calll -unlockFocus.
>
>> (3) save it as a new jpg.
>
> @interface NSBitmapImageRep (NSBitmapImageFileTypeExtensions)
> - (NSData *)representationUsingType:(NSBitmapImageFileType)storageType
> properties:(NSDictionary *)properties;
>
> —Jens
Is there a benefit to calling:
image = [[NSImage alloc] initWithSize:NSMakeSize(width, height)];
[image addRepresentation:imageRep];
Then using:
[image lockFocusOnRepresentation:imageRep];
[image unlockFocus];
This would give me an NSImage which uses my bitmap. Any pros/cons here?
Trygve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden