Personal tools

Diagrams/Dev/Migrate1.2

From HaskellWiki

< Diagrams | Dev(Difference between revisions)
Jump to: navigation, search
(write about removal of freeze)
m
Line 5: Line 5:
 
<code>LineWidth</code> is now specified using <code>Measure</code>. This replaces former uses of <code>freeze</code>. See [http://projects.haskell.org/diagrams/doc/manual.html the manual] for full details. The old behavior of <code>lw</code> (in diagrams not using <code>freeze</code>) can be had by using <code>lwL</code>.
 
<code>LineWidth</code> is now specified using <code>Measure</code>. This replaces former uses of <code>freeze</code>. See [http://projects.haskell.org/diagrams/doc/manual.html the manual] for full details. The old behavior of <code>lw</code> (in diagrams not using <code>freeze</code>) can be had by using <code>lwL</code>.
   
However, in many simple cases, we recommend instead using named line weights provided in <code>Diagrams.TwoD.Attributes</code>. These include <code>thin</code>, <code>thick</code, and <code>none</code>.
+
However, in many simple cases, we recommend instead using named line weights provided in <code>Diagrams.TwoD.Attributes</code>. These include <code>thin</code>, <code>thick</code>, and <code>none</code>.
   
 
== Removal of <code>freeze</code> ==
 
== Removal of <code>freeze</code> ==

Revision as of 08:08, 2 June 2014

This page describes breaking API changes between diagrams 1.1 and 1.2, along with explanations of how to migrate to the new 1.2 API.

Contents

1 Attributes using Measure

LineWidth is now specified using Measure. This replaces former uses of freeze. See the manual for full details. The old behavior of lw (in diagrams not using freeze) can be had by using lwL.

However, in many simple cases, we recommend instead using named line weights provided in Diagrams.TwoD.Attributes. These include thin, thick, and none.

2 Removal of freeze

The freeze function has been removed. Most users probably were not using it; if you were, you have several options for replacing it, depending on how you were using it:

  • If you were just using it to get some lines to scale along with a diagram, use a Local line width (e.g. ... # lw (Local 2) or ... # lwL 2).
  • The above will not work if you were doing non-uniform scaling and really care that the lines should come out looking squished and stretched. In that case, use functions in Diagrams.TwoD.Offset to create a path corresponding to the stroked line, and then fill and transform it normally.

3 Arrows

The size of arrow heads and tails is now specified in terms of length instead of the radius of their circumcircle.

Gaps at the ends of arrows are now specified using Measure R2.

The gap traversal has been replaced by `gaps` for consistency in naming, though gap is still provided for backwards compatibility.

4 Reorganization

The avgScale function has been moved from Diagrams.TwoD.Transform to Diagrams.Core.Transform.

Most (all?) 2D attributes have been moved from Diagrams.Attributes to Diagrams.TwoD.Attributes.

The Angle definition and related functions have moved to a separate module, Diagrams.Angle.