Package doodlepad
Class Path
java.lang.Object
doodlepad.Shape
doodlepad.Path
A class that implements a general graphical path object.
-
Nested Class Summary
Nested classes/interfaces inherited from class doodlepad.Shape
Shape.ShapeMouseEventHandler, Shape.ShapeSelectionEventHandler
-
Field Summary
Fields inherited from class doodlepad.Shape
draggable, eventsEnabled, fillColor, filled, font, fontFamily, fontSize, fontStyle, height, layer, selectable, selected, shapeListener, strokeColor, stroked, strokeWidth, text, textFillColor, transform, visible, width, x, y
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Close the Path object.void
curveTo
(double cx1, double cy1, double cx2, double cy2, double x, double y) Add a curve to the Path object.void
draw
(Graphics2D g) Draw the Path objectvoid
lineTo
(double x, double y) Add a line to the Path objectvoid
moveTo
(double x, double y) Add a moveTo operation to the Path objectvoid
quadTo
(double cx1, double cy1, double x, double y) Add a quadratic curve to the Path objectvoid
setLocation
(double x, double y) Update all path operations to reflect new positionvoid
setSize
(double w, double h) Update all path operations to reflect new sizetoString()
Generate a representation of the Path object.Methods inherited from class doodlepad.Shape
contains, contains, drawText, getArea, getCenter, getDraggable, getEventsEnabled, getFillAlpha, getFillBlue, getFillColor, getFilled, getFillGreen, getFillRed, getFontFamily, getFontSize, getFontStyle, getHeight, getLayer, getLocation, getPad, getPadLocation, getSelectable, getSelected, getSize, getStrokeAlpha, getStrokeBlue, getStrokeColor, getStroked, getStrokeGreen, getStrokeRed, getStrokeWidth, getText, getTransform, getVisible, getWidth, getWindowLocation, getX, getY, intersects, move, onMouseClicked, onMouseDoubleClicked, onMouseDragged, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onSelectionChanged, repaint, reset, rotate, rotate, scale, scale, scale, scale, setCenter, setCenter, setDraggable, setEventsEnabled, setFillColor, setFillColor, setFillColor, setFillColor, setFilled, setFontFamily, setFontSize, setFontStyle, setHeight, setLocation, setMouseClickedHandler, setMouseDoubleClickedHandler, setMouseDraggedHandler, setMouseEnteredHandler, setMouseExitedHandler, setMouseMovedHandler, setMousePressedHandler, setMouseReleasedHandler, setPadLocation, setSelectable, setSelected, setSelectionChangedHandler, setSize, setStrokeColor, setStrokeColor, setStrokeColor, setStrokeColor, setStroked, setStrokeWidth, setText, setTextColor, setTextColor, setTextColor, setTextColor, setTransform, setVisible, setWidth, setWindowLocation, setX, setY, toBack, toFront, toWindowCoords, toWindowCoords, translate
-
Constructor Details
-
Path
public Path()Constructor for objects of class Path -
Path
Constructor for objects of class Path- Parameters:
pad
- The Pad to which this object should be added.
-
Path
Constructor for objects of class Path- Parameters:
layer
- The Layer object to which the Path should be added, or null if not to add to a Layer.
-
-
Method Details
-
toString
Generate a representation of the Path object. -
moveTo
public void moveTo(double x, double y) Add a moveTo operation to the Path object- Parameters:
x
- The x-coordinate of the moveTo point.y
- The y-coordinate of the moveTo point.
-
lineTo
public void lineTo(double x, double y) Add a line to the Path object- Parameters:
x
- The x-coordinate of the line endpoint.y
- The y-coordinate of the line endpoint.
-
quadTo
public void quadTo(double cx1, double cy1, double x, double y) Add a quadratic curve to the Path object- Parameters:
cx1
- The x-coordinate of the control point.cy1
- The y-coordinate of the control point.x
- The x-coordinate of the endpoint.y
- The y-coordinate of the endpoint.
-
curveTo
public void curveTo(double cx1, double cy1, double cx2, double cy2, double x, double y) Add a curve to the Path object.- Parameters:
cx1
- The x-coordinate of the first control point.cy1
- The y-coordinate of the first control point.cx2
- The x-coordinate of the second control point.cy2
- The y-coordinate of the second control point.x
- The x-coordinate of the curve endpoint.y
- The y-coordinate of the curve endpoint.
-
closePath
public void closePath()Close the Path object. -
setLocation
public void setLocation(double x, double y) Update all path operations to reflect new position- Overrides:
setLocation
in classShape
- Parameters:
x
- New x position of upper-left cornery
- New y position of upper-left corner
-
setSize
public void setSize(double w, double h) Update all path operations to reflect new size -
draw
Draw the Path object
-