Package snap.gfx
Class Painter
java.lang.Object
snap.gfx.Painter
- Direct Known Subclasses:
PainterImpl
,PainterProxy
A base class for painting Shapes, Text and Images.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
A class that provide extra painter properties. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearRect
(double aX, double aY, double aW, double aH) Clears a rect.abstract void
Clip by shape.void
clipRect
(double aX, double aY, double aW, double aH) Clip to rect.abstract void
Stroke the given shape.void
drawButton
(double x, double y, double w, double h, boolean isPressed) Draws a button for the given rect with an option for pressed.void
drawButton
(Rect aRect, boolean isPressed) Draws a button for the given rect with an option for pressed.void
Draw image in rect.void
Draw image in rect.abstract void
drawImage
(Image anImage, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) Draw image in rect.void
Draw image with transform.void
drawLine
(double x1, double y1, double x2, double y2) Draw the given line.void
drawLineWithPaint
(double x1, double y1, double x2, double y2, Paint aPaint) Draw the given line.void
drawRect
(double x, double y, double w, double h) Draw the given rect.void
drawRectWithPaint
(double aX, double aY, double aW, double aH, Paint aPaint) Draw given rect with given paint.void
drawString
(String aStr, double aX, double aY) Draw string at location.void
drawString
(String aStr, double aX, double aY, double charSpacing) Draw string at location with char spacing.void
drawWithPaint
(Shape aShape, Paint aPaint) Convenience to stroke given shape with given paint.abstract void
Fill the given shape.void
fill3DRect
(double x, double y, double w, double h, boolean raised) Paints a 3D rect.void
fillRect
(double x, double y, double w, double h) Fill the given rect.void
fillRectWithPaint
(double aX, double aY, double aW, double aH, Paint aPaint) Fill given rect with given paint.void
fillWithPaint
(Shape aShape, Paint aPaint) Convenience to fill given shape with given paint.void
flush()
Flush any buffered paint operations.abstract Shape
getClip()
Return clip shape.Return clip bounds.getColor()
Returns the current color.Returns the composite mode.abstract Font
getFont()
Returns the current font.double
Returns image rendering quality.Return native helper for painter, if available.<T> T
Return native helper for painter as given class, if available.abstract double
Returns the opacity.abstract Paint
getPaint()
Returns the current paint.getProps()
Returns the object that provides extra painter properties.abstract Stroke
Returns the current stroke.abstract Transform
Return transform.boolean
Returns whether painting is for static output.boolean
Returns whether stroked path is used as is (otherwise, points might be rounded).abstract void
restore()
Restores the graphics state.void
rotate
(double theDegrees) Rotate by angle in degrees.void
rotateAround
(double theDegrees, double aX, double aY) Rotate by angle in degrees.abstract void
save()
Saves the graphics state.void
scale
(double sx, double sy) Scale by sx, sy.boolean
setAntialiasing
(boolean aValue) Sets whether antialiasing.void
Sets the current color.void
setComposite
(Painter.Composite aComp) Sets the composite mode.abstract void
Sets the current font.void
setImageQuality
(double aValue) Sets image rendering quality.abstract void
setOpacity
(double aValue) Sets the opacity.abstract void
Sets the current paint.void
setPrinting
(boolean aValue) Sets whether shape painting is for static output.void
setProps
(Painter.Props theProps) Sets the object that provides extra painter properties.abstract void
Sets the current stroke.void
setStrokePure
(boolean aValue) Sets whether stroked path is used as is (otherwise, points might be rounded).void
setStrokeWidth
(double aWidth) Sets the current stroke.void
setTransform
(double a, double b, double c, double d, double tx, double ty) Transform by transform.abstract void
setTransform
(Transform aTrans) Set to transform.void
strokeString
(String aStr, double aX, double aY, double charSpacing) Stroke string at location with char spacing.toString()
Standard toString implementation.void
transform
(double a, double b, double c, double d, double tx, double ty) Transform by transform.abstract void
Transform by transform.void
translate
(double tx, double ty) Translate by x,y.
-
Constructor Details
-
Painter
public Painter()
-
-
Method Details
-
getColor
Returns the current color. -
setColor
Sets the current color. -
getFont
Returns the current font. -
setFont
Sets the current font. -
getPaint
Returns the current paint. -
setPaint
Sets the current paint. -
getStroke
Returns the current stroke. -
setStroke
Sets the current stroke. -
setStrokeWidth
public void setStrokeWidth(double aWidth) Sets the current stroke. -
getOpacity
public abstract double getOpacity()Returns the opacity. -
setOpacity
public abstract void setOpacity(double aValue) Sets the opacity. -
clearRect
public void clearRect(double aX, double aY, double aW, double aH) Clears a rect. -
draw
Stroke the given shape. -
fill
Fill the given shape. -
drawLine
public void drawLine(double x1, double y1, double x2, double y2) Draw the given line. -
fillRect
public void fillRect(double x, double y, double w, double h) Fill the given rect. -
drawRect
public void drawRect(double x, double y, double w, double h) Draw the given rect. -
drawWithPaint
Convenience to stroke given shape with given paint. -
fillWithPaint
Convenience to fill given shape with given paint. -
drawLineWithPaint
Draw the given line. -
drawRectWithPaint
Draw given rect with given paint. -
fillRectWithPaint
Fill given rect with given paint. -
drawImage
Draw image with transform. -
drawImage
Draw image in rect. -
drawImage
Draw image in rect. -
drawImage
public abstract void drawImage(Image anImage, double sx, double sy, double sw, double sh, double dx, double dy, double dw, double dh) Draw image in rect. -
drawString
Draw string at location. -
drawString
Draw string at location with char spacing. -
strokeString
Stroke string at location with char spacing. -
translate
public void translate(double tx, double ty) Translate by x,y. -
rotate
public void rotate(double theDegrees) Rotate by angle in degrees. -
rotateAround
public void rotateAround(double theDegrees, double aX, double aY) Rotate by angle in degrees. -
scale
public void scale(double sx, double sy) Scale by sx, sy. -
getTransform
Return transform. -
setTransform
Set to transform. -
setTransform
public void setTransform(double a, double b, double c, double d, double tx, double ty) Transform by transform. -
transform
Transform by transform. -
transform
public void transform(double a, double b, double c, double d, double tx, double ty) Transform by transform. -
getClip
Return clip shape. -
getClipBounds
Return clip bounds. -
clip
Clip by shape. -
clipRect
public void clipRect(double aX, double aY, double aW, double aH) Clip to rect. -
getComposite
Returns the composite mode. -
setComposite
Sets the composite mode. -
setAntialiasing
public boolean setAntialiasing(boolean aValue) Sets whether antialiasing. -
getImageQuality
public double getImageQuality()Returns image rendering quality. -
setImageQuality
public void setImageQuality(double aValue) Sets image rendering quality. -
isStrokePure
public boolean isStrokePure()Returns whether stroked path is used as is (otherwise, points might be rounded). -
setStrokePure
public void setStrokePure(boolean aValue) Sets whether stroked path is used as is (otherwise, points might be rounded). -
isPrinting
public boolean isPrinting()Returns whether painting is for static output. -
setPrinting
public void setPrinting(boolean aValue) Sets whether shape painting is for static output. -
getProps
Returns the object that provides extra painter properties. -
setProps
Sets the object that provides extra painter properties. -
save
public abstract void save()Saves the graphics state. -
restore
public abstract void restore()Restores the graphics state. -
flush
public void flush()Flush any buffered paint operations. -
fill3DRect
public void fill3DRect(double x, double y, double w, double h, boolean raised) Paints a 3D rect. -
drawButton
Draws a button for the given rect with an option for pressed. -
drawButton
public void drawButton(double x, double y, double w, double h, boolean isPressed) Draws a button for the given rect with an option for pressed. -
getNative
Return native helper for painter, if available. -
getNative
Return native helper for painter as given class, if available. -
toString
Standard toString implementation.
-