Re: GTK+ 2.0 widget for dia



Le mer, jun 27, 2001, à 08:44:36 +0200, Xavier Ordoquy a écrit:

I just looked a bit in diagramdata.c and dia-newcanvas looks pretty
similar. I think Jamesh would explain better than I can do how this
fits, but looks like it's fine.
dia canvas has items (line, rectangle, ...) with some properties
and member functions. Amoung them, you can find 

void (*render)        (DiaCanvasItem *canvas_item, DiaRenderer *renderer,
                       DiaRectangle *rect);

which looks pretty the same as:

(*obj_renderer)(obj, renderer, active_layer, data);

The (dia canvas) render is an interface that enables to set width,
color, .. and draw points, lines, ....
Again this is pretty similar to the dia render.

[snip]

Hope this will answer your question.

It doesn't completely. One uses of renderers in dia is not only to talk gtk,
but also talk EPS, PS, PNG, XFIG, LaTeX, and I forget some (like DPS which
has always been experimental).

Some targets need a pre-rendering of strings (to compute a custom encoding).
This requires a predraw_string member function (or operation), next to
draw_string (which, IIRC, dia-newcanvas does have). Actually, predraw_string
is used about once, in the function of lib/diagramdata.c which checks all
objects and tells them to draw themselves: it first iterates through all
objects, gives them a dummy renderer (which uses predraw_string instead of
draw_string) and ask them to draw themselves into that dummy renderer (this
isn't really done if the real renderer doesn't need string predrawing). Once
this is done, the normal processing (ask all objects to render themselves)
is done. 

What I was asking for is to have similar capabilities (perhaps in a saner
way) included in dia-newcanvas.

        -- Cyrille


-- 
Grumpf.





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