home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ARM Club 3
/
TheARMClub_PDCD3.iso
/
hensa
/
graphics
/
gif2rpc_1
/
source
/
c
/
calcpixtrans
< prev
next >
Wrap
Text File
|
1995-10-07
|
1KB
|
49 lines
/* calcpixtrans.c
* AUTHOR: Cy Booker, cy@cheepnis.demon.co.uk
* LICENSE: FreeWare, Copyright (c) 1995 Cy Booker
* PURPOSE: generic pixel translation routine
*/
#include "gif2rpc:process_gif.h"
#include <assert.h>
#include "OS:macros.h"
/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
extern void process_gif_calc_pixtrans(
const process_gif *p,
bits *pixtrans) {
int red, grn, blu;
os_colour colour;
int i;
rgbtupleout err;
rgbtupleout_fn fn;
const os_colour *palette;
assert(p);
assert(pixtrans);
assert(p->fn);
assert(p->in_palette.colours);
assert(p->in_palette.ncolours > 0);
err.palette = p->out_palette; /* structure copy */
palette = p->in_palette.colours;
fn = p->fn;
for (i= p->in_palette.ncolours - 1; (i >= 0); i--) {
colour = palette[i];
red = (colour >> (1*8)) & 0xff; red |= red << 8;
grn = (colour >> (2*8)) & 0xff; grn |= grn << 8;
blu = (colour >> (3*8)) & 0xff; blu |= blu << 8;
pixtrans[i] = (*fn)(&err, red, grn, blu);
}
}