• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Making Subimages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: [MODERATOR] Re: getting nth root of an integer
  • Next by Date: Re: bug: unsigned short, NSArrayController, NSTableView?
  • Previous by thread: Re: Question about the info.plist
  • Next by thread: CD: Creating a managed object
  • Index(es):
    • Date
    • Thread