HEAP@bmc.uu.se (07/05/89)
Hi,
I am currently working on a GIFviewer for my apollo dn4000. I
don't know whether I am reinventing the wheel, and such a
program already exists, but still I am...
Anyway: I have come so far that the picture is displayed alright,
but for the colours! As you can see from the code fragment I have
enclosed, I call gpr_$set_color_map in what I belive the correct way.
The problem is that the image still is displayed in the default
colour map, and not in mine. I verified this by commenting the
gpr_$set_color_map call out. I get no errors from gpr_$set_color_map,
just wrong colour map.
The call chain is something like this:
main -> init (initializes gpr)
-> readscreen (loads global data)
-> readimage -> initcolors -> color_entry
-> gpr_$terminate
Could somebody please tell me what I am doing wrong!
--
Karl-K|nig K|nigsson
(if you reply by mail, use the address below rather than the one in
the header - that one might cause the letter to go astray)
+----------------------------------------------------------------------+
| Email: Koenig@tdb.uu.se or Syskoenig@kemist.uu.se (se=sweden) |
| Tel : +46 - (0)18 - 13 55 66 (home) or 18 29 78 (work) |
+----------------------------------------------------------------------+
|"Why stop now, just when I'm hating it" -- Marvin the Paranoid Android|
+----------------------------------------------------------------------+
void init(mode)
gpr_$display_mode_t mode;
{
.
. as in the c-examples in the gpr manual
.
}
gpr_$color_t color_entry(red, green, blue)
short red, green, blue;
{
return (red << 16) + (green << 8) + blue;
}
void initcolors(colormap, ncolors)
unsigned char colormap[256][3];
int ncolors;
{
register i;
static gpr_$pixel_value_t start_index = 0;
gpr_$color_vector_t gpr_color_map;
for (i=0; i < ncolors; i++)
gpr_color_map[i] = color_entry(colormap[i][0],
colormap[i][1],
colormap[i][2]);
gpr_$set_color_map(start_index, ncolors, gpr_color_map, status);
check("setting color map");
}
void main(argc,argv)
int argc;
char *argv[];
{
.
.
init(gpr_$borrow); /* initialize the GPR graphics package */
.
.
readscreen(); /* load global screen data */
.
.
readimage(); /* read and uncompress the current image */
.
.
gpr_$terminate(false, status);
}
---------------------------------------------------------------------------