Opened 10 years ago

Closed 10 years ago

#465 closed enhancement (fixed)

Improve printing of canvas elements

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: minor Milestone: Reggie v2.11.1
Component: net.sf.basedb.reggie Keywords:


Although the printing feature introduced in #462 works well, there is a small issue with resolution of <canvas> elements from the sample processing statistics (#461). Under the hood the canvas are pixel-based images, which means that printing causes upscaling and can't take advantage of the higher resolution on printers.

There exists a relatively simple solution based on retina-display support. By specifying a larger width and height (eg. a factor of 2) of the canvas element and then using css to scale down the image on the screen, the higher resolution is kept when printing (and on retina displays).

Special care is need for textual parts on the plots which require a larger font size to be the same size after the down-scaling. The same is also needed for some offsets for margins, titles, etc. that depends on the font-size.

Change History (2)

comment:1 Changed 10 years ago by Nicklas Nordborg

Milestone: Reggie v2.xReggie v2.11.1

comment:2 Changed 10 years ago by Nicklas Nordborg

Resolution: fixed
Status: newclosed

(In [1875]) Fixes #465: Improve printing of canvas elements

Implemented by creating the actual canvas at twice the size that is needed for screen display. The canvas is scaled down on screen by css, but can be sent at full resolution to the printer.

To improve issues with anti-aliasing when down-scaling the screen version all line coordinates are carefully aligned to half-numbers (eg. 10.5, 95.5).

While the actual box drawings worked almost right out of the box at a different scale factor, several changes was required to also scale up text font sizes, various offsets, scale marker sizes, etc.

Note: See TracTickets for help on using tickets.