From: Shigeharu T. <sh...@ie...> - 2005-10-07 12:07:40
|
shige 10/07 2005 ---------------- The following patch do use small number of colors in gd.trm. This enables to set simply the same colors as in x11 term by: set term png colorloop xffffff x000000 x404040 \ xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 or as in win term by: set term gif colorloop xffffff x000000 x404040 \ xff0000 x00ff00 x0000ff xff00ff x000080 \ x800000 x008080 x000000 x808080 x008040 \ x808000 x800080 xc0c0c0 x00ffff xffff00 Although png term use 256 colors even if the number of colors was given explicitly, the colorloop option tells gnuplot to use only specified colors. ----- From here ----- --- gd.trm.ORG Sat Sep 24 15:42:05 2005 +++ gd.trm Fri Oct 7 20:48:34 2005 @@ -101,6 +101,8 @@ * added support for line width and TrueType fonts */ +#define COLORLOOP + #include "driver.h" #ifdef TERM_REGISTER @@ -221,6 +223,9 @@ PNG_TRUECOLOR, PNG_NOTRUECOLOR, PNG_LINEWIDTH, GIF_ANIMATE, GIF_DELAY, GIF_LOOP, GIF_NOOPT, +#ifdef COLORLOOP + PNG_COLORLOOP, +#endif PNG_OTHER }; @@ -233,6 +238,9 @@ static int PNG_YMAX = GREG_YMAX; static const int PNG_POINT_SCALE = 3; static int PNG_ps = 3; +#ifdef COLORLOOP +static int PNG_color_loop = FALSE; +#endif static struct gen_table PNG_opts[] = { @@ -259,6 +267,9 @@ { "loop", GIF_LOOP }, { "noopt$imize", GIF_NOOPT }, /* end of gif animation options */ { "lw", PNG_LINEWIDTH }, +#ifdef COLORLOOP + { "colorloop", PNG_COLORLOOP }, +#endif { NULL, PNG_OTHER } }; @@ -694,6 +705,12 @@ png_state.frame_optimization = FALSE; gif_anim_option = 1; break; +#ifdef COLORLOOP + case PNG_COLORLOOP: + PNG_color_loop = TRUE; + c_token++; + break; +#endif case PNG_OTHER: default: @@ -839,6 +856,9 @@ sprintf(term_options + strlen(term_options), "size %d,%d ", PNG_XMAX, PNG_YMAX); +#ifdef COLORLOOP + if(PNG_color_loop) strcat(term_options,"color_loop "); +#endif for (i = 0; strlen(term_options) + 9 < MAX_LINE_LEN && i < png_state.n_colors; i++) { @@ -1156,8 +1176,13 @@ (web_color_rgbs[i].r << 16) | (web_color_rgbs[i].g << 8) | web_color_rgbs[i].b; +#ifdef COLORLOOP + if (PNG_color_loop == FALSE && png_state.n_colors < WEB_N_COLORS) + png_state.n_colors = WEB_N_COLORS; +#else if (png_state.n_colors < WEB_N_COLORS) png_state.n_colors = WEB_N_COLORS; +#endif for (i = 0; i < png_state.n_colors; i++) { rgb = png_state.rgb_table[i]; png_state.color_table[i] = ----- To here ------ +========================================================+ Shigeharu TAKENO NIigata Institute of Technology kashiwazaki,Niigata 945-1195 JAPAN sh...@ie... TEL(&FAX): +81-257-22-8161 +========================================================+ |