Revision: 1043
Author: heuermh
Date: Thu Aug 12 14:38:39 2010
Log: adding stroke ctrs
http://code.google.com/p/piccolo2d/source/detail?r=1043
Modified:
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java
=======================================
---
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java
Thu Aug 5 15:07:40 2010
+++
/piccolo2d.java/branches/ppath-refactoring/core/src/main/java/org/piccolo2d/nodes/PArea.java
Thu Aug 12 14:38:39 2010
@@ -29,6 +29,7 @@
package org.piccolo2d.nodes;
import java.awt.Shape;
+import java.awt.Stroke;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
@@ -48,6 +49,16 @@
public PArea() {
area = new Area();
}
+
+ /**
+ * Create a new area node with an empty area and the specified stroke.
+ *
+ * @param stroke stroke
+ */
+ public PArea(final Stroke stroke) {
+ area = new Area();
+ setStroke(stroke);
+ }
/**
* Create a new area node with the specified shape.
@@ -60,6 +71,20 @@
}
this.area = new Area(shape);
}
+
+ /**
+ * Create a new area node with the specified shape and stroke.
+ *
+ * @param shape shape, must not be null
+ * @param stroke stroke
+ */
+ public PArea(final Shape shape, final Stroke stroke) {
+ if (shape == null) {
+ throw new NullPointerException("shape must not be null");
+ }
+ this.area = new Area(shape);
+ setStroke(stroke);
+ }
/**
* Create a new area node with the specified area.
@@ -74,6 +99,21 @@
this.area.add(area);
}
+ /**
+ * Create a new area node with the specified area and stroke.
+ *
+ * @param area area, must not be null
+ * @param stroke stroke
+ */
+ public PArea(final Area area, final Stroke stroke) {
+ if (area == null) {
+ throw new NullPointerException("area must not be null");
+ }
+ this.area = new Area();
+ this.area.add(area);
+ setStroke(stroke);
+ }
+
/**
* Return a copy of the area backing this area node.
@@ -207,7 +247,6 @@
}
// todo:
- // area property change events?
// should modifiers return this to allow chaining, e.g.
add(area0).intersect(area1)
// test serialization, may have to add custom code to serialize
areas
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en