[GRASS-dev] something squirrelly with the PNG/PPM driver

I’ve been beating my head over what I thought was a bug introduced into the rendering routines of wxgrass, only to just find out that it is something introduced into the PNG display driver very recently—maybe on last Thursday or Friday.

The easiest way to see what is happening is to display a legend or scale bar in the GUI. In both, white goes to black in the display. Both display fine in an xmon.

If the scalebar background is set to transparent, it displays OK. But white goes to black. The same is true for legends of cell maps. White turns to black. For FP maps, the whole thing turns black and won’t even render properly in wxPython (locks it up, maybe because it is generating a PNG for this instead of a PPM).

All is OK on my laptop, which I updated last Thursday or Wednesday, but the PNG/PPM display driver is broken on my office desktop, which I updated and recompiled last Friday afternoon.

Michael


Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

I¹ve been beating my head over what I thought was a bug introduced into the
rendering routines of wxgrass, only to just find out that it is something
introduced into the PNG display driver very recently‹maybe on last Thursday
or Friday.

The easiest way to see what is happening is to display a legend or scale bar
in the GUI. In both, white goes to black in the display. Both display fine
in an xmon.

If the scalebar background is set to transparent, it displays OK. But white
goes to black. The same is true for legends of cell maps. White turns to
black. For FP maps, the whole thing turns black and won¹t even render
properly in wxPython (locks it up, maybe because it is generating a PNG for
this instead of a PPM).

I can't reproduce this, probably because I don't entirely understand
what you're saying.

Please provide a specific sequence of commands, along with the values
of any GRASS_* environment variables.

--
Glynn Clements <glynn@gclements.plus.com>

Glynn,

Here are all the standard settings from the TclTk and wxPython GUI (from
TclTk syntax here)

    set env(GRASS_WIDTH) "$driver_w($mon)"
    set env(GRASS_HEIGHT) "$driver_h($mon)"
    set env(GRASS_PNGFILE) "$mapfile($mon)"
    set env(GRASS_BACKGROUNDCOLOR) "ffffff"
    set env(GRASS_TRANSPARENT) "TRUE"
    set env(GRASS_PNG_AUTO_WRITE) "TRUE"
    set env(GRASS_TRUECOLOR) "TRUE"

    set env(GRASS_RENDER_IMMEDIATE) "TRUE"

Add a barscale or legend (try a legend for elevation.10m from Spearfish) to
the GUI layer tree and render. Do you get correct colors?

I had updated, did a distclean, and compiled on Friday. Colors are not
rendering correctly, and I'm getting partial rendering in some cases. I can
look in the tmp directory where this stuff is getting rendered and check the
PPM (and PNG files in wxPython) and can see the colors problem in the
graphic file.

This is only happening when writing to the PNG (PPM) driver. Using the X
driver gives no problem. Oddly, maps seem OK, but scalebars and legends are
a problem. I suppose that the problem could be something that d.barscale and
d.legend are both using, but that maps are not.

It could be specific to my office workstation (Mac G5, OS X 4.9). If so,
I'll update and recompile. But I want to check to see if this is happening
to anyone else.

MIchael

On 5/8/07 3:12 AM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

I�ve been beating my head over what I thought was a bug introduced into the
rendering routines of wxgrass, only to just find out that it is something
introduced into the PNG display driver very recently�maybe on last Thursday
or Friday.

The easiest way to see what is happening is to display a legend or scale bar
in the GUI. In both, white goes to black in the display. Both display fine
in an xmon.

If the scalebar background is set to transparent, it displays OK. But white
goes to black. The same is true for legends of cell maps. White turns to
black. For FP maps, the whole thing turns black and won�t even render
properly in wxPython (locks it up, maybe because it is generating a PNG for
this instead of a PPM).

I can't reproduce this, probably because I don't entirely understand
what you're saying.

Please provide a specific sequence of commands, along with the values
of any GRASS_* environment variables.

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Michael Barton wrote:

Here are all the standard settings from the TclTk and wxPython GUI (from
TclTk syntax here)

    set env(GRASS_WIDTH) "$driver_w($mon)"
    set env(GRASS_HEIGHT) "$driver_h($mon)"
    set env(GRASS_PNGFILE) "$mapfile($mon)"
    set env(GRASS_BACKGROUNDCOLOR) "ffffff"
    set env(GRASS_TRANSPARENT) "TRUE"
    set env(GRASS_PNG_AUTO_WRITE) "TRUE"
    set env(GRASS_TRUECOLOR) "TRUE"

    set env(GRASS_RENDER_IMMEDIATE) "TRUE"

Add a barscale or legend (try a legend for elevation.10m from Spearfish) to
the GUI layer tree and render. Do you get correct colors?

The following produces the same colours as XDRIVER:

  GRASS_BACKGROUNDCOLOR=ffffff \
  GRASS_TRANSPARENT=TRUE \
  GRASS_PNG_AUTO_WRITE=TRUE \
  GRASS_TRUECOLOR=TRUE \
  GRASS_RENDER_IMMEDIATE=TRUE \
  GRASS_PNGFILE=map.ppm \
  d.legend elevation.10m

I had updated, did a distclean, and compiled on Friday. Colors are not
rendering correctly, and I'm getting partial rendering in some cases. I can
look in the tmp directory where this stuff is getting rendered and check the
PPM (and PNG files in wxPython) and can see the colors problem in the
graphic file.

This is only happening when writing to the PNG (PPM) driver. Using the X
driver gives no problem. Oddly, maps seem OK, but scalebars and legends are
a problem. I suppose that the problem could be something that d.barscale and
d.legend are both using, but that maps are not.

It could be specific to my office workstation (Mac G5, OS X 4.9). If so,
I'll update and recompile. But I want to check to see if this is happening
to anyone else.

Not to me.

So far as any futher tests are concerned, execute any commands
manually, in order to eliminate the GUI as a source of potential
problems.

--
Glynn Clements <glynn@gclements.plus.com>

I want to confirm that we have the same problem with another Mac G5 that we
just updated from the cvs this morning. Something is broken with either the
PNG drier or with how graphics in barscales and legends are rendered via the
PNG driver.

I'm not at my desktop at the moment and don't want to break my laptop's
GRASS version. So I'll try later to incrementally change some of these
environmental variables and let you know the result.

Michael

On 5/8/07 8:56 AM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Michael Barton wrote:

Here are all the standard settings from the TclTk and wxPython GUI (from
TclTk syntax here)

    set env(GRASS_WIDTH) "$driver_w($mon)"
    set env(GRASS_HEIGHT) "$driver_h($mon)"
    set env(GRASS_PNGFILE) "$mapfile($mon)"
    set env(GRASS_BACKGROUNDCOLOR) "ffffff"
    set env(GRASS_TRANSPARENT) "TRUE"
    set env(GRASS_PNG_AUTO_WRITE) "TRUE"
    set env(GRASS_TRUECOLOR) "TRUE"

    set env(GRASS_RENDER_IMMEDIATE) "TRUE"

Add a barscale or legend (try a legend for elevation.10m from Spearfish) to
the GUI layer tree and render. Do you get correct colors?

The following produces the same colours as XDRIVER:

GRASS_BACKGROUNDCOLOR=ffffff \
GRASS_TRANSPARENT=TRUE \
GRASS_PNG_AUTO_WRITE=TRUE \
GRASS_TRUECOLOR=TRUE \
GRASS_RENDER_IMMEDIATE=TRUE \
GRASS_PNGFILE=map.ppm \
d.legend elevation.10m

I had updated, did a distclean, and compiled on Friday. Colors are not
rendering correctly, and I'm getting partial rendering in some cases. I can
look in the tmp directory where this stuff is getting rendered and check the
PPM (and PNG files in wxPython) and can see the colors problem in the
graphic file.

This is only happening when writing to the PNG (PPM) driver. Using the X
driver gives no problem. Oddly, maps seem OK, but scalebars and legends are
a problem. I suppose that the problem could be something that d.barscale and
d.legend are both using, but that maps are not.

It could be specific to my office workstation (Mac G5, OS X 4.9). If so,
I'll update and recompile. But I want to check to see if this is happening
to anyone else.

Not to me.

So far as any futher tests are concerned, execute any commands
manually, in order to eliminate the GUI as a source of potential
problems.

__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton