| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| you will most likely need to use an NSBitmapImageRep or a CVPixelbuffer to provide raw pixel values, and then output an image provider using your QCContexts incredibly long: - (id) outputImageProviderFromBufferWithPixelFormat:(NSString*)format pixelsWide:(NSUInteger)width pixelsHigh:(NSUInteger)height baseAddress:(const void*)baseAddress bytesPerRow:(NSUInteger)rowBytes releaseCallback:(QCPlugInBufferReleaseCallback)callback releaseContext:(void*)context colorSpace:(CGColorSpaceRef)colorSpace shouldColorMatch:(BOOL)colorMatch method. The release context is not a GL context or anything, just a void * you can pass in to your release function to point it at whatever you want to make your life easier. Here is working code from a CVPixelBuffer to an output port, where aBuffer is just an unsigned char* buffer. Im pretty sure you can do that same with NSBitmapImageRep CVReturn error = CVPixelBufferCreateWithBytes(NULL, width, height, k32ARGBPixelFormat, aBuffer, rowBytes, NULL, NULL, NULL, &cvImageBuffer); if(CVPixelBufferLockBaseAddress(cvImageBuffer,0) == kCVReturnSuccess) { provider = [context outputImageProviderFromBufferWithPixelFormat:QCPlugInPixelFormatARGB8 pixelsWide:width pixelsHigh:height baseAddress:CVPixelBufferGetBaseAddress(cvImageBuffer) bytesPerRow:CVPixelBufferGetBytesPerRow(cvImageBuffer) releaseCallback:_BufferReleaseCallback releaseContext:NULL colorSpace:CGColorSpaceCreateWithName(kCGColorSpaceGenericRGBLinear) shouldColorMatch:YES]; CVPixelBufferUnlockBaseAddress(cvImageBuffer,0); } Hope this helps! On Jul 5, 2009, at 12:08 PM, Adrian Lo wrote:
|
_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden This email sent to email@hidden
| References: | |
| >NSImage to output port of a custom patch (From: Adrian Lo <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.