Re: Printing lines, shapes and pixmaps from a gnome canvas



Chema Celorio wrote:

I'd like to give my take on the idea of printing a Canvas.

[I'm not sure if Michael Meeks will remeber this, but the "Printing a
canvas idea" was the first conversation he and me had while in Paris
during Guadec 1 in the HelixCode Boart party.]

	A number of people have talked about this a number of times. I am
unsure if this will solve a real problem or not, but I have not yet
found a good scenario where this would be really the best solution. I'm
not saying there isn't such a scenario, I belive that there is a big
chance of me being wrong about this, just that I have not yet found it.

	Complex applications that want high quality printing are going to have
to tweak with great detail the print output. The rules for displaying
something on the screen where you have pixels and on printing where you
dealing with vectors is a different problem.

I am not sure it is so different in the case of the canvas. For example, when drawing lines, one can give the line width in units or in pixels. In the first case, the difference between displaying on the screen and printing is hidden in the appropriate canvas function. The canvas is essentially used for vectorial drawing.

	Gnumeric and Evolution fall on this category, I don't this apps
benefiting from a canvas that can print itself. The way you display an
email message on the screen is different from how you want it to look on
the print out, same for a calendar, the calendar printing in evolution
looks nothing like how it looks on the screen. Gnumeric will also not
benefit from this, Jody has tried sharing the code used for printing and
for displaying in the screen, and from what he has told me having two
separate code paths that are very similar and are kept in sync is the
best way to go.

	On top of how you want things to look, the screen has an infinite
display area, you can scroll over this area all you want, think about an
email, a spreadsheet or a calendar. On the screen you don't have to
think about spliting things up, and making pages out of it. You have
items that might have to print in two pages for example, all this logic
needs to be defined somewhere, a problem that is not solved by the code
that displays things on the screen. This does not hold true for apps
like sodipodi or abiword where there is a page concept.

	For apps that don't need high quality printing or WYSIWYG, you want to
make the print code as simple as possible. I'm thinking about things
like gedit or ghex. On gedit you have a text buffer, that you want to
print, which the GtkTextView item knows how to deal with, when you print
the text file the logic is different than the one the widgets uses,
because it is simpler to do that way, same holds true for that said, I'm
not trying to imply that I don't want 	Apps that don't require	

The pagination problem is probably the most important. The canvas cannot decide internally where a new page begin. So what I am writing will be mostly usefull for little applications which do not need more than one page. Nonetheless, it is possible to create a canvas, fill it with the items which are on the page and print it without displaying on the screen (I tried that and it works).

I am not trying to say that this is not something I would not be
willing to put in gnome-print or that it should not be written. It might
be the case that nobody is using something like this simply because it
doesn't exist. And if so many people have thought that it would be a
good idea (including myself) it must be for a reason.

It should not go in gnome-print but in libgnomecanvas (IMHO).

	The only thing that I'd like to see, is if this code was developed as
part of an application or developed somewhere where it is getting real
life usage before putting it in a library.

I developped this code for use in GChemPaint. If it is not included in an official library I'll include a special canvas version with just what I need in future versions. Current code is based on libgnomecanvas2.0.5 and is available at http;//jean.brefort.free.fr/info/libgnomeprintablecanvas.tar.bz2 (I already indicated that in preceding responses in this thread but these where never delivered; it seems I have a problem with the mail).

Best regards,
Jean Br�rt






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]