PuffinPlot issue tracker

Bug: a88/bcac

ID : bcac831f-6c0c-4226-b0cb-10a0d97a85f8
Short name : a88/bcac
Status : fixed
Severity : minor
Assigned :
Reporter : Pontus Lurcock <pont@talvi.net>
Creator : Pontus Lurcock <pont@talvi.net>
Created : Tue, 01 Oct 2013 08:06:00 +0000
Target : 1.03
Summary : Exporting FreeHEP SVG graphics disables anti-aliasing [278]

Comment: --------- Comment ---------
ID: 6c29293e-f0f4-47a2-840d-c4c99de8f2d3
Short name: a88/bcac/6c2
From: Pontus Lurcock <pont@talvi.net>
Date: Tue, 01 Oct 2013 08:06:00 +0000

If the display is exported as SVG via the FreeHEP library, anti-aliasing
is subsequently disabled (for both text and lines) in the main graph
display.

Comment: --------- Comment ---------
ID: e11dedb8-db91-414f-bfb4-93e279aee54a
Short name: a88/bcac/e11
From: Pontus Lurcock <pont@talvi.net>
Date: Tue, 01 Oct 2013 08:13:30 +0000

A very strange bug -- haven't figured out the cause yet. FreeHEP gets
its own Graphics2D object and I can't see how it could mess with the
rendering hints for the on-screen one. In any case, the rendering hints
by the paint() method on every redraw. Adding a
‘if (g instanceof SVGGraphics2D) return;’ to the start of paint()
squashes the bug (but of course results in a blank SVG); this implies
that it's the actual process of drawing to the FreeHEP graphics object
which disables anti-aliasing, rather than anything peripheral in the
saveToSvgFreehep method.

Comment: --------- Comment ---------
ID: f50ef750-980e-463b-b8db-78f2bd18003a
Short name: a88/bcac/f50
From: Pontus Lurcock <pont@talvi.net>
Date: Thu, 09 Oct 2014 13:24:56 +0000

Maybe obvious in retrospect, but RenderingHints objects are not
immutable, and FreeHEP has a bug which wipes the entire RenderingHints
object passed to it. Since GraphDisplay caches a single instance
of PuffinRenderingHints (on the reasonable assumption that nobody is
going to change it), this same empty RenderingHints object is retained
and passed to the usual draw-to-screen Graphics2D once the SVG export
is complete.

Fixed by adding a dirty bit to PuffinRenderingHints so getInstance()
can instantiate a new, pristine object when necessary, and by 
getting rid of the RenderingHints cache in GraphDisplay.