[cairo] Direct manipulation and write to PNG
Carlos López González
genetita at gmail.com
Mon Jul 9 13:55:11 PDT 2012
I'm sorry about my previous question to you Andrea, because I missed
the first part of your post.
Now that you kindly have explained it twice to me I understand that it
is needed to access the data using a 32 bits unsigned int to get it
with the correct endianess.
Thanks!
> For a code example, see the difference between the code I wrote and yours.
> In your code you are accessing each channel independently.
> Instead, in the code I wrote, each channel is provided as part of a
> 32-bit value, independent of the byte order.
>
> Basically, whenever you're doing pointer arithmetic to access a
> channel in a pixel, you're probably doing it wrong (well, it might be
> ok on your architecture, but the code is going to be
> endian-dependent).
> Use pointer arithmetic to get the pixel value and shift/masking to
> access channels.
--
Carlos
http://synfig.org
More information about the cairo
mailing list