• 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
Re: New NSImage from multiple NSImages
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >New NSImage from multiple NSImages (From: Justin Lundy <email@hidden>)

  • Prev by Date: Re: New NSImage from multiple NSImages
  • Next by Date: Re: accessor generation???
  • Previous by thread: Re: New NSImage from multiple NSImages
  • Next by thread: Linking Mach-O and AIX binaries
  • Index(es):
    • Date
    • Thread