Package snap.viewx
Class QuickDraw
java.lang.Object
snap.props.PropObject
snap.view.View
snap.viewx.QuickDraw
- All Implemented Interfaces:
PropChange.DoChange
,XMLArchiver.Archivable
This class supports convenient drawing methods for quick and convenient vector graphics drawing.
-
Field Summary
Fields inherited from class snap.view.View
_align, _borderRadius, _effect, _font, _margin, _padding, _repaintRect, _showing, _spacing, _vertical, Action, Align_Prop, Border_Prop, BorderRadius_Prop, Clip_Prop, Cursor_Prop, DEFAULT_ALIGN, DEFAULT_MARGIN, DEFAULT_PADDING, DEFAULT_SPACING, Disabled_Prop, DragEvents, Effect_Prop, Fill_Prop, Focusable_Prop, Focused_Prop, FocusWhenPressed_Prop, Font_Prop, GrowHeight_Prop, GrowWidth_Prop, Height_Prop, KeyEvents, KeyPress, KeyRelease, KeyType, LeanX_Prop, LeanY_Prop, Managed_Prop, Margin_Prop, MaxHeight_Prop, MaxWidth_Prop, MinHeight_Prop, MinWidth_Prop, MouseDrag, MouseEnter, MouseEvents, MouseExit, MouseMove, MousePress, MouseRelease, Name_Prop, Opacity_Prop, Padding_Prop, Paintable_Prop, Parent_Prop, Pickable_Prop, PrefHeight_Prop, PrefWidth_Prop, Rotate_Prop, ScaleX_Prop, ScaleY_Prop, Scroll, Showing_Prop, Spacing_Prop, Text_Prop, ToolTip_Prop, TransX_Prop, TransY_Prop, Vertical_Prop, Visible_Prop, Width_Prop, X_Prop, Y_Prop
Fields inherited from class snap.props.PropObject
_pcs, EMPTY_OBJECT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAnimPen
(snap.viewx.QuickDrawPenAnim aPen) Adds an anim pen.void
Adds a line segment to current draw path from last path point to last moveTo point.static QuickDraw
Creates and returns a default view with size 400 x 400.static QuickDraw
createDrawView
(int aWidth, int aHeight) Creates and returns a view for given width and height.void
forward
(double aLength) Moves the default pen forward by given length for current Direction.double
Returns the space between gridlines in points.getPen()
Returns the main pen.getPen
(int anIndex) Returns the pen at given index.boolean
Returns whether to animate drawing (by returning pens that animate).boolean
Returns whether to draw coordinate grid.void
lineTo
(double aX, double aY) Adds a line segment to current draw path from last path point to given point.void
moveTo
(double aX, double aY) Moves the current path point to given point.protected void
paintFront
(Painter aPntr) Override to paint pen paths.protected void
processEvent
(ViewEvent anEvent) Process event.protected void
removeAnimPen
(snap.viewx.QuickDrawPenAnim aPen) Removes an animating pen.void
setAnimate
(boolean aValue) Sets whether to animate drawing (by returning pens that animate).void
setGridSpacing
(double aValue) Sets the space between gridlines in points.void
setPenColor
(Color aColor) Sets the current pen color.void
setPenWidth
(double aWidth) Sets the current pen width.void
setShowGrid
(boolean aValue) Sets whether to draw coordinate grid.void
turn
(double anAngle) Sets the path drawing direction to the current direction plus given angle.Methods inherited from class snap.view.View
addBinding, addEventFilter, addEventHandler, clone, contains, contains, containsShape, createActionEvent, disableEvents, enableEvents, fireActionEvent, fromXML, getAlign, getAlignX, getAlignY, getAnim, getAnimCleared, getAnimTimeDeep, getBestHeight, getBestSize, getBestWidth, getBinding, getBinding, getBindingCount, getBindings, getBorder, getBorderRadius, getBounds, getBoundsLocal, getBoundsParent, getBoundsShape, getBoundsShapeParent, getClip, getClipAll, getClipAllBounds, getClipBounds, getClippedRect, getCursor, getDefaultBorder, getDefaultFill, getDefaultFont, getEffect, getEnv, getEventAdapter, getFill, getFillColor, getFocusNext, getFocusPrev, getFont, getHeight, getHost, getInsetsAll, getLean, getLeanX, getLeanY, getLocalToParent, getLocalToParent, getMargin, getMaxHeight, getMaxSize, getMaxWidth, getMaxX, getMaxY, getMidX, getMidY, getMinHeight, getMinHeightImpl, getMinSize, getMinWidth, getMinWidthImpl, getName, getOpacity, getOpacityAll, getOwner, getOwner, getPadding, getParent, getParent, getParentCount, getParentToLocal, getParentToLocal, getPhysics, getPhysics, getPrefHeight, getPrefHeight, getPrefHeightImpl, getPrefSize, getPrefWidth, getPrefWidth, getPrefWidthImpl, getProp, getPropDefault, getProps, getPropValue, getRealClassName, getRepaintRect, getRepaintRectExpanded, getRootView, getRotate, getScale, getScaleX, getScaleY, getSize, getSpacing, getText, getToolTip, getToolTip, getTransX, getTransY, getUpdater, getValuePropName, getVisRect, getWidth, getWindow, getX, getXY, getY, indexInHost, indexInParent, initProps, intersectsShape, isActionable, isAncestor, isClipToBounds, isDisabled, isEnabled, isFocusable, isFocused, isFocusKeysEnabled, isFocusPainted, isFocusWhenPressed, isFontSet, isGrowHeight, isGrowWidth, isGuest, isHorizontal, isLocalToParentSimple, isManaged, isManagedVisible, isMaxHeightSet, isMaxWidthSet, isMinHeightSet, isMinWidthSet, isMouseDown, isMouseOver, isNeedsRepaint, isPaintable, isPickable, isPickableVisible, isPrefHeightSet, isPrefWidthSet, isShowing, isToolTipEnabled, isVertical, isVisible, localToParent, localToParent, localToParent, localToParent, localToScreen, paintAll, paintBack, parentFontChanged, parentToLocal, parentToLocal, parentToLocal, parentToLocal, playAnimDeep, processEventAll, processEventFilters, processEventHandlers, relayout, relayoutParent, removeBinding, removeBinding, removeEventFilter, removeEventHandler, repaint, repaint, repaint, repaintInParent, requestFocus, runDelayed, runIntervals, runLater, scrollToVisible, setActionable, setAlign, setAlignX, setAlignY, setAnimProps, setAnimString, setAnimTimeDeep, setBorder, setBorder, setBorderRadius, setBounds, setBounds, setBoundsLocal, setClip, setClipToBounds, setCursor, setDisabled, setEffect, setEnabled, setFill, setFocusable, setFocused, setFocusKeysEnabled, setFocusPainted, setFocusWhenPressed, setFont, setGrowHeight, setGrowWidth, setHeight, setLean, setLeanX, setLeanY, setManaged, setMargin, setMargin, setMaxHeight, setMaxSize, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinSize, setMinWidth, setName, setOpacity, setOwner, setPadding, setPadding, setPaintable, setParent, setPickable, setPrefHeight, setPrefSize, setPrefSize, setPrefWidth, setProp, setPropValue, setRealClassName, setRotate, setScale, setScaleX, setScaleY, setShowing, setSize, setSize, setSizeLocal, setSizeToBestSize, setSizeToPrefSize, setSpacing, setText, setToolTip, setToolTipEnabled, setTransX, setTransY, setVertical, setVisible, setWidth, setX, setXY, setXYLocal, setY, stopAnimDeep, stopIntervals, themeChanged, toStringProps, toXML
Methods inherited from class snap.props.PropObject
addDeepChangeListener, addPropChangeListener, addPropChangeListener, firePropChange, firePropChange, firePropChange, getPropForName, getPropParent, getPropSet, getPropsForArchival, getPropsForArchivalExtra, getPropsString, isPropDefault, processPropChange, removeDeepChangeListener, removePropChangeListener, removePropChangeListener, setPropsString, setPropValues, toString
-
Constructor Details
-
QuickDraw
public QuickDraw(int aWidth, int aHeight) Constructor.
-
-
Method Details
-
isShowGrid
public boolean isShowGrid()Returns whether to draw coordinate grid. -
setShowGrid
public void setShowGrid(boolean aValue) Sets whether to draw coordinate grid. -
getGridSpacing
public double getGridSpacing()Returns the space between gridlines in points. -
setGridSpacing
public void setGridSpacing(double aValue) Sets the space between gridlines in points. -
isAnimate
public boolean isAnimate()Returns whether to animate drawing (by returning pens that animate). -
setAnimate
public void setAnimate(boolean aValue) Sets whether to animate drawing (by returning pens that animate). -
getPen
Returns the main pen. -
getPen
Returns the pen at given index. -
setPenColor
Sets the current pen color. -
setPenWidth
public void setPenWidth(double aWidth) Sets the current pen width. -
moveTo
public void moveTo(double aX, double aY) Moves the current path point to given point. -
lineTo
public void lineTo(double aX, double aY) Adds a line segment to current draw path from last path point to given point. -
closePath
public void closePath()Adds a line segment to current draw path from last path point to last moveTo point. -
forward
public void forward(double aLength) Moves the default pen forward by given length for current Direction. -
turn
public void turn(double anAngle) Sets the path drawing direction to the current direction plus given angle. -
paintFront
Override to paint pen paths.- Overrides:
paintFront
in classView
-
processEvent
Process event.- Overrides:
processEvent
in classView
-
addAnimPen
protected void addAnimPen(snap.viewx.QuickDrawPenAnim aPen) Adds an anim pen. -
removeAnimPen
protected void removeAnimPen(snap.viewx.QuickDrawPenAnim aPen) Removes an animating pen. -
createDrawView
Creates and returns a default view with size 400 x 400. -
createDrawView
Creates and returns a view for given width and height.
-