Package snap.swing
Class J2DPainter
java.lang.Object
snap.gfx.Painter
snap.swing.J2DPainter
A Painter implementation that uses Java2D (Graphics2D).
-
Nested Class Summary
Nested classes/interfaces inherited from class snap.gfx.Painter
Painter.Composite, Painter.Props
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearRect
(double aX, double aY, double aW, double aH) Clears a rect.void
Clip by shape.void
Draws a shape in painter.void
drawImage
(Image img, 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
drawString
(String aStr, double aX, double aY, double cs) Draw string at location.void
Fills a shape in painter.getClip()
Return clip shape.Returns the Composite.getFont()
Returns the current font.Returns the Graphics.double
Returns the opacity.getPaint()
Returns the current paint.getStringBounds
(String aStr) Return string bounds.Returns the current stroke.Returns the current transform.boolean
Returns whether antialiasing.boolean
Returns whether antialiasing.boolean
Returns whether using fractional text metrics.void
restore()
Disposes of the painter.void
save()
Standard clone implementation.boolean
setAntialiasing
(boolean aValue) Sets whether antialiasing.boolean
setAntialiasingText
(boolean aValue) Sets whether antialiasing.void
setComposite
(Painter.Composite aComp) Sets the composite mode.void
Sets the font in painter.boolean
setFractionalMetrics
(boolean aValue) Sets whether using fractional text metrics.void
setImageQuality
(double aValue) Sets image rendering quality.void
setOpacity
(double aValue) Sets the opacity in painter.void
Sets the paint in painter.void
Sets the stroke in painter.void
setStrokePure
(boolean aValue) Sets whether stroke is rounded to nearest pixel.void
setTransform
(Transform aTrans) Sets the current transform.void
Transform painter.Methods inherited from class snap.gfx.Painter
clipRect, drawButton, drawButton, drawImage, drawImage, drawLine, drawLineWithPaint, drawRect, drawRectWithPaint, drawString, drawWithPaint, fill3DRect, fillRect, fillRectWithPaint, fillWithPaint, flush, getClipBounds, getColor, getImageQuality, getNative, getProps, isPrinting, isStrokePure, rotate, rotateAround, scale, setColor, setPrinting, setProps, setStrokeWidth, setTransform, toString, transform, translate
-
Constructor Details
-
J2DPainter
Creates a new J2DPainter.
-
-
Method Details
-
getPaint
Returns the current paint. -
setPaint
Sets the paint in painter. -
getStroke
Returns the current stroke. -
setStroke
Sets the stroke in painter. -
getOpacity
public double getOpacity()Returns the opacity.- Specified by:
getOpacity
in classPainter
-
setOpacity
public void setOpacity(double aValue) Sets the opacity in painter.- Specified by:
setOpacity
in classPainter
-
getComposite
Returns the Composite.- Overrides:
getComposite
in classPainter
-
setComposite
Sets the composite mode.- Overrides:
setComposite
in classPainter
-
getFont
Returns the current font. -
setFont
Sets the font in painter. -
clearRect
public void clearRect(double aX, double aY, double aW, double aH) Clears a rect. -
draw
Draws a shape in painter. -
fill
Fills a shape in painter. -
drawImage
Draw image with transform. -
drawImage
public void drawImage(Image img, 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.- Overrides:
drawString
in classPainter
-
getStringBounds
Return string bounds. -
getTransform
Returns the current transform.- Specified by:
getTransform
in classPainter
-
setTransform
Sets the current transform.- Specified by:
setTransform
in classPainter
-
transform
Transform painter. -
getClip
Return clip shape. -
clip
Clip by shape. -
isAntialiasing
public boolean isAntialiasing()Returns whether antialiasing. -
setAntialiasing
public boolean setAntialiasing(boolean aValue) Sets whether antialiasing.- Overrides:
setAntialiasing
in classPainter
-
isAntialiasingText
public boolean isAntialiasingText()Returns whether antialiasing. -
setAntialiasingText
public boolean setAntialiasingText(boolean aValue) Sets whether antialiasing. -
isFractionalTextMetrics
public boolean isFractionalTextMetrics()Returns whether using fractional text metrics. -
setFractionalMetrics
public boolean setFractionalMetrics(boolean aValue) Sets whether using fractional text metrics. -
setImageQuality
public void setImageQuality(double aValue) Sets image rendering quality.- Overrides:
setImageQuality
in classPainter
-
setStrokePure
public void setStrokePure(boolean aValue) Sets whether stroke is rounded to nearest pixel.- Overrides:
setStrokePure
in classPainter
-
save
public void save()Standard clone implementation. -
restore
public void restore()Disposes of the painter. -
getNative
Returns the Graphics.
-