Hi all,

I have a simple requirement: take a buffer I malloc myself and get that 
rendered as an image using CGImage.

I'm creating a data provider using CGDataProviderCreateWithData(), then using 
that to create a CGImage of the desired dimensions and format. This is later 
drawn using CGContextDrawImage().

The original buffer is updated directly by writing pixel values into the 
buffer, then the appropriate part of the view is invalidated which causes the 
image to redraw. All I get is a black image - the data I write to the buffer 
appears not to affect anything.

Is this the right way to handle this? I understand that the whole system with 
data providers and so on is intended for efficient image rendering and 
decoding, but in this case I want to get back to almost the most basic 
situation possible. So maybe CGImage is caching the content of my buffer once 
and not re-reading from it each time, which would explain my results? How can I 
set up an image that just blits my buffer and doesn't try anything clever like 
caching?

--Graham



_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to