Hi, thanks for your reply. I've got one more dumb question though. I'm not able to figure out how to do the declaration of the release callback.

Regards,

Adrian


On Jul 6, 2009, at 12:55 AM, vade wrote:

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:

Dear all,

I'm having some trouble trying to proceed with this custom patch that I've got. The patch basically accepts some numeric input parameters which determines what data to grab from a URL, and renders the results into an image to be send out via the output port of the patch.

I've got the image generated nicely as a NSImage, and I'm not stuck on how to send the NSImage to the output port. Would really appreciate some pointers on this, as I'm not even sure if I should be using NSImage for such operations or not.

thanks in advance,

Adrian

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/doktorp%40mac.com

This email sent to [email protected]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/adrian.lo%40gmail.com

This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to