Re: render to 128x128 image
Re: render to 128x128 image
- Subject: Re: render to 128x128 image
- From: "John C. Randolph" <email@hidden>
- Date: Sun, 11 Nov 2001 19:42:32 -0800
On Sunday, November 11, 2001, at 05:54 PM, Jake wrote:
Trying to render some stuff into an Icon with the following code:
const int width = 128;
const int height = 128;
int i;
NSImage *buf;
NSBitmapImageRep *bufrep;
unsigned char *d[5];
Why are you declaring d as an array of five pointers?
buf = [[NSImage allocWithZone:[self zone]]
initWithSize:NSMakeSize(width, height)];
[buf retain];
bufrep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes:NULL
pixelsWide: width
pixelsHigh: height
bitsPerSample: 8
samplesPerPixel: 4
hasAlpha: YES
isPlanar: YES
colorSpaceName: NSDeviceRGBColorSpace
You probably want NSCalibratedRGBColorSpace..
bytesPerRow: 0
bitsPerPixel: 32];
[bufrep retain];
I'm not going to dig through your pointer math, but I was wondering why
you're making your bitmap planar?
-jcr
This isn't needed, since since alloc/init will give you an object with a
retain count of one.
"The right to be heard does not include the right to be taken
seriously." - Hubert Humphrey