Re: Gdk postscript support



On Mon, Nov 30, 1998 at 06:20:44PM -0500, Owen Taylor wrote:
> Could you make a "readme" for the patch, explaining what is being
> changed here and what the patch is meant to do? I really don't like
> duplicating all the region stuff from X in GDK, especially as it looks
> like a fairly big performance hit for X... Doesn't Postscript already
> it's own code for clipping to arbitrary regions? One certainly doesn't
> want regions scan converted at screen resolution when one could avoid
> it.

Ok, I'll write a README for the changes.

README.

There are two parts of the patch: the postcript backend and the bits
that allow custom drawables.

The latter changes involve:
1) GdkDrawableClass: a virtual class for custom drawables: it has
function pointers for the gdk_draw_* functions and a few others.
GdkWindowPrivate has a pointer to a GdkDrawableClass struct (engine)
that is used mainly in the gdk_draw_functions.
gdkwindow.c has very little changes to properly destroy a
GDK_WINDOW_DRAWABLE window.
The programmer can register a GdkDrawableClass at any time with
gdk_drawable_register().
2) GdkFont: added the name field with the name of the requested font.
3) GdkGC: it's not possible to retrieve the clip mask/rectangles from
a X GC, nor it's possible to retreive the dash pattern. 
Also gdk_gc_get_values returns incorrect values for the foreground
and background colors (only color->pixel is set, in fact).
With my changes this information is stored in GdkGCPrivate and can be
retreived from a drawable backend.
The problem here is that one can set a region as a clip mask, but
Region from xlib is an opaque type: it doesn't allow to retreive the
list of rectangles, so we must have our own version (this can be useful
for the windows port too, maybe).
The duplication amounts to less than 10 kb according to size(1).
The duplication is not in the logic of clipping and such: that is
the work of the X server or of the postscript interpreter: it only
allows a programmer to query a GC about anything that can be set in it.
I can add a flag to GdkGCPrivate (off by default) that controls
the behavior of GdkGC so it doesn't store the list of rectangles
of the mask if the programmer doesn't need it.
The info stored in a GC is important to a GdkDrawableClass to
draw correctly: this allows us to draw to a postscript file/pipe
or to a metafile with *very* little effort: this previously
required a whole X Server and large changes to programs and gdk
itself and now requires only 12 KB of code :-).

> Also, I don't think the postscript specific stuff belongs in GDK at
> all right now.

This is a different issue: if you think that 2000 lines of code to
allow printing from all gtk+ apps is too much, I can easily put that
in a separate library along with the metafile stuff, but it would be
better if it could go in gtk+, IMHO.
Note that the changes to gdkgc.c, gdkregion.c and gdkdraw.c are essential 
for this to work.

> There a also few coding style problems with your patch.
> (it needs to be:
> 
>  if (foo)
>   {
>     bar();
>   }

Yes. Has anyone the correct options to give to indent?
While I can read code written that way I can't use it while
programming myself:-)

> You've introduced trailing commas into some enumerations, and some

That was a mismatch when I did the patch: I've corrected it.

> other things). 
> 
> So could you hold off on committing it for a little bit?

I'm doing an updated version right now.

Thanks for your comments.

lupus

-- 
"The number of UNIX installations has grown to 10, with more expected."
    - _The UNIX Programmer's Manual_, Second Edition, June, 1972.



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