|
From: sfeam <sf...@us...> - 2014-09-21 17:40:10
|
On Sunday, 21 September 2014 09:31:52 AM Philipp K. Janert wrote:
>
> [snip]
>
> >
> > > When using the "classic" method (set t ..., set o,
> > > replot, etc), it's very specific regarding the size
> > > and resolution of the bitmap or vector image that
> > > is being saved. Is there any control over these
> > > qualities when copying to clipboard?
> >
> > In theory , set term wxt size 800,300 determines the terminal window
> > size, hence what is copied, by any technique, from the screen output.
> > Also FVWM can display the window size during drag to get an exact
> > desired window size.
> >
>
> Since this whole functionality is new to me, I am trying
> to make sure I am really getting it. I it possible to
> generate genuine vector graphics this way (that is, going
> through the clipboard)?
It is technically possible. For instance on Windows the clipboard
holds blocks of WMF or EMF (or at least it used to, I have not used
Windows for many years). In principle an application can stuff
arbitrary data into a clipboard, but in practice it's usually
either pure text or a bitmap image. Current the wxt terminal
stuffs a bitmap image to the clipboard. Here is the code:
wxTheClipboard->UsePrimarySelection(false);
/* SetData clears the clipboard */
if ( wxTheClipboard->Open() ) {
wxTheClipboard->SetData(new wxBitmapDataObject(cp_bitmap));
wxTheClipboard->Close();
}
wxTheClipboard->Flush();
I think it would be straightforward to have the wxt terminal offer
the same output widget options as the qt terminal: png/pdf/svg output
of the current plot contents triggered from the GUI. There is a nice
comparison of how to generate the various output modes here:
http://zetcode.com/gfx/cairo/cairobackends/
In this case you probably would want to export to a file rather than
to the clipboard, just because most applications on the receiving end
probably won't know what to do with a block of svg (for instance)
pulled from the clipboard. But Inkscape might.
> I just tried to export a graph to PDF, by copying to
> clipboard and then pasting into inkscape - when blown
> up, the results are definitely pixelated (which they
> would not be with "genuine" PDF).
Inkscape is an SVG tool. It can import bitmap images,
but I don't think it knows how to convert PDF to SVG.
In fact I don't know of any tool that does this.
> So, is it fair to say that the copy-to-clipboard tactic
> gets me exactly the graph I see - as a pixmap -, but that
> if I want vector graphics, the classic set t pdfcairo, etc
> strategy is the way to go?
That's what I do in practice. I find that the pdfcairo output
is nearly identical to the wxt screen display content if you
specify an appropriate size for the pdf canvas. But as noted
above this could probably be automated via a GUI widget.
Patches welcome.
Ethan
|