|
From: Ethan M. <merritt@u.washington.edu> - 2007-11-21 19:03:57
|
On Wednesday 21 November 2007 09:13, Allin Cottrell wrote: > I'll float this by the list first and submit a tracker item if > there's any support. > > I would find it very useful to get a readback from gnuplot on the > internal dimensions of a PNG file -- that is, the pixel bounds of > the data area and also the data minima and maxima. This is for > generating an interactive display (much like the mousable wxt > terminal display, but with additional features). I don't think I quite understand what you are aiming for. My first take was that you were suggesting that pngcairo is missing the "crop" option of the libgd-based png terminal. In general the gnuplot core routines will not know this information. Consider the case of "plot with labels", where the label is rendered (by cairo/pango in this case) as a scaled glyph. What pixels are touched in drawing that glyph? Gnuplot doesn't know. It would have to be provided by the support library. > The attached patch adds a boolean "boundsfile" option to pngcairo. ... > you get test.png as usual, but also a file named test.png.bounds > with content > > xleft=89 xright=620 ybot=37 ytop=460 > xmin=-10 xmax=10 ymin=-1 ymax=1 But then I backtracked and thought maybe you are asking for output of the [terminal coordinate] <--> [plot coordinate] mapping that is used by the mousing code. Is that the idea? See for example the term->text() driver entry point for x11.trm (X11_text). That is exactly what it does. I thought there was an ancient patchset that implemented this for the libgd-based terminals by placing the information in a comment record inside the image file proper. That might make more sense, and as with the current x11 driver it would become a normal part of the term->text() processing. No special command-line options needed. Unfortunately I can't seem to find that patchset on SourceForge any more. Also I don't know if cairo provides a mechanism to add arbitrary comment records to a PNG file. Finally, let me note that one of my biggest long term wish-list items is to have gnuplot emit similar information for use with SVG plots embedded in a web page. The idea is to implement full browser-side mousing/zooming capabilities for each embedded plot using jscript or the equivalent. See for example the pages at: http://sitn.ne.ch/ -- Ethan A Merritt |