|
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 +========================================================+ |
|
From: Ethan M. <merritt@u.washington.edu> - 2005-10-10 18:58:39
|
On Friday 07 October 2005 05:07 am, Shigeharu TAKENO wrote:
> shige 10/07 2005
> ----------------
>
> The following patch do use small number of colors in gd.trm.
Could you please explain why or when this is needed?
The current png driver (really libgd itself) only
stores the colors actually used by the plot.
For example:
gnuplot> set term png lw 2
gnuplot> set output 'colors.png'
gnuplot> plot sin(x),cos(x),x,x**2
gnuplot> quit
# identify -verbose colors.png
Image: colors.png
Format: PNG (Portable Network Graphics)
Geometry: 640x480
Class: DirectClass
Type: palette with transparency
Depth: 8 bits-per-pixel component
Colors: 13
2489: ( 0, 0, 0, 0) black
228: ( 31, 31, 31, 0) grey12
265: ( 63, 63, 63, 0) #3F3F3F00
161: ( 95, 95, 95, 0) #5F5F5F00
244: (127,127,127, 0) grey50
581: ( 0,192, 0, 0) #00C00000
554: ( 0,128,255, 0) #0080FF00
527: (255, 0, 0, 0) red
846: (192, 0,255, 0) #C000FF00
150: (159,159,159, 0) #9F9F9F00
147: (191,191,191, 0) grey75
234: (223,223,223, 0) #DFDFDF00
300774: (255,255,255, 0) grey100
Resolution: 72x72 pixels
You may ask why are there 13 colors rather than 6?
We requested white background, black text,
red, green, blue, magenta plot lines.
It is because antialiasing of the text to make it look smoother
introduces some grey pixels.
If I had not specified "lw 2" in the "set term png" command
there would also have been anti-aliasing of the colored lines,
which would have introduced additional colors.
> 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.
The png output only stores 256 colors if you create a plot that
uses 256 colors. That is primarily true for plots using the
pm3d palette. But any number of colors up to 256 still uses a
1-byte color index for each pixel ("Depth" in the output shown above).
So even in the case of pm3d images, reducing the colors to fewer than
256 will degrade the image while saving almost no space in the output
file.
It is true that if you generate 24-bit color images by explicitly
requesting "set term png truecolor", then it requires more storage
space. In this case there are 24 bits of color information per pixel
rather than 8 bits, so the output file will be roughly 3 times as large.
--
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center
Mailstop 357742
University of Washington, Seattle, WA 98195
|
|
From: Shigeharu T. <sh...@ie...> - 2005-10-11 05:42:02
|
shige 10/11 2005 ---------------- | From: Ethan Merritt <merritt@u.washington.edu> | Reply-To: merritt@u.washington.edu | To: gnu...@li... | Subject: Re: color loop for gd.trm | Date: Mon, 10 Oct 2005 11:58:39 -0700 | Cc: Shigeharu TAKENO <sh...@ie...> ===== | Could you please explain why or when this is needed? | | The current png driver (really libgd itself) only | stores the colors actually used by the plot. This patch is for user who want the same color behavior in png term as in x11 term (or win term) without setting set term png xffffff x000000 x404040 \ xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 \ xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 \ ... On current png term, line type 9 is not red under the simple setting: set term png xffffff x000000 x404040 \ xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 and the result of test command differs from the one on the x11 term. We found some requests on "Gnuplot Q&A board" http://ayapin.film.s.dendai.ac.jp/cgi-bin/trees.cgi (in Japanese) to set the same colors in png term as in win term. My patch may help them. +========================================================+ Shigeharu TAKENO NIigata Institute of Technology kashiwazaki,Niigata 945-1195 JAPAN sh...@ie... TEL(&FAX): +81-257-22-8161 +========================================================+ |
|
From: Ethan M. <merritt@u.washington.edu> - 2005-10-11 18:43:06
|
On Monday 10 October 2005 10:42 pm, Shigeharu TAKENO wrote:
>
> | From: Ethan Merritt <merritt@u.washington.edu>
> | Could you please explain why or when this is needed?
>
> This patch is for user who want the same color behavior in png
> term as in x11 term (or win term) without setting
>
> set term png xffffff x000000 x404040 \
> xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 \
> xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 \
I see. That is different from what I understood at first.
So your goal is not to reduce the total number of colors, instead
it is to have the same default colors on all terminals?
Bastian Maerkisch <bma...@we...> has recently raised this
same issue on the mailing list.
My feeling is that the default colors on different terminal types
should *not* be the same, because each terminal has its own set
of visual properties. For instance, yellow lines on white paper are
not easy to see - so why should PostScript or pen-plotter drivers
include yellow as one of the first 6 colors?
But I agree that the user should be able to request a particular set
of colors even if they are not the default. That is one reason I
wanted to introduce rgb colors to the core gnuplot code.
plot <foo> with lines lc rgb 'yellow'
now plots a yellow line on any terminal that supports rgb
colors, regardless of whether it is one of the default colors.
Please look again at the 2nd plot in the demo script "rainbow.dem",
which shows how to define a spectrum of line styles that will be
the same on all terminals.
The piece that is still missing is a command that tells gnuplot to
cycle through line *styles* rather than line *types* by default.
There should be a new command so that
set style line 1 lc rgb "purple"
set style line 2 lc rgb "yellow"
set <some_command_that_does_not_exist_yet>
plot sin(x), cos(x)
uses linestyle 1 for sin(x) and linestyle 2 for cos(x) so
that the plot is purple and yellow, instead of red and green.
Would this provide what you want?
> We found some requests on "Gnuplot Q&A board"
> http://ayapin.film.s.dendai.ac.jp/cgi-bin/trees.cgi
> (in Japanese)
Thank you for relaying requests from that group.
I will try to look there if you point out specific requests,
but I can't read Japanese well enough or fast enough to monitor
it regularly.
--
Ethan A Merritt merritt@u.washington.edu
Biomolecular Structure Center
Mailstop 357742
University of Washington, Seattle, WA 98195
|
|
From: Petr M. <mi...@ph...> - 2005-10-11 18:51:48
|
>> set term png xffffff x000000 x404040 \ >> xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 \ >> xff0000 x00ff00 x0000ff xff00ff x00ffff xa0522d xffa500 xff7f50 \ > > I see. That is different from what I understood at first. > > So your goal is not to reduce the total number of colors, instead > it is to have the same default colors on all terminals? What about set style linetype colorsequence red,green,blue,"FFEE00", ... which would redefine the color sequence for the linetype series, and then it would become the same for all terminals? --- PM |
|
From: Ethan M. <merritt@u.washington.edu> - 2005-10-11 19:12:47
|
On Tuesday 11 October 2005 11:51 am, Petr Mikulik wrote: > > What about > > set style linetype colorsequence red,green,blue,"FFEE00", ... I would prefer to go for the fully general case of defining a sequence of line styles. That way you could also give a preferred sequence of line widths, dot/dash patterns, point types, and so on. I have not given a lot of thought to what the best command syntax would be. Not all the line styles would be wanted for the default sequence, for example. Maybe set style line sequence 1,2,6,5 meaning: cycle through four default line styles (styles 1,2,6 and 5) when generating plots. As is currently the case for linetypes, it wraps around so that in this example the fifth plot again uses line style 1. -- Ethan A Merritt merritt@u.washington.edu Biomolecular Structure Center Mailstop 357742 University of Washington, Seattle, WA 98195 |
|
From: Shigeharu T. <sh...@ie...> - 2005-10-14 09:56:50
|
shige 10/14 2005
----------------
| From: Ethan Merritt <merritt@u.washington.edu>
| To: Shigeharu TAKENO <sh...@ie...>
| Subject: Re: color loop for gd.trm
| Date: Tue, 11 Oct 2005 11:42:36 -0700
| Cc: gnu...@li...
=====
| So your goal is not to reduce the total number of colors, instead
| it is to have the same default colors on all terminals?
No. I only want to realize x11 or win term's color loops on png
term simply.
| My feeling is that the default colors on different terminal types
| should *not* be the same, because each terminal has its own set
| of visual properties.
I agree with you.
+========================================================+
Shigeharu TAKENO NIigata Institute of Technology
kashiwazaki,Niigata 945-1195 JAPAN
sh...@ie... TEL(&FAX): +81-257-22-8161
+========================================================+
|
|
From: Petr M. <mi...@ph...> - 2005-10-21 16:02:12
|
> | So your goal is not to reduce the total number of colors, instead > | it is to have the same default colors on all terminals? > > No. I only want to realize x11 or win term's color loops on png > term simply. > > | My feeling is that the default colors on different terminal types > | should *not* be the same, because each terminal has its own set > | of visual properties. Then there should be these groups of color terminals, each group with the same color sequence: screen&bitmaps: x11, windows, pm, wx png, gif, jpeg, ... svg, cgm, wmf, ... xfig, corel, ... postscript and other paper printings: postscript, pdf, pslatex, pstex But both should not "differ too much". Maybe a "screen_color_sequence" option for postscripts? It would be really great if someone unitifies the sequence for at least 16 colors. --- PM |
|
From: Hans-Bernhard B. <br...@ph...> - 2005-10-24 14:35:19
|
Petr Mikulik wrote: > Then there should be these groups of color terminals, each group with > the same color sequence: > screen&bitmaps: > x11, windows, pm, wx > png, gif, jpeg, ... Neither of the below is particular 'screen', and none of them is a bitmap. So I don't see convincing reasons they should use the 'screen' colour sequence, instead of the 'paper' one. > svg, cgm, wmf, ... > xfig, corel, ... |
|
From: Petr M. <mi...@ph...> - 2005-10-24 17:08:44
|
>> Then there should be these groups of color terminals, each group with the >> same color sequence: >> screen&bitmaps: >> x11, windows, pm, wx >> png, gif, jpeg, ... > > Neither of the below is particular 'screen', and none of them is a bitmap. > So I don't see convincing reasons they should use the 'screen' > colour sequence, instead of the 'paper' one. >> svg, cgm, wmf, ... >> xfig, corel, ... What is your proposal for the color unification? --- PM |
|
From: Shigeharu T. <sh...@ie...> - 2005-10-27 00:50:56
|
shige 10/27 2005
----------------
| Date: Fri, 21 Oct 2005 18:01:56 +0200 (CEST)
| From: Petr Mikulik <mi...@ph...>
| To: Shigeharu TAKENO <sh...@ie...>
| Cc: merritt@u.washington.edu, gnu...@li...
| Subject: Re: color loop for gd.trm
=====
| > | So your goal is not to reduce the total number of colors, instead
| > | it is to have the same default colors on all terminals?
| >
| > No. I only want to realize x11 or win term's color loops on png
| > term simply.
=====
| Then there should be these groups of color terminals, each group with the
| same color sequence:
| screen&bitmaps:
| x11, windows, pm, wx
| png, gif, jpeg, ...
| svg, cgm, wmf, ...
| xfig, corel, ...
| postscript and other paper printings:
| postscript, pdf, pslatex, pstex
|
| But both should not "differ too much". Maybe a "screen_color_sequence"
| option for postscripts?
I don't know such option of postscript terminal.
| It would be really great if someone unitifies the sequence for at least 16
| colors.
I am sorry I can't understand many good opinions from many
authors well, and I seem the topic have spreaded too widely. So I
explain my opinion.
In png terminal, we can set any color sequence. And some users
want to know how to set it to the same one of x11 (or win) term.
I use the color sequence setting of png terminal, but the test
command don't make the same image because png terminal use
original color over the user setting.
So, I think I will be able to set simply if png terminal has the
color loop option.
Is not useful to introduce such looping option (limitation of use
of colors) to png terminal ?
+========================================================+
Shigeharu TAKENO NIigata Institute of Technology
kashiwazaki,Niigata 945-1195 JAPAN
sh...@ie... TEL(&FAX): +81-257-22-8161
+========================================================+
|
|
From: Petr M. <mi...@ph...> - 2005-10-27 20:50:10
|
> | But both should not "differ too much". Maybe a "screen_color_sequence" > | option for postscripts? > > I don't know such option of postscript terminal. That was a pure proposal. > | It would be really great if someone unitifies the sequence for at least 16 > | colors. > > I am sorry I can't understand many good opinions from many > authors well, and I seem the topic have spreaded too widely. If someone writes down a sequence of 16, 32, or ... colors which will be the same on all terminals, than we can vote to put it there. > In png terminal, we can set any color sequence. And some users > want to know how to set it to the same one of x11 (or win) term. > I use the color sequence setting of png terminal, but the test > command don't make the same image because png terminal use > original color over the user setting. Currently "many" terminals have the same color seq as the postscript terminal, for at least the first "few" color items. > Is not useful to introduce such looping option (limitation of use > of colors) to png terminal ? It would be nice to have this feature consistent for all terminals. --- PM |
|
From: Shigeharu T. <sh...@ie...> - 2005-11-05 10:51:50
|
shige 11/05 2005
----------------
Thank you for your kindly reply.
| Date: Thu, 27 Oct 2005 22:49:58 +0200 (CEST)
| From: Petr Mikulik <mi...@ph...>
| To: Shigeharu TAKENO <sh...@ie...>
| Cc: gnu...@li...
| Subject: Re: color loop for gd.trm
=====
| > | It would be really great if someone unitifies the sequence for at least 16
| > | colors.
| >
| > I am sorry I can't understand many good opinions from many
| > authors well, and I seem the topic have spreaded too widely.
|
| If someone writes down a sequence of 16, 32, or ... colors which will be the
| same on all terminals, than we can vote to put it there.
I understand.
| > In png terminal, we can set any color sequence. And some users
| > want to know how to set it to the same one of x11 (or win) term.
| > I use the color sequence setting of png terminal, but the test
| > command don't make the same image because png terminal use
| > original color over the user setting.
|
| Currently "many" terminals have the same color seq as the postscript
| terminal, for at least the first "few" color items.
I understand. Certainly png terminal also has the same color
sequence from 1 to 5 as ps terminal.
| > Is not useful to introduce such looping option (limitation of use
| > of colors) to png terminal ?
|
| It would be nice to have this feature consistent for all terminals.
The period of the color sequence is 9 for ps terminal, 8 for x11,
and 15 for win, these are short. But for png, it is too long
(256?), so I think the looping option is only for png terminal at
first.
+========================================================+
Shigeharu TAKENO NIigata Institute of Technology
kashiwazaki,Niigata 945-1195 JAPAN
sh...@ie... TEL(&FAX): +81-257-22-8161
+========================================================+
|