On Jun 18, 2005, at 1:13 AM, Scott Thompson wrote:
Upon trying to draw a CIImage into a PDF context, I was surprised
to see that area of the context show up completely black.
Is it the case that you can only render a CIImage into a pixel-
based context?
No, it should work with any context, what kind of CIImage are you
using?
John
OK... I put my code that tries to draw a CIImage into a PDF context
back together again and I'm getting the same result. The resulting
PDF is black where the image is supposed to be. The same CIImage
drawn to a window works just fine.
I'll put my code in below.
The original application was a carbon application using Core Image
(that's why there's an explicit autorelease pool for example.
There's really nothing remarkable (that I know of) about the Beach
image. It's just a picture that I took with my digital camera and
exported at 640x480. If I adjust the application so that it draws in
a Carbon window (inside of an HIView's kEventControlDraw handler into
the context passed to me by the OS), the same DrawBlurredImage
routine draws a blurry version of my image.
If you have any thoughts about why I can't dump the image into a PDF
context. Please let me know.
I'll also put together a bug report and sample app.
void DrawBlurredImage(CGContextRef outputContext, const CGRect
&viewBounds)
{
// Create an autorelease pool to catch stray objects
NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc]
init];
// Obtain the source image and create a CIImage with that set of
pixels
CGImageRef sourceCGImage = CreateSourceImage();
CIImage *sourceCIImage = [CIImage imageWithCGImage: sourceCGImage];
// extract the resulting CIImage from the blur filter.
CIImage *result = [gaussianBlur valueForKey: @"outputImage"];
// Create a CIContext on our graphics context and render the
image into it.
CIContext *outputCIContext = [CIContext contextWithCGContext:
outputContext options: NULL];
[outputCIContext drawImage: result inRect: viewBounds fromRect:
sourceBounds];
// release the autorelase pool
[autoreleasePool release];
autoreleasePool = NULL;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden