Re: Direct manipulation and write to PNG
Carlos López González <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAF52pz+VbEiq5F=o0J=ppoCrqmGrMssOeHb1=y+Qq7YVLWaXeg@mail.gmail.com> |
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 -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo