|
From: Allin C. <cot...@wf...> - 2007-11-21 21:08:21
|
On Wed, 21 Nov 2007, Ethan Merritt wrote: > 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. Sorry if I wasn't clear but no, that's not it. > 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? Yes. > 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. I wrote a patch to do that at one time and canvassed it on this list. > That might make more sense... In principle, yes. But neither libgd nor cairo (AFAIK) offers a means of doing this. My patch was an ugly hack in that it imported a modified chunk of the libgd code into gd.trm; that's the only way I could get a handle on the comment fields. I tried submitting a patch for libgd to add an API for writing to the comments fields in a PNG but that wasn't accepted. I don't know if one would have any better luck offering a patch for cairo. Hence my notion of falling back on an auxiliary file. Not all that pretty but it works (and obviously could be implemented for other terminals too). One nice thing about this approach is that the reader doesn't have to link to libpdf (or carry out fiddly do-it-yourself binary reading) to get the info; it's right there in plain text. > 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. Yes, that would be nice. Allin Cottrell |