bugGNU Octave - Bugs: bug #52975, gl2ps: print to svg contains two...

 
 

bug #52975: gl2ps: print to svg contains two backplanes

Submitter:  Rik <rik5>
Submitted:  Thu 25 Jan 2018 07:18:27 PM UTC
   
 
Category:  Plotting with OpenGL Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Postponed Assigned to:  None
Originator Name:  Open/Closed:  * Open
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 05 Feb 2018 08:03:06 PM UTC, comment #7: 

"gl2psTest" in gl2ps sources, which also uses multiple viewports, is an example where it is justified to be able to draw a back plane for the figure (drawn after gl2psBeginPage) first and then a back plane for each viewport (drawn after gl2psBeginViewport). I attached the resulting pdf output. Anyway, it should be possible to disable drawing the main backplane or the second, without disabling both so I'll file a feature resuest to gl2ps.

(file #43181)

Pantxo Diribarne <pantxo>
Group Member
Mon 05 Feb 2018 07:44:08 PM UTC, comment #6: 

I checked in the workaround here http://hg.savannah.gnu.org/hgweb/octave/rev/21e97b50989d.

This is now an upstream bug with gl2ps.  I've marked this bug as "Won't Fix" for Octave, but will wait to close bug until a new fixed version of gl2ps is available.

I've modified the summary since the two backplanes are no longer black and white, there are just two of them.

Rik <rik5>
Group administrator
Sun 04 Feb 2018 11:06:45 PM UTC, comment #5: 

I can confirm your observations, I also played with disabling enabling GL2PS_BACKGROUND and either two backplanes or none. It seams to be a bug in gl2ps that I'll try to identify and report.

Since I have now switche to a new system (debian stretch) with Qt-5.7.1, I now can reproduce the black first background.
I attached a workaround to make sure the glClearColor is defined (and identical to the figure background) before gl2psBeginPage is called.

(file #43172)

Pantxo Diribarne <pantxo>
Group Member
Wed 31 Jan 2018 08:05:22 PM UTC, comment #4: 

I did some experimentation.  If I remove the GL2PS_DRAW_BACKGROUND from gl2psBeginPage then I don't get two backplanes.  However, I also don't get a colored background if I have chosen one.

I modified draw_axes to always disable GL2PS_DRAW_BACKGROUND with


      // Don't remove hidden primitives when some of them are transparent
      GLint opts;
      gl2psGetOptions (&opts);
      opts &= ~GL2PS_DRAW_BACKGROUND;  // added line


right near the top of the function.  This doesn't seem to have any effect.  It sort of makes you wonder why we need it.

But, anyways, this seems to point to the sequence


gl2psBeginPage
opengl_renderer::draw (go);
gl2psEndPage ();



Rik <rik5>
Group administrator
Wed 31 Jan 2018 07:17:18 PM UTC, comment #3: 

This might be caused by the way we handle GL2PS_DRAW_BACKGROUND.  We specifically enable this option for the first viewport, and then disable it for other axes objects like legends.  This is in gl2ps-print.cc:draw_axes.


      // Don't draw background for subsequent viewports (legends, subplots,
      // etc.)
      gl2psGetOptions (&opts);
      opts &= ~GL2PS_DRAW_BACKGROUND;
      gl2psSetOptions (opts);



Rik <rik5>
Group administrator
Mon 29 Jan 2018 11:08:07 PM UTC, comment #2: 

If you confirm that it is an upstream bug, is there a way that we could at least guarantee that Octave produces two white backplanes so that the anti-aliasing issue does not occur?

Rik <rik5>
Group administrator
Sun 28 Jan 2018 10:40:41 PM UTC, comment #1: 

I can confirm that 2 rectangular back planes are present in the svg output but both are white for me, wether I use gl2ps 1.3.8 or the most recent dev version.

The bug is already present in Octave 4.2 and I attached the svg figure I obtain (with gl2ps 1.3.8 but it does not matter).
I'll look into this, but at first glance I'd say this is probably a bug in gl2ps that is visible only when using gl2psBegin(End)Viewport (what we have been doing since Octave 4.2).

Pantxo Diribarne <pantxo>
Group Member
Thu 25 Jan 2018 07:18:27 PM UTC, original submission:  

Here is a simple script that illustrates the problem.


close all
graphics_toolkit qt
plot (1:10, 'o-')
print hardcopy_on.svg
set (gcf, "inverthardcopy", "off")
print hardcopy_off.svg


I thought the figure property "inverthardcopy" might have something to do with it, but it doesn't.

If you open the resulting svg file in a viewer such as Inkscape you will find that there are two planes which cover the entire area of the figure.  One of these is white and one of these is black.

Besides the unnecessary duplication, the issue is that exporting to rasterized anti-aliased formats can result in a small grey line around the border of the figure as the anti-alias mechanism combines the two planes.

This is a regression from 4.0.3 when there was only one plane.  I haven't tested with 4.2.1 yet.

Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #43181:  outSimple.pdf added by pantxo (59KiB - application/pdf)
file #43172:  background.patch added by pantxo (1KiB - text/x-patch)
file #43078:  tst_backplane.m added by rik5 (128B - text/x-matlab)
file #43079:  hardcopy_on.svg added by rik5 (10KiB - image/svg+xml)
file #43080:  hardcopy_off.svg added by rik5 (10KiB - image/svg+xml)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by siko1056 (Updated the item)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-26 siko1056 StatusWont Fix Postponed
    2018-02-05 pantxo Attached File- Added outSimple.pdf, #43181
    2018-02-05 rik5 Item GroupRegression Incorrect Result
        StatusConfirmed Wont Fix
        Summaryregression: print to svg contains two backplanes, one black and one white gl2ps: print to svg contains two backplanes
    2018-02-04 pantxo Attached File- Added background.patch, #43172
    2018-01-25 rik5 Attached File- Added tst_backplane.m, #43078
        Attached File- Added hardcopy_on.svg, #43079
        Attached File- Added hardcopy_off.svg, #43080

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code