Making Subimages
Subject : Making Subimages
From: "Maryanna Rogers" <email@hidden >
Date: Sun, 27 May 2007 18:30:07 -0400
Delivered-to: email@hidden
Delivered-to: email@hidden
Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=LSepPpvAFIGqWb1S6UmIKnf4fDjhsqxx+3cnzUqVjdpIelC+UnGNM94opdF/YtfFafkgs3DvzHAXnXWd0yq8mT3Blsuyd+OSdMtC8CccC5KGrGsOn+U7nhgRjG6aoq+y99RRXgQwZtvrhYGkZTAiX/dGkRYhHzR5lg4Q4WXJRo8=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=huovXIN77MGEY/Vg+n1AUEIEkSLTX26uM7eD2/OOOjv2Vo7rmybeoZH9zZ3TZWGK2opg3rN+ipMK8XykK3p7FgK0AoK3mKxoyEAgzHZg/x8TSqf77AwdXpteJ6zykEUBG774fe4i+0c9Gu5DcYEUfFmV+P2NvVIJVM7zw596UxU=
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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.