Re: Crash in NSBitmapImageRep representationUsingType: NSPNGFileType for 8-bit grayscale

2012-04-03 Thread John Horigan
I have a crash report: It is crashing inside the libPng.dyld png_malloc routine because an attempt by system malloc to allocate a memory block at 0x1003efe58 fails because heap corruption was detected. I instrumented allocations and determined that my code never allocated memory near here. But l

Crash in NSBitmapImageRep representationUsingType: NSPNGFileType for 8-bit grayscale

2012-04-02 Thread John Horigan
I have code that produces a PNG file from a cropped version of a bitmap that can be 8-bit grayscale, 16-bit grayscale, 24-bit color, or 32-bit color+alpha. It basically looks like this: - (NSData *) getPNGCropped: (NSRect)cropRect { unsigned char* planes[5]; int offset =(int)cropRect

Re: NSImageRep simple code

2010-03-04 Thread John Horigan
It would be a good idea to modify the pixel buffer before calling initWithBitmapDataPlanes. NSBitmapImageRep makes no guarantee that changes to the data planes will be picked up by the NSBitmapImageRep after the call to initWithBitmapDataPlanes. It seems to work with OSX 10.5 and earlier, but Sn

Re: How to draw text to bitmap (array) with pre 10.5 libs

2009-12-01 Thread John Horigan
>> >> Indeed, the initWithBitmapDataPlanes method treats the supplied buffer as >> immutable and creates its own internal copy. > > This is not correct. From the docs [1]: > > "If planes is not NULL and the array contains at least one data pointer, the > returned object will only reference th

Re: How to draw text to bitmap (array) with pre 10.5 libs

2009-11-29 Thread John Horigan
On Nov 29, 2009, at 9:09 PM, Graham Cox wrote: > > On 30/11/2009, at 2:44 PM, Glenn McCord wrote: > >> What I'm expecting is the drawAtPoint method to draw nsString inside >> the bitmapRep of the NSContext at which point I can retrieve the raw >> data and do something with it. On account of th

Re: stringWithContentsOfURL with resulting error 256

2009-10-22 Thread John Horigan
Try using curl (the command-line utility) to see _exactly_ what Cocoa gets from the server when it accesses that URL. The server could be doing something that confuses Cocoa but which PHP and Safari handle properly. -- john On Oct 22, 2009, at 8:52 AM, Jens Alfke wrote: On Oct 22, 2009,

Launching and application in 32-bit in Leopard

2009-10-06 Thread John Horigan
Does Leopard provide a means for controlling whether an application launches in 32-bit or 64-bit? Snow Leopard has the new NSWorkspace method launchApplicationAtURL:options:configuration:error: But I can't find an equivalent method that works for OS X 10.5. How did XCode do it? --

Re: NSBitmapImageRep caching behavior in Snow Leopard

2009-09-28 Thread John Horigan
won't translate to the Cocoa Drawing Guide for a bit yet. Sadly. On Sep 25, 2009, at 7:22 PM, John Horigan wrote: I have a drawing program that creates an NSBitmapImageRep and an NSImage: mImage = [[NSImage alloc] initWithSize: size]; mBitmap = [[NSBitmapImageRep

Re: NSBitmapImageRep caching behavior in Snow Leopard

2009-09-27 Thread John Horigan
It is a digital art program where the user writes a description of an image and the program creates it. Image creation can be a lengthy process so I have the rendering thread periodically send a snapshot of what it has done so far to the view. This is purely to entertain the user while they

NSBitmapImageRep caching behavior in Snow Leopard

2009-09-27 Thread John Horigan
I have a drawing program that creates an NSBitmapImageRep and an NSImage: mImage = [[NSImage alloc] initWithSize: size]; mBitmap = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL pixelsWide: (int)size.width p

Re: Exit screen saver programmatically?

2009-09-24 Thread John Horigan
If you send the unwanted events to ScreenSaverView parent of your view then it should terminate gracefully. [super theEvent]; -- john On Sep 24, 2009, at 1:14 AM, Gabriel Zachmann wrote: Post a mouse down event and the sceensaver engine will remove it for you. That is a good idea -- exc