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

Binary incompatibility: RenderOps structure



As can be seen from the ChangeLog, a binary incompatibility has been
introduced in the RenderOps structure.  While the new operations are not in
use yet, they will be.  I have changed all the renderers in the Dia
distribution to work with the new system.  If anybody has made another
renderer, they should change it to the new system.  We will soon begin to
expand the renderops with higher-level functions.

In the new system, the RenderOps structure is allocated with a call to
create_renderops_table().  Any functions that the renderer defines itself
should then be copied on top.  It is preferable to only do this once, the
first time the renderer is used.  Here is an example:

static RenderOps *GdkRenderOps;

static void
init_gdk_renderops() {
  GdkRenderOps = create_renderops_table();

  GdkRenderOps->begin_render = (BeginRenderFunc) begin_render;
  GdkRenderOps->end_render = (EndRenderFunc) end_render;

  GdkRenderOps->set_linewidth = (SetLineWidthFunc) set_linewidth;
[...]
}

RendererGdk *
new_gdk_renderer(DDisplay *ddisp)
{
  RendererGdk *renderer;

  if (GdkRenderOps == NULL)
    init_gdk_renderops();

  renderer = g_new(RendererGdk, 1);
  renderer->renderer.ops = GdkRenderOps;
  renderer->renderer.is_interactive = 1;
  renderer->renderer.interactive_ops = &GdkInteractiveRenderOps;
[...]
}

The same will probably be done with InteractiveRenderOps and ObjectOps.

This will allow us to expand the RenderOps table and fill the new functions
with a default implementation based on more primitive functions.  For
instance, rendering a box with rounded corners may be done by calling the
new draw_rounded_rect function, which by default calls the line and arc
functions.  A renderer that renders to a more advanced system (e.g. xfig)
can then override draw_rounded_box to directly output a rounded box.

This does not include the arrowhead change yet.  That has turned out to be
somewhat more involved to get right.

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| Hårdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK