Cocoa combine images?

Joined
Jul 2, 2008
Messages
2
Reaction score
0
Points
1
Im trying to combine two NSImages. Currently I am using the following:

NSImage *newImage = [[NSImage alloc] initWithSize:NSMakeSize(imageBuffer.size.width, imageBuffer.size.height)];

[newImage lockFocus];
[imageBuffer compositeToPoint:NSMakePoint(0,0) operation:NSCompositeSourceOver];
[image compositeToPoint:NSMakePoint(50,50) operation:NSCompositeSourceOver];
[newImage unlockFocus];

Which creates a third image and pastes the other two images into it.
Is their anyway to do this without having to create a new image? (IE just paste the second image onto the first image?) I have tried the following but it did not work:

[imageBuffer lockFocus];
[image compositeToPoint:NSMakePoint(50,50) opeartion:NSCompositeSourceOver];
[imageBuffer unlockFocus];
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top