Home > Flex, Portfolio > Dotted Line Decorator in Freehand Drawing Library

Dotted Line Decorator in Freehand Drawing Library

January 6, 2012

The line decorator architecture in the Freehand Drawing Library is complete, fully documented, and pretty thoroughly tested.  Here is a screenshot from the demo that shows the new dotted line decorator.  The stroke engine is the same for all strokes.

Switching from solid to dashed to dotted lines is simple and the stroke engine is agnostic to how the strokes are drawn.  The code for the radio button handler is provided below (comments and UI-related code are removed)

switch( event.target.id )
{
  case "solid":
    __data.lineDecorator = "net.algorithmist.freehand.decorators.SolidLine";
  break;
  case "dashed":
    __data.lineDecorator = "net.algorithmist.freehand.decorators.DashedLine";
  break;
  case "dotted":
    __data.lineDecorator = "net.algorithmist.freehand.decorators.DottedLine";
  break;
}
__stroke.data = __data;

The decorator classes are either pre-compiled into the app or loaded from a SWF in advance of assigning a decorator. The default solid-line decorator is always available.

The final demo (should be ready this weekend or early next week) will demonstrate a single line decorator with multiple stoke engines.  I’ll release another beta (in advance of the first release candidate) at that time.

Advertisements
Categories: Flex, Portfolio Tags: , , , ,
%d bloggers like this: