Re: NSBitMapImageRep Woes

2010-01-07 Thread David Blanton
Answered my own question ... apologize for the noise! On Jan 7, 2010, at 4:05 PM, David Blanton wrote: Thanks to all. I have my bitmap being drawn but it is upside down. Do isFlipped play any role in this / how do I get it to draw right side up without inverting my raw data? For those inte

Re: NSBitMapImageRep Woes

2010-01-07 Thread David Blanton
Thanks to all. I have my bitmap being drawn but it is upside down. Do isFlipped play any role in this / how do I get it to draw right side up without inverting my raw data? For those interested this is the correct definition of NSBitMapImageRep: m_ptrs[0] = (unsigned char*)m_bitmap.

Re: NSBitMapImageRep Woes

2010-01-06 Thread Graham Cox
On 07/01/2010, at 4:21 AM, David Blanton wrote: > bytesPerRow:(4 * > m_frameRect.size.width) > bitsPerPixel:32]; Apart from what others have said, you can pass 0 for these parameters and they get

Re: NSBitMapImageRep Woes

2010-01-06 Thread David Duncan
On Jan 6, 2010, at 10:19 AM, David Blanton wrote: > Now, from David Duncan's comment. > > My bitmap data does have alpha, i.e 4 samples per pixel ARGB. I thought > kCGImageAlphaNoneSkipFirst says don't make an alpha plane, skip byte 1 and go > to RED. > > I am not sure how to specify this in

Re: NSBitMapImageRep Woes

2010-01-06 Thread David Blanton
OK. So, from other comments I made some changes. 1. Correctly set the dimensions by using m_bitmap.m_pixelsx and m_bitmap.m_pixelsy (these are members of our portable bitmap class). m_NSBitmapImageRep = [[NSBitmapImageRep alloc] ini

Re: NSBitMapImageRep Woes

2010-01-06 Thread Henry McGilton (Boulevardier)
On Jan 6, 2010, at 9:21 AM, David Blanton wrote: > Here is the code: > > @interface MyDocumentView : NSView { > @public > > NSBitmapImageRep* m_NSBitmapImageRep; > NSRect m_frameRect; > float m_sz; > BBitmap

Re: NSBitMapImageRep Woes

2010-01-06 Thread Ken Thomases
On Jan 6, 2010, at 11:21 AM, David Blanton wrote: > - (void)drawRect:(NSRect)dirtyRect { > > [NSGraphicsContext saveGraphicsState]; > [m_NSBitmapImageRep drawInRect:dirtyRect]; > [NSGraphicsContext restoreGraphicsState]; > } The docs for -drawInRect: say i

Re: NSBitMapImageRep Woes

2010-01-06 Thread David Duncan
On Jan 6, 2010, at 9:21 AM, David Blanton wrote: > m_NSBitmapImageRep = [[NSBitmapImageRep alloc] > > initWithBitmapDataPlanes:m_ptrs > > pixelsWide:m_frameRect.size.width >