Image creation and compositing
Image creation and compositing
- Subject: Image creation and compositing
- From: Julien Guimont <email@hidden>
- Date: Thu, 25 Nov 2004 22:21:42 -0500
Hello,
I have some trouble to create a composition using two images.
The first image is a Tiff in my bundle... this one is working well;).
The second image is created and draw with CG calls. Here is what I do
to create the image:
NSImage* ringsImg = [[NSImage alloc] initWithSize:imgSize];
[ringsImg lockFocus];
CGContextRef ringsContext = [[NSGraphicsContext currentContext]
graphicsPort];
CGContextSetFillColorSpace(ringsContext, NSCalibratedRGBColorSpace);
(the drawing is done here with CGContext drawing calls)
[ringsImg unlockFocus];
And then, I compose this image on top of the original tiff (here it is
called ring):
NSImage* output = [ring copy];
[output lockFocus];
//draw rings here
[ringsImg compositeToPoint:NSZeroPoint
operation:NSCompositeSourceAtop];
[output unlockFocus];
//clean up
[ringsImg release];
return [output autorelease];
When I try to see the result using an NSImageView, I see only the
original tiff image.
But... what's weird is that when I fetch the Tiff data of the resulting
image (output) and recreate an image with it, it works well:
NSData* data = [output TIFFRepresentation];
output = [[NSImage alloc] initWithData:data];
works. As you might guess, this is really slow for what I intend to do
with this drawing.
Do you have an idea why I have this behavior? I guess it has something
to do with colorspace or different conflicting representations.
Thank you!
Julien Guimont
www.juggysoft.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden