|
From: Roger H. <rog...@mi...> - 2007-10-02 12:54:21
|
On the other hand, if we define
union longAndFourChars
{
char fourChars [ 4 ] ;
unsigned long int anUnsignedInt ;
}
longAndFourChars pixel ;
then
pixel. fourChars [ 0 ] = correct ( rgbaPixels [ i ] [ 3 ] ) ;// Alpha
pixel. fourChars [ 1 ] = correct ( rgbaPixels [ i ] [ 2 ] ) ;
pixel. fourChars [ 2 ] = correct ( rgbaPixels [ i ] [ 1 ] ) ;
pixel. fourChars [ 3 ] = correct ( rgbaPixels [ i ] [0 ] ) ;
* ( ( unsigned int* ) rowAddr ) = pixel. anUnsignedInt ;
Then won't that work on either endian machine?
Roger.
|