Ok, so a little research reveals that the problem is much earlier than I 
thought: the images I'm creating have no resolution data.

So, the next question is: Given a bunch of bitmap data, and a resolution, how 
do I create an NSImage (or CGImage or CGImageSource) with the correct 
resolution?

Currently, I'm doing:

       CGDataProviderRef provider= CGDataProviderCreateWithData(NULL, 
(UInt8*)data, bytesPerRow * length, NULL);

        CGImageRef cgImg =  CGImageCreate (
                width,
                length,
                bitsPerComponent,
                bitsPerPixel,
                bytesPerRow,
                colorspace,
                bitmapinfo, // ?                CGBitmapInfo bitmapInfo,
                provider,   //? CGDataProviderRef provider,
                NULL, //const CGFloat decode[],
                true, //bool shouldInterpolate,
                kCGRenderingIntentDefault // CGColorRenderingIntent intent
                );
/*      CGColorSpaceRelease(colorspace); */

        NSData* imgData = [NSMutableData data];
        CGImageDestinationRef dest = CGImageDestinationCreateWithData
                (imgData, kUTTypeTIFF, 1, NULL);
        CGImageDestinationAddImage(dest, cgImg, NULL);
        CGImageDestinationFinalize(dest);
        NSImage* img = [[NSImage alloc] initWithData: imgData];


now, it appears that CGImageDestination takes only a NULL argument for the 
dictionary.. and width and length are in pixels, not points or inches.  At what 
point in this process am I supposed to add the resolution into this process?


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to