Menu

#54 -rv currently does not reverse colours of EPS figures

open
nobody
5
2004-05-24
2004-05-24
Anonymous
No

Currently, xdvi -rv (or xdvi -fg white -bg black) only
reverses the
colours of the text, not the colours of the EPS diagrams*.
This results in bad fg/bg contrasts in those diagrams.
E.g.
an EPS diagram meant to be printed on white paper may
use dark-blue, dark-green and dark-red for drawing.
Such a diagram displays well and prints well on light
background.
However, they become unreadable when viewed using 'xdvi
-rv'
(for slide presentations). Preparing a separate EPS
diagram with
adjusted colours is tedious, and is indeed difficult
because
Ghostscript would change the bg/fg colours[*] when invoked
from xdvi.

Solution: better control of the colour handling of
Ghostscript:

-gsfg <colour> sets the foreground colour that
Ghostscript uses
-gsbg <colour> sets the background colour that
Ghostscript uses
-gsrv causes GS to reverse ALL colours

Then, we can display those diagrams nicely in reverse
video with:

xdvi -fg white -bg black -gsrv mydoc.dvi

A new hotkey "I" toggles the -gsrv feature on-the-fly.

Attached is a patch that has implemented these features.
The patch is against the CVS source checked out at
2004-05-24 13:38 (UTC).
It has been tested on a SuSE8.1 system, configured with

./configure --with-tetex
--with-default-texmf-path=/usr/share/texmf
--with-default-font-path=/var/cache/fonts//

Also tested with the "--disable-ps-gs" configure option.

Submitted by: Sau Dan LEE
<danlee@informatik.uni-freiburg.de

[*] Except for mono-colour EPS diagrams
using the default foreground colour (black) for drawing
and the default background colour (white) for erasing.
In this case, Ghostscript will substitute those colours
with the {fore,back}ground colours inherited from the
xdvi window.
Unfortunately, Ghostscript won't adjust any other colours.

Discussion

  • Nobody/Anonymous

    patch < pathfile

     
  • Stefan Ulrich

    Stefan Ulrich - 2004-05-24

    Logged In: YES
    user_id=177175

    Thanks very much for your report and the patches. However
    I'm still
    not sure I've understood the problem correctly.

    With the attached test file (test.tgz), an unpatched xdvi with:
    xdvi -fg yellow -bg black
    makes the foreground and the lines in the EPS file yellow,
    which is
    what I would expect. (On the other hand, with your patch,
    the lines in
    the EPS become black again - is that desired?)

    But the green color of the `test' text, the blue rectangle
    and the red oval are not affected by the -gs... options.

    Do you maybe have an example for an EPS file with multiple
    colors
    as described in your report, and where using the -gs... options
    does change the colors?

     
  • Stefan Ulrich

    Stefan Ulrich - 2004-05-24
     
  • Nobody/Anonymous

    Logged In: NO

    I'm Sau Dan LEE.

    Yes, your file does display the rectangle in blue and
    ellipse in red. The -fg/bg options changed the background
    of the figure to black and the rims of the shapes to yellow,
    but other colours remain.

    But that is not always desirable. Your figure uses the
    typical "programmer colours" (100% red, 100% green, blue,
    cyan, magenta, yellow), which are visually bad because of
    the poor contrast either against a light (e.g. white)
    background and a dark (e.g. blue) background. e.g. your
    text "test" is hard to read. That's why you don't notice
    the problem.

    A good colour scheme should make the things contrast well
    (readable even if converted to grayscale). I'm giving a
    patch file to your test.eps file to change the colours to
    darkblue, darkgreen and darkred. This make the figure look
    much better on white paper, because of the increased
    contrast with white. Try to convert both to grayscale and
    you'll see the difference! Now, the problem is: if I use
    -bg black, the darkgreen text becomes unreadable. Darkgreen
    text on a black background. That's terrible. The shapes
    are still visible, but that's just because the rims are
    drawn with yellow (due to -fg yellow). If the rims were
    gone , then they're hardly visible.

    Using my patch, you can add the "-gsrv" option to reverse
    the colours of the EPS diagram. Volia. The rectangle now
    shows up in light-yellow, which contrasts well with the
    background. The ellipse is in light-cyan, which is also
    eye-catching. The text is in light-magenta -- very readable
    now. Yes, the original colours are replaced with new ones.
    But that is what makes the text/background contrast high again.

    Here is a patch to recolourize your figure:

    --- test.eps.orig 2004-06-17 13:28:26.000000000 +0200
    +++ test.eps 2004-06-17 13:34:38.000000000 +0200
    @@ -14,15 +14,15 @@
    /col1 {0.000 0.000 1.000 srgb} bind def
    /col2 {0.000 1.000 0.000 srgb} bind def
    /col3 {0.000 1.000 1.000 srgb} bind def
    -/col4 {1.000 0.000 0.000 srgb} bind def
    +/col4 {0.600 0.000 0.000 srgb} bind def
    /col5 {1.000 0.000 1.000 srgb} bind def
    /col6 {1.000 1.000 0.000 srgb} bind def
    /col7 {1.000 1.000 1.000 srgb} bind def
    /col8 {0.000 0.000 0.560 srgb} bind def
    /col9 {0.000 0.000 0.690 srgb} bind def
    -/col10 {0.000 0.000 0.820 srgb} bind def
    +/col10 {0.000 0.000 0.520 srgb} bind def
    /col11 {0.530 0.810 1.000 srgb} bind def
    -/col12 {0.000 0.560 0.000 srgb} bind def
    +/col12 {0.000 0.350 0.000 srgb} bind def
    /col13 {0.000 0.690 0.000 srgb} bind def
    /col14 {0.000 0.820 0.000 srgb} bind def
    /col15 {0.000 0.560 0.560 srgb} bind def

     
  • Nobody/Anonymous

    Logged In: NO

    Here is Sau Dan LEE again.

    If you want good contrast PLUS yellow rims for the shapes, use:

    xdvi -fg yellow -bg black -gsbg yellow -gsfg black -gsrv

    (-gsrv has effect on -gsbg and -gsfg)

     
  • Nobody/Anonymous

    Logged In: NO

    Here is Sau Dan LEE again.

    If you want good contrast PLUS yellow rims for the shapes, use:

    xdvi -fg yellow -bg black -gsbg yellow -gsfg black -gsrv

    (-gsrv has effect on -gsbg and -gsfg)

     
  • Nobody/Anonymous

    Logged In: NO

    Here is Sau Dan LEE <danlee@informatik.uni-freiburg.de> again.

    If you want good contrast PLUS yellow rims for the shapes, use:

    xdvi -fg yellow -bg black -gsbg yellow -gsfg black -gsrv

    (-gsrv has effect on -gsbg and -gsfg)

     
  • Stefan Ulrich

    Stefan Ulrich - 2004-06-17

    Logged In: YES
    user_id=177175

    > Using my patch, you can add the "-gsrv" option to reverse
    > the colours of the EPS diagram. Volia. The rectangle now
    > shows up in light-yellow, which contrasts well with the
    > background. The ellipse is in light-cyan, which is also
    > eye-catching. The text is in light-magenta -- very readable
    > now. Yes, the original colours are replaced with new ones.
    > But that is what makes the text/background contrast high
    again.

    Thanks, I can see your point now. However there seems to be
    a problem
    with the implementation of the -gsbg flag; whith AFPL
    ghostscript 8.10
    (running at 24bpp), this leads to an unpleasant `flashing'
    effect:
    With the example file test.dvi, first a yellow background
    appears
    shortly at startup which is then overdrawn with black. You can
    exacerbate this effect by toggling ghostscript anti-aliasing
    via the
    `V' keystroke; the image will then have wrong colors altogether.
    I've attached a screenshot of the display (gsalpha.gif); can you
    reproduce this problem?

     
  • Stefan Ulrich

    Stefan Ulrich - 2004-06-17

    screenshot of artefact with -gsbg after toggling `V'

     

Log in to post a comment.