My NSQuicktimeView shows up.. once...
My NSQuicktimeView shows up.. once...
- Subject: My NSQuicktimeView shows up.. once...
- From: Lance Drake <email@hidden>
- Date: Wed, 10 Dec 2003 04:24:12 -0700
Hello - Somebody please help, I need to have one of those Homer Simpson
moments - where I slap my forehead and bleet '"D'oh!".
I have a Cocoa project where the nib contains an NSQuickDrawView. I
have a png file that I want to draw into it. Everything goes
swimmingly until AFTER the first time it appears. If the window is
redrawn, the image is gone. There is no crashing or thrashing, it's
just not there. The object I have is derived from 'NSQuickDrawView'
In a nutshell - here's what I do to get it up there: (error checks
left out for brevity)
Any thoughts about WHY the thing goes away - never to be shown again,
even if I call this redraw routine?
Thanks! (and hoping to make a loud sound, soon!),
Lance Drake
---------------------------------------------------------------------
CGrafPtr thePort = [self qdPort];
SetPortWindowPort( [mParentWindow windowRef] );
QDBeginCGContext( thePort, &context );
// Create a CGImage from the bitmap data using the DeviceRGB color space
CGDataProviderRef provider;
CGImageRef image;
CGRect rect;
CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
// (imageDef is a structure where I store references to the loaded
images)
provider = CGDataProviderCreateWithData(NULL, imageDef->bi.data,
imageDef->bi.size, NULL);
image = CGImageCreate(imageDef->bi.width, imageDef->bi.height,
imageDef->bi.bitsPerComponent,
imageDef->bi.bitsPerPixel,
imageDef->bi.bytesPerRow, cs, imageDef->bi.ai,
provider, NULL,
0, kCGRenderingIntentDefault);
CGColorSpaceRelease(cs);
rect = CGRectMake(0,0, kIconSizeWidth, kIconSizeHeight);
CGContextDrawImage(context, rect, image);
CGImageRelease(image);
CGContextFlush(context);
QDEndCGContext( GetWindowPort( mWindow ), &context );
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.