| 1 |
/* Copyright (C) 2001-2007 Peter Selinger and nitoyon. |
|---|
| 2 |
Original code(Potrace v1.8) by Peter Selinger. |
|---|
| 3 |
Ported to ActionScript 3.0 by nitoyon. |
|---|
| 4 |
This file is part of PotrAs. It is free software and it is covered |
|---|
| 5 |
by the GNU General Public License. See the file COPYING for details. */ |
|---|
| 6 |
|
|---|
| 7 |
package com.nitoyon.potras |
|---|
| 8 |
{ |
|---|
| 9 |
import flash.geom.Point; |
|---|
| 10 |
|
|---|
| 11 |
public class Curve |
|---|
| 12 |
{ |
|---|
| 13 |
public var tag:int; /* tag[n]: POTRACE_CORNER or POTRACE_CURVETO */ |
|---|
| 14 |
public var c:Array = new Array(3); /* c[n][i]: control points. |
|---|
| 15 |
c[n][0] is unused for tag[n]=POTRACE_CORNER */ |
|---|
| 16 |
/* the remainder of this structure is special to privcurve, and is |
|---|
| 17 |
used in EPS debug output and special EPS "short coding". These |
|---|
| 18 |
fields are valid only if "alphacurve" is set. */ |
|---|
| 19 |
public var vertex:Point; /* for POTRACE_CORNER, this equals c[1] */ |
|---|
| 20 |
public var alpha:Number; /* only for POTRACE_CURVETO */ |
|---|
| 21 |
public var alpha0:Number; /* "uncropped" alpha parameter - for debug output only */ |
|---|
| 22 |
public var beta:Number; |
|---|
| 23 |
|
|---|
| 24 |
/** |
|---|
| 25 |
* Constructor. |
|---|
| 26 |
* |
|---|
| 27 |
* initialize the members of the given curve structure to size m. |
|---|
| 28 |
* Return 0 on success, 1 on error with errno set. |
|---|
| 29 |
*/ |
|---|
| 30 |
public function Curve():void |
|---|
| 31 |
{ |
|---|
| 32 |
c[0] = new Point(); |
|---|
| 33 |
c[1] = new Point(); |
|---|
| 34 |
c[2] = new Point(); |
|---|
| 35 |
vertex = new Point(); |
|---|
| 36 |
} |
|---|
| 37 |
|
|---|
| 38 |
public function toString():String |
|---|
| 39 |
{ |
|---|
| 40 |
return "alpha0: " + alpha0 + "\n" |
|---|
| 41 |
+ "alpha: " + alpha + "\n" |
|---|
| 42 |
+ "beta: " + beta + "\n" |
|---|
| 43 |
+ "corner: " + (tag == ProcessPath.POTRACE_CORNER) + "\n" |
|---|
| 44 |
+ "bezier: " + c[0] + "," + c[1] + "," + c[2]; |
|---|
| 45 |
} |
|---|
| 46 |
} |
|---|
| 47 |
} |
|---|