|
From: Roger H. <rog...@mi...> - 2008-03-14 19:42:48
|
It looks like Red has gone to Alpha, green has gone to Red, Blue has gone to green and Alpha has gone to Blue. Try this: pixel. fourChars [ 3 ] = correct ( rgbaPixels [ i ] [ 3 ] ) ; pixel. fourChars [ 0 ] = correct ( rgbaPixels [ i ] [ 2 ] ) ; pixel. fourChars [ 1 ] = correct ( rgbaPixels [ i ] [ 1 ] ) ; pixel. fourChars [ 2 ] = correct ( rgbaPixels [ i ] [0 ] ) ; and if that doesn't work it must be: pixel. fourChars [ 1 ] = correct ( rgbaPixels [ i ] [ 3 ] ) ; pixel. fourChars [ 2 ] = correct ( rgbaPixels [ i ] [ 2 ] ) ; pixel. fourChars [ 3 ] = correct ( rgbaPixels [ i ] [ 1 ] ) ; pixel. fourChars [ 0 ] = correct ( rgbaPixels [ i ] [0 ] ) ; Roger. On 14 Mar, 2008, at 11:26, Daniele Cavallini wrote: > I tried to implement this solution but it don't work well. > (I set anUnsignedInt like TQ3Uns32 ) > The create colors aren't correct. > You can see > As it would have to be > http://www.interstudio.net/quesa/init.jpg > as it is > http://www.interstudio.net/quesa/res.jpg > I use imac intel. > > I don't know why doesn't work. > It isn't a good solution to use #define /QUESA_HOST_IS_BIG_ENDIAN > /because there are mac with intel and powerpc processor. > How I know in runtime if computer have an intel or powerpc processor? > > > Have you Some ideas? > // > Roger Holmes ha scritto: >> 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. >> >> >> --------------------------------------------------------------------- >> ---- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Quesa-develop mailing list >> Que...@li... >> https://lists.sourceforge.net/lists/listinfo/quesa-develop >> >> > > ---------------------------------------------------------------------- > --- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Quesa-develop mailing list > Que...@li... > https://lists.sourceforge.net/lists/listinfo/quesa-develop |