public class CGContext extends CFType
Modifier and Type | Method and Description |
---|---|
void |
addArc(double x,
double y,
double radius,
double startAngle,
double endAngle,
int clockwise)
Adds an arc to the current path of this graphics context.
|
void |
addArcToPoint(double x1,
double y1,
double x2,
double y2,
double radius)
Adds an arc to the current path of this graphics context.
|
void |
addCurveToPoint(double cp1x,
double cp1y,
double cp2x,
double cp2y,
double x,
double y)
Adds a cubic Bézier curve to the specified subpath of this graphics
context.
|
void |
addLines(CGPoint... points)
Adds the specified, by the given points line, to the current path of this
graphics context.
|
void |
addLineToPoint(double x,
double y)
Adds a straight line segment between the specified points of this
graphics context.
|
void |
addPath(CGPath path)
Add a new path to current path
|
void |
addQuadCurveToPoint(double cpx,
double cpy,
double x,
double y)
Adds a quadratic Bézier curve to the specified path of this graphics
context.
|
void |
addRect(CGRect rect)
Adds the specified rectangular path to the current path of this graphics
context.
|
void |
addRects(CGRect... rects)
Adds the specified rectangular paths to the current path of this graphics
context.
|
void |
beginPath()
Creates a new path in this graphics context.
|
void |
clip()
Clip graphics context using current path.
|
void |
clipToRect(CGRect frame)
Sets as clipping path the intersection of the current clipping path with
the specified rectangle in this graphics context.
|
void |
closePath()
Closes and completes the current path.
|
void |
concatCTM(CGAffineTransform transform)
Changes user's coordinate system according to the specified
transformation matrix.
|
void |
drawImage(CGRect rect,
CGImage image)
Draws the specified image within the given rectangle of this graphics
context.
|
void |
drawLinearGradient(CGGradient gradient,
CGPoint startPoint,
CGPoint endPoint,
int CGGradientDrawingOptions)
Draws linear gradient for the specified area of this graphics context.
|
void |
drawPath(int CGPathDrawingMode)
Draws the current path using the specified drawing mode.
|
void |
drawRadialGradient(CGGradient gradient,
CGPoint startCenter,
double startRadius,
CGPoint endCenter,
double endRadius,
int CGGradientDrawingOptions)
Draws a radial gradient for the specified area of defined by the given
circles this graphics context.
|
void |
fillEllipseInRect(CGRect rect)
Paints the ellipse of the specified rectangular for this graphics
context.
|
void |
fillPath()
Fills with color the current path using non-zero winding rule.
|
void |
fillRect(CGRect rect)
Paints the specified rectangular using the current preferred fill color
of this graphics context.
|
CGRect |
getClipBoundingBox()
Returns the bounding box that encloses all the points of the current
clipping path of this graphics context.
|
CGAffineTransform |
getCTM()
Retrieves the current transformation matrix of this graphics context.
|
CGPoint |
getTextPosition()
Returns the position at which the text should be drawn for this graphics
context.
|
void |
moveToPoint(double x,
double y)
Begins a new subpath at the specified point of this graphics context.
|
void |
restoreGState()
Restores the previous graphic state of this graphics context.
|
void |
rotateCTM(double theta)
Rotates user's coordinate system for this graphics context.
|
void |
saveGState()
Saves the current graphic state of this graphics context to the graphic
state stack.
|
void |
scaleCTM(double sx,
double sy)
Changes current scale of user's coordinate system of this graphics
context.
|
void |
selectFont(String fontname,
double size,
int CGTextEncoding)
Deprecated.
|
void |
setAlpha(double alpha)
Sets the opacity for drawing in this graphics context.
|
void |
setFillColor(double[] components)
Sets the fill color of this graphics context defined by the specified
components.
|
void |
setFillColorSpace(CGColorSpace colorSpace)
Sets the CGColorSpace fill color of this graphics context.
|
void |
setFillColorWithColor(CGColor color)
Sets CGColor fill color of this graphics context.
|
void |
setFont(CGFont font)
Sets the font to use for this graphics context.
|
void |
setFontSize(double size)
Set font size for this graphics context.
|
void |
setLineCap(int CGLineCap)
Sets the style of the ending points of lines of this graphics context.
|
void |
setLineJoin(int CGLineJoin)
Sets the style of joining stroked lines when they shape an angle of this
graphics context.
|
void |
setLineWidth(double width)
Sets the width of stroked lines of this graphics context.
|
void |
setRGBFillColor(double red,
double green,
double blue,
double alpha)
Sets the RGBA values for fill color of this graphics context.
|
void |
setRGBStrokeColor(double red,
double green,
double blue,
double alpha)
Sets the RGBA values for the color of stroke lines of this graphics
context.
|
void |
setShadowWithColor(CGSize offset,
double blur,
CGColor color)
Draws shadow with color for this graphics context.
|
void |
setShouldAntialias(boolean shouldAntialias)
Sets a Boolean that defines anti-aliasing status of this graphics
context.
|
void |
setStrokeColor(double[] components)
Sets the stroke color of this graphics context defined by the specified
components.
|
void |
setStrokeColorSpace(CGColorSpace colorSpace)
Sets the CGColorSpace stroke color of this graphics context.
|
void |
setStrokeColorWithColor(CGColor color)
Sets the stroke color of this graphics context.
|
void |
setTextDrawingMode(int CGTextDrawingMode)
Set drawing mode for this graphics context.
|
void |
setTextMatrix(CGAffineTransform t)
Apply the provided affine transformation to the text
|
void |
setTextPosition(double x,
double y)
Sets location of at which the text should be drawn for this graphics
context.
|
void |
showText(String text)
Displays the given String at the current text position of the text
matrix.
|
void |
showTextAtPoint(double x,
double y,
String text)
Displays the given String at the specified position of this graphics
context.
|
void |
strokeEllipseInRect(CGRect rect)
Strokes the ellipse of the specified rectangular for this graphics
context.
|
void |
strokeLineSegments(CGPoint... points)
Strokes the line specified by the given points of this graphics context.
|
void |
strokePath()
Paints a line within the current path.
|
void |
strokeRect(CGRect rect)
Paints the specified rectangular using the current stroke color.
|
void |
translateCTM(double tx,
double ty)
Changes user's origin within this graphics context.
|
public void concatCTM(CGAffineTransform transform)
transform
- The transformation matrix.CGAffineTransform
public CGAffineTransform getCTM()
public void rotateCTM(double theta)
theta
- The rotation angle in radians.public void scaleCTM(double sx, double sy)
sx
- The scale factor of the x axis.sy
- The scale factor of the y axis.public void translateCTM(double tx, double ty)
tx
- The x-value of the origin.ty
- The y-value of the origin.public void saveGState()
public void restoreGState()
public void setAlpha(double alpha)
alpha
- The opacity of this graphic context.public void drawImage(CGRect rect, CGImage image)
rect
- The rectangle within which the image is drawn.image
- The image to be drawn.public void setStrokeColor(double[] components)
components
- The components that specify the stroke color of this
graphics context.public void setStrokeColorWithColor(CGColor color)
color
- The stroke color of this graphics context.public void setStrokeColorSpace(CGColorSpace colorSpace)
colorSpace
- The CGColorSpace stroke color of this graphics context.CGColorSpace
public void setFillColor(double[] components)
components
- The components that specify the fill color of this
graphics context.public void setFillColorWithColor(CGColor color)
color
- The new color of the graphics contextCGColor
public void setFillColorSpace(CGColorSpace colorSpace)
colorSpace
- The CGColorSpace fill color.CGColorSpace
public void setRGBFillColor(double red, double green, double blue, double alpha)
red
- The red value of the RGBA.green
- The green value of the RGBA.blue
- The blue value of the RGBA.alpha
- The alpha value of the RGBA.public void setRGBStrokeColor(double red, double green, double blue, double alpha)
red
- The red value of the RGBA.green
- The green value of the RGBA.blue
- The blue value of the RGBA.alpha
- The alpha value of the RGBA.public void setLineWidth(double width)
width
- The width of stroked lines.public void setLineJoin(int CGLineJoin)
CGLineJoin
- The style of joining stroked lines when they shape an
angle.CGLineJoin
public void setLineCap(int CGLineCap)
CGLineCap
- The style of ending points.CGLineCap
public void strokeRect(CGRect rect)
rect
- The rectangular area to be painted.public void fillRect(CGRect rect)
rect
- The rectangular area to be painted.public void strokeEllipseInRect(CGRect rect)
rect
- The rectangular that specifies the ellipse.public void fillEllipseInRect(CGRect rect)
rect
- The rectangular that specifies the ellipse.public void strokeLineSegments(CGPoint... points)
points
- The points that specify the line that should be stroke.public void clipToRect(CGRect frame)
frame
- The rectangle that changes the clipping path.public void clip()
public CGRect getClipBoundingBox()
public void setFont(CGFont font)
font
- The preferred font.public void setFontSize(double size)
size
- The preferred font size.@Deprecated public void selectFont(String fontname, double size, int CGTextEncoding)
fontname
- The preferred font.size
- The size of the font.CGTextEncoding
- The preferred text encoding.CGTextEncoding
public void setTextMatrix(CGAffineTransform t)
t
- The affine transformationpublic void showText(String text)
text
- The String to display.public void showTextAtPoint(double x, double y, String text)
x
- The x-value of this position.y
- The y-value of this position.text
- The String to display.public CGPoint getTextPosition()
public void setTextPosition(double x, double y)
x
- Horizontal location of texty
- Vertical location of textpublic void setTextDrawingMode(int CGTextDrawingMode)
CGTextDrawingMode
- The drawing mode of this graphics context.CGTextDrawingMode
public void beginPath()
public void moveToPoint(double x, double y)
x
- The x-value of the point.y
- The y-value of the point.public void addLineToPoint(double x, double y)
x
- The x-value for the end of the line segment.y
- The y-value for the end of the line segment.public void addArc(double x, double y, double radius, double startAngle, double endAngle, int clockwise)
x
- The x-value of the center of the arc.y
- The y-value of the center of the arc.radius
- The radius of the arc.startAngle
- The starting angle of the arc expressed in radians.endAngle
- The ending angle of the arc expressed in radians.clockwise
- Specify 1 to create a clockwise arc or 0 to create a
counterclockwise arc. Whether the arc is added clockwise or
counterclockwise.public void addArcToPoint(double x1, double y1, double x2, double y2, double radius)
x1
- The x-value of the first tangent line.y1
- The y-value of the first tangent line.x2
- The y-value of the first tangent line.y2
- The x-value of the second tangent line.radius
- The radius of the arc.public void addCurveToPoint(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)
cp1x
- The x-value of first control point of the curve.cp1y
- The y-value of first control point of the curve.cp2x
- The x-value of the second control point of the curve.cp2y
- The y-value of the second control point of the curve.x
- The x end point of the curve.y
- The y end point of the curve.public void addQuadCurveToPoint(double cpx, double cpy, double x, double y)
cpx
- The y control point of the curve.cpy
- The y control point of the curve.x
- The x end point of the curve.y
- The y end point of the curve.public void addRect(CGRect rect)
rect
- The rectangular path to add to the current path.public void addRects(CGRect... rects)
rects
- The rectangular paths.public void addLines(CGPoint... points)
points
- The points of the line.public void closePath()
public void drawPath(int CGPathDrawingMode)
CGPathDrawingMode
- A path drawing mode for the path.CGPathDrawingMode
public void fillPath()
public void strokePath()
public void addPath(CGPath path)
path
- The path to addpublic void drawLinearGradient(CGGradient gradient, CGPoint startPoint, CGPoint endPoint, int CGGradientDrawingOptions)
gradient
- The CGGradient object.startPoint
- Starting point's coordinates.endPoint
- Ending point's coordinates.CGGradientDrawingOptions
- The drawing locations of the gradients.CGGradientDrawingOptions
public void drawRadialGradient(CGGradient gradient, CGPoint startCenter, double startRadius, CGPoint endCenter, double endRadius, int CGGradientDrawingOptions)
gradient
- The CGGradient object.startCenter
- Starting circle's coordinates.startRadius
- Starting circle's radius.endCenter
- Ending circle's coordinates.endRadius
- Ending circle's radius.CGGradientDrawingOptions
- The drawing locations of the gradients.CGGradientDrawingOptions
public void setShadowWithColor(CGSize offset, double blur, CGColor color)
offset
- The translation of the shadow offset.blur
- The amount of blur.color
- The color of the shadow.public void setShouldAntialias(boolean shouldAntialias)
shouldAntialias
- TRUE to enable anti-aliasing which is the default.Copyright © 2020. All rights reserved.