Le 6 mai 2011 à 22:22, eveningnick eveningnick a écrit :
> Hi > I have a CVPixelBuffer with some background picture. > I need to draw on this background some foreground image. I don't need > to preserve the initial CVPixelBuffer's content - i just need to add a > small foreground watermark onto that buffer. > > CIImage does allow to create an image from CVPixelBuffer and paint > something on top of it (using Core Image filters), but CIImage is > "read only" - it takes a source image and generates a brand new image > in a new buffer. > I can't afford one more copying, that greatly slows things down, > because the CVPixelBuffer itself is kind of big. And there are a lot > of them per second (they are generated as frames from a movie). > > Is there any way i could draw without such a copy? Maybe there is any > other imaging framework that allows me to work with CVPixelBufferRef? > Or should i just 'CVPixelBufferLock' the buffer, and copy raw bytes > onto the buffer from my source NSImage (that contains the foreground > image) directly using a loop? This doesn't seem the right way though. > Could you please help me, what is better to do here? If your pixel buffer has a format supported by the CGBitmapContext API, you can use the later to draw into it. Create a CGBitmapContext using the memory from you CVPixelBuffer, and draw using the CGContext API. -- Jean-Daniel _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com