On Wed, 31 May 2000, Hans Breuer wrote:

> There are three more exports filters for Dia available.
> Two of them may be of interest for the whole Dia
> community. In detail:

I will check these in shortly.

> 
> plug-ins/hpgl/hpgl.c - Hewlett Packard Graphics Language
>   Exports at least simple geometric commands to the
>   common plotter language.
> 
> plug-ins/wpg/wpg_defs.h - WPG Definitions
> plug-ins/wpg/wpg.c - WordPerfect Graphics Metafile Export.
>   This export filter generates WPG 1.0 (as used since
>   WordPerfect 5.1). It is tested with WinWord 97 and
>   Designer 4.1; but I'm expecting it to work with
>   WordPerfect for Linux as well.
>   Every renderer function is implemented, only the bezier
>   functions produce some strange graphical effects, because 
>   WPG's Poly Curve appears not to be compatible with Dia's
>   Bezier - or I haven't understood it yet.

It may be that the curved polyline just fits a spline to a number of
points, rather than being a bezier curve.  You could probably get passable
results by sampling points along the bezier curve and using them.  The
formula for working out the sample points for a bezier curve between
(x0,y0) and (x3,y3) with control points (x1,y1) and (x2,y2) is:
  x = (1-t)^3 * x0 + 3*t*(1-t)^2 * x1 + 3*t^2 * (1-t) * x2 + t^3 * x3
  y = (1-t)^3 * y0 + 3*t*(1-t)^2 * y1 + 3*t^2 * (1-t) * y2 + t^3 * y3

You may be able to get decent results with four or eight sample
points.  The alternative is to just use the normal polyline and use the
code in the gdk renderer for breaking down the curve into line segments.

> 
> plug-ins/wmf/wmf.cpp - Win32 only Windows Metafile Export
>   Everything except Bitmaps seems to work. Due to namespace
>   conflicts between Dia and <windows.h> (Rectangle) I've
>   choosen to implement it in c++ (Win32 in namespace W32).

Ideally we would want to have something that isn't win32 specific, but if
there is a quick way of getting a filter for win32, then you may as well
use it.  There is documentation of the WMF format in volume 4, chapter 3
of the windows 3.1 SDK docs if anyone is interested.  You may be able to
find that info on the ms website as well.  I had a bit of a look at doing
this a while back, but didn't get round to coding anything.

> 
> plug-ins/renderer.inc - Dia's renderer interface used by all
>   the above export filters. 
>   Started implementation of renderer helper functions to produce 
>   complex (=unsupported) geometrics (like ellipse) by simple (=supported)
>   drawing functions (like arc).

well, the draw_arc primitive should be able to draw full ellipses by
setting the angles to 0 and 360 degrees.  If drawing an ellipse requires
three separate draw_arc calls, then the draw_arc call is probably not
correct.

> 
> It would be nice if someone could compile and test the first two
> filters on Linux.
> 
> Due to it's size (20K) the archive is not attached, but available at:
> 
> http://hans.breuer.org/dia/plug-ins-2000-05-31.zip
> 
> 
> Have Fun,
>       Hans

James.

-- 
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


Reply via email to