iDevGames Forums
"Inconsistent set of values to create NSBitmapImageRep" Help! - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: "Inconsistent set of values to create NSBitmapImageRep" Help! (/thread-4967.html)



"Inconsistent set of values to create NSBitmapImageRep" Help! - Joseph Duchesne - Sep 30, 2005 05:10 PM

*grumbles about lack of experience in Cocoa*

I am simply trying to create an NSBitmapImageRep with a width of (int)widthPxl and a height of (int)heightPxl and a type of NSJPEGFileType. Here's my code:

Code:
NSBitmapImageRep *tempBitmapImageRep;
tempBitmapImageRep=[[NSBitmapImageRep alloc]
            initWithBitmapDataPlanes:NULL
            pixelsWide:widthPxl
            pixelsHigh:heightPxl
            bitsPerSample:8
            samplesPerPixel:3
            hasAlpha:NO
            isPlanar:YES
            colorSpaceName:NSDeviceRGBColorSpace
            bitmapFormat:NSJPEGFileType
            bytesPerRow:0
            bitsPerPixel:0];

This is giving me "Inconsistent set of values to create NSBitmapImageRep" and I have checked widthPxl and heightPxl. What am I doing wrong? Is there an easier way to create an NSBitmapImageRep with those three parameters? (width, height, jpg)


"Inconsistent set of values to create NSBitmapImageRep" Help! - OneSadCookie - Sep 30, 2005 05:26 PM

a) NSJPEGFileType is not a valid argument for bitmapFormat:, read the docs.
b) even if it was, I doubt that you'd be allowed to have a planar image with it, nor that you'd actually want one.

what are you really trying to achieve?


"Inconsistent set of values to create NSBitmapImageRep" Help! - Joseph Duchesne - Sep 30, 2005 05:32 PM

I'm trying to capture an NSView and save it as a JPEG image at a specific size and resolution. One step in this is creating an NSBitmapImageRep of this size.