• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: render to 128x128 image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: render to 128x128 image
      • From: Jake <email@hidden>
References: 
 >render to 128x128 image (From: Jake <email@hidden>)

  • Prev by Date: Re: Suggestion: A Getting Started FAQ
  • Next by Date: Re: Suggestion: A Getting Started FAQ
  • Previous by thread: render to 128x128 image
  • Next by thread: Re: render to 128x128 image
  • Index(es):
    • Date
    • Thread