Making Subimages
Making Subimages
- Subject: Making Subimages
- From: "Maryanna Rogers" <email@hidden>
- Date: Sun, 27 May 2007 18:30:07 -0400
Hi,
I'm trying to obtain subimage of an existing image, and have been having
some trouble.
Here's what I'm doing.
I've got an NSBitmapImageRep:
NSBitmapImageRep * imageRep = ...
I can write this to a .tiff file, and it looks normal.
I want to get subimages of this image. In order to do that, I first create
an NSImage* :
NSData *tiffData = [imageRep TIFFRepresentation];
NSImage * myimage = [[NSImage alloc] initWithData:tiffData];
Then, try to chop it up:
NSPoint pt = NSMakePoint(0, 0);
NSRect box = NSMakeRect(0, 0, 100, 100);
[img lockFocus];
[myimage compositeToPoint:pt fromRect:box operation:NSCompositeCopy];
[img unlockFocus];
.. but the resulting images are not drawn as I expect. It appears it's using
(0, h),
as opposed to (0, 0) as the origin of myimage. In other words, if I try to
create a
10x10 image starting from (0, 0), I will get a 10x10 image from (0, height)
instead.
Why is this happening? Is this a problem with the bitmap->TIFF conversion?
Thanks.
~m
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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