Marc Lehmann <[EMAIL PROTECTED]> writes:
> On Wed, Oct 29, 2008 at 10:48:48AM +0100, Frank Schmitt <[EMAIL PROTECTED]>
> wrote:
>> which works under both 32 and 64 bit. However I'm not sure if this works
>> on big-endian 64 bit systems as well and I've got no such system to test
>
> Me neither - I don't know how afterimage encodes the image data, but i
> suspect it's octet-encoded, so you would need to read the image data one
> octte a time and built your long's manually form the constituent bytes, e.g.
> (byte[0] << 24) | (byte[1] << 16) | ...
>
> If libafterimage stores the image as a series of 32 bit integers, then thw
> shifting would be unnecessary. this is unlikely to be the case, but certainly
> within the possible implementation choices.
I think it does 32 bit integers and I don't have to manually
convert. The ARGB is constructed from four separate channel arrays like
this:
register ARGB32 *data = imout->im->alt.argb32 ;
data[x] = MAKE_ARGB32( 0xFF, red[x], green[x], blue[x] );
with MAKE_ARGB32 defined as
#define MAKE_ARGB32(a,r,g,b) ((( (CARD32)a) <<24)| \
((((CARD32)r)&0x00FF)<<16)| \
((((CARD32)g)&0x00FF)<<8 )| \
(((CARD32)b)&0x00FF))
Just for reference below the complete conversion
encode_image_scanline_argb32( ASImageOutput *imout, ASScanline *to_store )
{
register ARGB32 *data = imout->im->alt.argb32 ;
if( imout->next_line < (int)imout->im->height && imout->next_line >= 0 )
{
register int x = imout->im->width;
register CARD32 *alpha = to_store->alpha ;
register CARD32 *red = to_store->red ;
register CARD32 *green = to_store->green ;
register CARD32 *blue = to_store->blue ;
if( !get_flags(to_store->flags, SCL_DO_RED) )
set_component( red, ARGB32_RED8(to_store->back_color), 0, to_store->width
);
if( !get_flags(to_store->flags, SCL_DO_GREEN) )
set_component( green, ARGB32_GREEN8(to_store->back_color), 0,
to_store->width );
if( !get_flags(to_store->flags, SCL_DO_BLUE) )
set_component( blue , ARGB32_BLUE8(to_store->back_color), 0,
to_store->width );
data += x*imout->next_line ;
if( !get_flags(to_store->flags, SCL_DO_ALPHA) )
while( --x >= 0 )
data[x] = MAKE_ARGB32( 0xFF, red[x], green[x], blue[x] );
else
while( --x >= 0 )
data[x] = MAKE_ARGB32( alpha[x], red[x], green[x], blue[x] );
if( imout->tiling_step > 0 )
tile_argb32_line( imout->im->alt.argb32, imout->next_line,
imout->bottom_to_top*imout->tiling_step,
imout->im->width, imout->im->height,
(imout->tiling_range ? imout->tiling_range:imout->im->height));
imout->next_line += imout->bottom_to_top;
}
}
--
Have you ever considered how much text can fit in eighty columns? Given that a
signature typically contains up to four lines of text, this space allows you to
attach a tremendous amount of valuable information to your messages. Seize the
opportunity and don't waste your signature on bullshit that nobody cares about.
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode