=================================================================== RCS file: /home/cvs/OpenXM_contrib/gnuplot/Attic/bitmap.c,v retrieving revision 1.1 retrieving revision 1.1.1.3 diff -u -p -r1.1 -r1.1.1.3 --- OpenXM_contrib/gnuplot/Attic/bitmap.c 2000/01/09 17:00:49 1.1 +++ OpenXM_contrib/gnuplot/Attic/bitmap.c 2003/09/15 07:09:24 1.1.1.3 @@ -1,5 +1,5 @@ #ifndef lint -static char *RCSid = "$Id: bitmap.c,v 1.1 2000/01/09 17:00:49 maekawa Exp $"; +static char *RCSid = "$Id: bitmap.c,v 1.1.1.3 2003/09/15 07:09:24 ohara Exp $"; #endif /* GNUPLOT - bitmap.c */ @@ -678,6 +678,110 @@ char_row GPFAR fnt13x25[FNT_CHARS][FNT13X25_VBITS] = { 0x1249,000000,000000,0x1249,000000,000000,0x1249}, }; +/* Moved here from gif.trm */ +struct rgb web_color_rgbs[] = +{ + { 0xff, 0xff, 0xff }, /* background: white */ + { 0x00, 0x00, 0x00 }, /* borders: black */ + { 0xa0, 0xa0, 0xa0 }, /* x & y axes: grey */ + { 0xff, 0x00, 0x00 }, /* color 01: red */ + { 0x00, 0xc0, 0x00 }, /* color 02: dark green */ + { 0x00, 0x80, 0xff }, /* color 03: dark blue */ + { 0xc0, 0x00, 0xff }, /* color 04: dark magenta */ + { 0xc0, 0xff, 0x40 }, /* color 05: yellow */ + { 0xc0, 0x40, 0x00 }, /* color 06: orange */ + { 0x40, 0xff, 0x80 }, /* color 07: sea green */ + { 0x20, 0x20, 0xc0 }, /* color 08: royal blue */ + { 0x80, 0x00, 0xc0 }, /* color 09: dark violet */ + /* please note: these colors are optimized for web216 compatibility */ + { 0x00, 0x60, 0x80 }, /* DeepSkyBlue4 */ + { 0x00, 0x80, 0x00 }, /* green4 */ + { 0x00, 0x80, 0x40 }, /* SpringGreen4 */ + { 0x00, 0x80, 0x80 }, /* dark cyan, turquoise4 */ + { 0x00, 0xc0, 0x60 }, /* SpringGreen3 */ + { 0x00, 0xc0, 0xc0 }, /* cyan3, turquoise3 */ + { 0x00, 0xff, 0x00 }, /* green */ + { 0x20, 0x80, 0x20 }, /* forest green */ + { 0x30, 0x60, 0x80 }, /* SteelBlue4 */ + { 0x40, 0x40, 0x40 }, /* grey25-31 */ + { 0x40, 0x80, 0x00 }, /* chartreuse4 */ + { 0x00, 0x00, 0x80 }, /* dark blue, navy blue */ + { 0x80, 0x60, 0x00 }, /* DarkGoldenrod4 */ + { 0x80, 0x60, 0x10 }, /* goldenrod4 */ + { 0x80, 0x60, 0x60 }, /* pink4 */ + { 0x80, 0x60, 0x80 }, /* plum4 */ + { 0x00, 0x00, 0xc0 }, /* medium blue */ + { 0x00, 0x00, 0xff }, /* blue */ + { 0x00, 0x60, 0x00 }, /* dark green */ + { 0x40, 0xc0, 0x80 }, /* SeaGreen3 */ + { 0x60, 0xa0, 0xc0 }, /* SkyBlue3 */ + { 0x60, 0xc0, 0x00 }, /* chartreuse3 */ + { 0x60, 0xc0, 0xa0 }, /* medium aquamarine */ + { 0x80, 0x00, 0x00 }, /* dark red */ + { 0x80, 0x00, 0x80 }, /* dark magenta */ + { 0x60, 0x20, 0x80 }, /* DarkOrchid4 */ + { 0x60, 0x60, 0x60 }, /* dim grey */ + { 0x00, 0xff, 0xff }, /* cyan1, turquoise1 */ + { 0x20, 0x20, 0x20 }, /* grey13-18 */ + { 0x20, 0x40, 0x40 }, /* dark slate grey */ + { 0x20, 0x40, 0x80 }, /* RoyalBlue4 */ + { 0x60, 0x80, 0x20 }, /* olive drab */ + { 0x60, 0x80, 0x60 }, /* DarkSeaGreen4 */ + { 0x60, 0x80, 0x80 }, /* LightBlue4, PaleTurquoise4 */ + { 0x80, 0x80, 0x40 }, /* LightGoldenrod4, khaki4 */ + { 0x80, 0x80, 0x80 }, /* grey51-56 */ + { 0xa0, 0xa0, 0xa0 }, /* dark grey, grey63-68 */ + { 0xa0, 0xd0, 0xe0 }, /* light blue */ + { 0xc0, 0x20, 0x20 }, /* firebrick3 */ + { 0xc0, 0x60, 0x00 }, /* DarkOrange3 */ + { 0x80, 0xc0, 0xe0 }, /* sky blue */ + { 0xc0, 0x60, 0xc0 }, /* orchid3 */ + { 0xc0, 0x80, 0x00 }, /* orange3 */ + { 0xc0, 0x80, 0x60 }, /* LightSalmon3 */ + { 0xff, 0x40, 0x00 }, /* orange red */ + { 0xff, 0x40, 0x40 }, /* brown1, tomato */ + { 0x80, 0xc0, 0xff }, /* light sky blue */ + { 0xff, 0x80, 0x60 }, /* salmon */ + { 0xff, 0x80, 0x80 }, /* light coral */ + { 0xc0, 0xa0, 0x00 }, /* gold3 */ + { 0xc0, 0xc0, 0xc0 }, /* grey76-81, honeydew3, ivory3, snow3 */ + { 0xc0, 0xff, 0xc0 }, /* DarkSeaGreen1 */ + { 0xff, 0x00, 0x00 }, /* red */ + { 0xff, 0x00, 0xff }, /* magenta */ + { 0xff, 0x80, 0xa0 }, /* PaleVioletRed1 */ + { 0xff, 0x80, 0xff }, /* orchid1 */ + { 0xc0, 0xc0, 0xa0 }, /* LemonChiffon3 */ + { 0xff, 0x60, 0x60 }, /* IndianRed1 */ + { 0xff, 0x80, 0x00 }, /* dark orange */ + { 0xff, 0xa0, 0x00 }, /* orange */ + { 0x80, 0xe0, 0xe0 }, /* CadetBlue2, DarkSlateGray2 */ + { 0xa0, 0xe0, 0xe0 }, /* pale turquoise */ + { 0xa0, 0xff, 0x20 }, /* green yellow */ + { 0xc0, 0x00, 0x00 }, /* red3 */ + { 0xc0, 0x00, 0xc0 }, /* magenta3 */ + { 0xa0, 0x20, 0x20 }, /* brown */ + { 0xa0, 0x20, 0xff }, /* purple */ + { 0x80, 0x20, 0x00 }, /* OrangeRed4 */ + { 0x80, 0x20, 0x20 }, /* brown4 */ + { 0x80, 0x40, 0x00 }, /* DarkOrange4 */ + { 0x80, 0x40, 0x20 }, /* sienna4 */ + { 0x80, 0x40, 0x80 }, /* orchid4 */ + { 0x80, 0x60, 0xc0 }, /* MediumPurple3 */ + { 0x80, 0x60, 0xff }, /* SlateBlue1 */ + { 0x80, 0x80, 0x00 }, /* yellow4 */ + { 0xa0, 0x80, 0xff }, /* MediumPurple1 */ + { 0xc0, 0x60, 0x80 }, /* PaleVioletRed3 */ + { 0xc0, 0xc0, 0x00 }, /* yellow3 */ + { 0xff, 0x80, 0x40 }, /* sienna1 */ + { 0xff, 0xa0, 0x40 }, /* tan1 */ + { 0xff, 0xa0, 0x60 }, /* sandy brown */ + { 0xff, 0xa0, 0x70 }, /* light salmon */ + { 0xff, 0xc0, 0x20 }, /* goldenrod1 */ + { 0xff, 0xc0, 0xc0 }, /* RosyBrown1, pink */ + { 0xff, 0xff, 0x00 }, /* yellow */ + { 0xff, 0xff, 0x80 }, /* khaki1 */ + { 0xff, 0xff, 0xc0 } /* lemon chiffon */ +}; /* ** The plotting area is defined as a huge bitmap. @@ -742,8 +846,6 @@ unsigned int x, y, value; } -/* Currently unused */ -#if 0 /* * get pixel (x,y) value */ @@ -753,7 +855,7 @@ unsigned int x, y; { register unsigned int row; register unsigned char mask; - register unsigned char value; + register unsigned char value = 0; int i; if (b_rastermode) { @@ -772,10 +874,10 @@ unsigned int x, y; row -= b_psize; value <<= 1; } - return(value); - } - else - { +/* HBB 991123: the missing '>>1' was the 'every second color' problem + * with PNG in 3.8a...*/ + return(value>>1); + } else { #ifdef BITMAPDEBUG if (b_rastermode) fprintf(stderr, "Warning: getpixel(%d,%d) out of bounds\n", @@ -786,7 +888,6 @@ unsigned int x, y; return(0); } } -#endif /* 0 */ /* @@ -810,11 +911,11 @@ unsigned int x, y, planes; b_angle = 0; b_rastermode = 0; /* allocate row pointers */ - b_p = (bitmap *) gp_alloc((unsigned long) rows * sizeof(pixels *), "bitmap row buffer"); + b_p = (bitmap *) gp_alloc(rows * sizeof(pixels *), "bitmap row buffer"); memset(b_p, 0, rows * sizeof(pixels *)); for (j = 0; j < rows; j++) { /* allocate bitmap buffers */ - (*b_p)[j] = (pixels *) gp_alloc((unsigned long) x * sizeof(pixels), (char *) NULL); + (*b_p)[j] = (pixels *) gp_alloc(x * sizeof(pixels), (char *) NULL); if ((*b_p)[j] == (pixels *) NULL) { b_freebitmap(); /* free what we have already allocated */ int_error("out of memory for bitmap buffer", NO_CARET);