[plt-scheme] 299.26

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jan 4 13:20:41 EST 2005

The exp-tagged code in CVS for MzScheme and MrEd is now version 299.26.

This version of MrEd includes support for smooth (i.e., anti-aliased)
drawing of lines and curves, plus drawing and filling of paths.

For example, the program (which is in the new docs)


produces the output shown in the screen dump


(The screen dump is from X, but it looks the same under Mac OS X and

To get smoothing under X, you must install Cairo before configuring and
compiling MrEd. To get smoothing under Windows, you need Windows XP or
Microsoft's gdiplus.dll (someplace that MrEd can find it). Smoothing is
always available under Mac OS X.

Path-based drawing works with or without smoothing. Here's a screen
dump for "plt-logo.ss" without smoothing:


MrEd supports two smoothing modes. With the 'smoothed mode, drawing
works as in PostScript (i.e., the pen is centered over a path), and
integer coordinates fall between pixels. As a result, drawing a
horizontal line from (0,10) to (10, 10) with a pen width 1 actually
paints two rows of pixels, each at 50%. The 'aligned mode is like
'smoothed, but most drawing is shifted by half a pixel in each
dimension (but only when the context is unscaled and when the pen width
is no larger than 1). See the docs for details.

For region% objects, operations like `subtract' are not reliable in
smoothed mode. Instead of using these operations to define a region,
construct a suitable path and then either fill the path or use the new
`set-path' method of region%. Filling the path is preferable, in part
because the Windows implementation of smoothing does not smooth the
boundary of a clipping region.


 * Added `set-smoothing' and `get-smoothing' to dc<%>.

   If smoothing is not available, then calling `set-smoothing' has no
   effect, and `get-smoothing' always returns 'unsmoothed.

   For a post-script-dc%, `get-smoothing' always returns 'smoothed.

 * Added dc-path% class, added `draw-path' to dc<%>, and added
   `set-path' to region%.

   A dc-path% object encapsulates a PostScript-style path, and it
   supports `translate', `scale', and `rotate' methods. Internally, a
   path is a sequence of lines and Bezier curves, but the dc-path%
   class includes convenience methods like `rectangle', `ellipse', and
   `arc'. Drawing an `ellipse' path is not the same as using
   `draw-ellipse'; the `draw-ellipse' method uses the ellipse-drawing
   API of the platform's graphics toolbox, whereas MrEd always converts
   a path to Bezier curves --- and in unsmoothed mode, converts the
   curves to lines to use with the platform's support for polygon. In
   practice, `ellipse' and `draw-ellipse' turn out to be the same in
   smoothed mode, but `ellipse' is different and more consistent across
   platforms in unsmoothed mode.

 * Added `in-region?' and `xor' methods to region%.

 * Added variants of dc<%>'s `set-{pen,brush}' that accept arguments
  like `find-or-create-{pen,brush}' in `the-{pen,brush}-list'.

 * Changed default of radius argument of `set-rounded-rectangle ' in
   region% to -0.25 (to make it consistent with the dc<%> method).

 * Cleaned up the interaction between regions and dc% scaling.


Posted on the users mailing list.