[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Various questions about plotutils..
From: |
Theodore Papadopoulo |
Subject: |
Various questions about plotutils.. |
Date: |
Fri, 26 Jul 2002 19:17:38 +0200 |
Hi,
I wanted to use libplotter to display an image. While I know that it
is not made for this purpose, my final goal is to plot some text and
symbols over the image, for which libplotter is an option. Having the
portability of plotutils against various device decided me that it
should be nice to use the plotutils to do all the job. Unfortunately,
I ran into several problems:
First, given the following code:
#include <iostream>
#include <plotter.h>
using namespace std;
int
main(int argc,char *argv[])
{
// Initialize the plotter.
PlotterParams params;
params.setplparam("PAGESIZE",const_cast<void*>(static_cast<const
void*>("A4")));
params.setplparam("X_AUTO_FLUSH",const_cast<void*>(static_cast<const
void*>("no")));
params.setplparam("USE_DOUBLE_BUFFERING",const_cast<void*>(static_cast<const
void*>("yes")));
XPlotter plotter(cin,cout,cerr,params);
if (plotter.openpl()<0) {
cerr << "Couldn't open Plotter\n";
return 1;
}
plotter.fspace(0.0,0.0,538,634);
plotter.flinewidth(0.0);
plotter.pencolorname("black");
plotter.erase();
for (unsigned i=0;i<539;++i)
for (unsigned j=0;j<634;++j)
plotter.point(i,j);
// Close the plotter.
if (plotter.closepl()<0) {
cerr << "Couldn't close Plotter\n";
return 1;
}
return 0;
}
First, it is quite slow and worse I get white lines in the images due to
some rounding effects with the coordinates after transform. This bug
disappears if I'm using boxes instead of points, but then it is even
slower...
While the bug can be corrected, I do not think that the speed can be
improved significantly using the primitives available. Then,
realizing that most vector page descriptions (at least postscipt and
SVG) provide a way to embed images into the description I wonder
whether such an extension would be considered. Basically, I believe
that something like:
image(data,sizex,sizey,urx,ury,ulx,uly)
where data is an array of (sizex x sizey) pixels, (urx,ury) and
(ulx,uly) are the respective coordinates of the box in the viewport
in which the image should be mapped would be nice to have...
If this is acceptable, I can certainly work out something generic
(along the lines of the above code) + versions for X windows and
Postscript. I know too little of the other formats to be sure what I
can do/what can be done.
To summarize, I guess this mail ask for answers to the following
questions:
- Can be white line bug be corrected (I suspect that it is difficult
as it seems to be some rounding problem, thus leading to the idea
that the image mapping should be done in the device coordinate space).
- Is the proposal for an image primitive acceptable (modifications to
what I proposed are of course possible).
- If yes, is it possible to get some help to really implement it for
all the supported devices.
Thank's a lot,
Theo.
--------------------------------------------------------------------
Theodore Papadopoulo
Email: address@hidden Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Various questions about plotutils..,
Theodore Papadopoulo <=