Re: New NSImage from multiple NSImages
Re: New NSImage from multiple NSImages
- Subject: Re: New NSImage from multiple NSImages
- From: Greg Titus <email@hidden>
- Date: Tue, 9 Jul 2002 16:36:51 -0700
On Tuesday, July 9, 2002, at 02:49 PM, Justin Lundy wrote:
I'm trying to create a playing card dynamically using several images,
say a blank card (for size) and images of a heart and an A. If
cardImage has the x/y size of 108,144 and heartImage has the x/y size
of 20,20, how do I create a new NSImage, heartCard, from cardImage with
heartImage drawn on it at 44, 62?
Like so:
// Create the heartCard image
heartCard = [[NSImage alloc] initWithSize:[cardImage size]];
// Draw into the heartCard image
[heartCard lockFocus];
// Composite the two parts
[cardImage compositeToPoint:NSZeroPoint operation:NSCompositeSourceOver];
[heartImage compositeToPoint:NSMakePoint(44,62)
operation:NSCompositeSourceOver];
// Finish drawing into the heartCard image
[heartCard unlockFocus];
Hope this helps,
--Greg
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.