Re: Painting into a NSImage / Combining two NSImage objects
Re: Painting into a NSImage / Combining two NSImage objects
- Subject: Re: Painting into a NSImage / Combining two NSImage objects
- From: Shawn Erickson <email@hidden>
- Date: Tue, 2 Sep 2003 08:35:59 -0700
On Tuesday, September 2, 2003, at 08:05 AM, Markus Hanauska wrote:
Very simple question:
I have two NSImage objects, both are parts of my resource bundle.
I want to combine both two a third NSImage object, so that image1 is
overlayed by image2. How can I do that?
I'm only familiar to the Java way of doing things: You create an empty
image, you paint image1 into the empty image, you paint image two into
the (now not really) empty image at the desired position.
But I fail to see how you can actually paint one image into another
one or combine two images in case of NSImage. I've read the NSImage
documentation over and over again, but I fail to understand it.
It's such a simple task, two lines of code in Java, why can't it be
that simple as well in Cocoa?
Check out lockFocus and unlockFocus and then consider using
compositeToPoint:operation:fraction:.
[finalImage lockFocus];
[image1 compositeToPoint:...];
[image2 compositeToPoint:...];
[finalImage unlockFocus];
-Shawn
_______________________________________________
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.