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];
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];