Menu

#1552 postscript polygon color missing or malfunction

None
closed
nobody
None
2015-05-19
2015-02-01
Dan Sebald
No

When drawing a rectangle object on the plot, postscript terminals produce a polygon which is black (i.e., RGB of 0,0,0). Other terminals seem to be fine. Here's an example:

# Test script for which postscript doesn't have proper polygon color
set terminal postscript enhanced size 8,6 eps 20 dashlength 2
set output 'foo.eps';
set obj 2 rectangle from graph 0,0 to graph 1,1 behind fc rgb "#35ffff"
plot x
set output
set terminal png
set output 'foo.png';
replot
set output

I've looked at the postscript terminal polygon command, PS_filled_polygon, and I don't see any use of color in that routine. Perhaps the color is set by some other routine prior to calling the PS_filled_polygon function, but the EPS file output doesn't seem to have the color anywhere. I'll write more or create a patch when I've made more sense of the PostScript code.

Discussion

  • Christoph Bersch

    That script works fine if you add the color option to the postscript terminal settings. Postscript has monochrome as default.

     
  • Dan Sebald

    Dan Sebald - 2015-02-01

    Oh. Thanks.

    That begs the question as to why monochrome should be the default setting as opposed to color (or grayscale). I'm looking up background on PostScript and I believe the first version of the language (certainly, PS2.0) has definitions for gray-level, RGB color and CMYK color. So any device from the beginnings of PostScript that supported the language should be able to translate color and grayscale commands even if the archaic device itself could only handle monotone. Monotone was in the language for what looks like good compression of binary images, via run length encoding. What's more, it may be that PostScript thought as much to have half-toning support so that grayscale could be simulated on monochrome devices.

    If I'm recalling correctly, we were very careful with the PostScript gnuplot terminals to have a version setting, i.e., 1.0, 2.0 or greater, that uses features as best as possible within each version. So anyone who has a constricting hardware/interpreter PostScript device should have the flexibility to start out with the most features and reduce the feature set as suited.

    Guess I'd prefer that color be the default setting for postscript terminals. Any recollection as to why monochrome is default? Should we bring this to the discussion list?

     
  • Ethan Merritt

    Ethan Merritt - 2015-02-01

    It's a lose-lose choice. If we leave it the way it is (as we did for version 5) then it differs from other terminals. If we change it to match other terminals, then people complain that it breaks 20+ years of old scripts that assumed PostScript produced monochrome plots by default.

     
  • Dan Sebald

    Dan Sebald - 2015-02-02

    I suppose, but I really wonder who would miss monochrome as a default, aside from the Calcomp plotter contingent.

    Anyway, I see that PNG Cairo has color|mono setting. What about grayscale? I would think that grayscale should be an option if mono is. There's as much use for something like grayscale plots as there is for mono plots.

     
  • Ethan Merritt

    Ethan Merritt - 2015-02-02

    I thought this was in the FAQ for using PostScript. If you want to map RGB color to greyscale you can redefine the function rgbcolor in the prolog

    /setrgbcolor {.11 mul exch .59 mul add exch .30 mul add setgray} bind def
    

    I suppose we could add that to the standard prolog with a comment character in front of it so that all you have to do is delete the comment char.

     
  • Ethan Merritt

    Ethan Merritt - 2015-02-06
    • status: open --> pending-works-for-me
     
  • Dan Sebald

    Dan Sebald - 2015-02-06

    Over the past couple days I made some changes in the application that uses gnuplot, supplying "color" by default to the generated gnuplot command. Feel free to close this bug report.

     
  • Ethan Merritt

    Ethan Merritt - 2015-05-19
    • status: pending-works-for-me --> closed
    • Group: -->
    • Priority: 5 -->
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.