Paint
public final class Paint
Paint
controls options applied when drawing. Paint
collects all
options outside of the Canvas
clip and Canvas
matrix.
Various options apply to strokes and fills, and images.
Paint
collects effects and filters that describe single-pass and multiple-pass
algorithms that alter the drawing geometry, color, and transparency. For instance,
Paint
does not directly implement dashing or blur, but contains the objects that do so.
-
Set Style to fill, stroke, or both fill and stroke geometry.
The stroke and fill share all paint attributes; for instance, they are drawn with the same color. Use
See more.strokeAndFill
to avoid hitting the same pixels twice with a stroke draw and a fill draw.Declaration
Swift
public enum Style : UInt32
-
Join specifies how corners are drawn when a shape is stroked. Join affects the four corners of a stroked rectangle, and the connected segments in a stroked path.
Choose miter join to draw sharp corners. Choose round join to draw a circle with a radius equal to the stroke width on top of the corner. Choose bevel join to minimally connect the thick strokes.
The fill path constructed to describe the stroked path respects the join setting but may not contain the actual join. For instance, a fill path constructed with round joins does not necessarily include circles at each connected segment.
See moreDeclaration
Swift
public enum StrokeJoin : UInt32
-
Hinting adjusts the glyph outlines so that the shape provides a uniform look at a given point size on font engines that support it. Hinting may have a muted effect or no effect at all depending on the platform.
The four levels roughly control corresponding features on platforms that use FreeType as the font engine.
See moreDeclaration
Swift
public enum Hinting : UInt32
-
Cap draws at the beginning and end of an open path contour.
See moreDeclaration
Swift
public enum StrokeCap : UInt32
-
Constructs SkPaint with default values.
Declaration
Swift
public init()
-
Sets all
Paint
contents to their initial values. This is equivalent to replacingPaint
with the result ofPaint
Declaration
Swift
public func reset()
-
Returns true if pixels on the active edges of SkPath may be drawn with partial transparency. When setting, requests, but does not require, that edge pixels draw opaque or with partial transparency.
Declaration
Swift
public var isAntialias: Bool { get set }
-
Returns true if color error may be distributed to smooth color transition. When setting, requests, but does not require, to distribute color error.
Declaration
Swift
public var isDither: Bool { get set }
-
Undocumented
Declaration
Swift
public var isVerticalText: Bool { get set }
-
Undocumented
Declaration
Swift
public var isLinearText: Bool { get set }
-
Undocumented
Declaration
Swift
public var subpixelText: Bool { get set }
-
Undocumented
Declaration
Swift
public var lcdRenderedText: Bool { get set }
-
Undocumented
Declaration
Swift
public var isEmbeddedBitmapText: Bool { get set }
-
Undocumented
Declaration
Swift
public var isAutohinted: Bool { get set }
-
Undocumented
Declaration
Swift
public var fakeBoldText: Bool { get set }
-
Undocumented
Declaration
Swift
public var hintingLevel: Hinting { get set }
-
Undocumented
Declaration
Swift
public var deviceKerningEnabled: Bool { get set }
-
Undocumented
Declaration
Swift
public var isStroke: Bool { get set }
-
Undocumented
Declaration
Swift
public var style: Style { get set }
-
Undocumented
Declaration
Swift
public var color: Color { get set }
-
Undocumented
Declaration
Swift
public var strokeWidth: Float { get set }
-
Undocumented
Declaration
Swift
public var strokeMiter: Float { get set }
-
Undocumented
Declaration
Swift
public var strokeCap: StrokeCap { get set }
-
Undocumented
Declaration
Swift
public var strokeJoin: StrokeJoin { get set }
-
Undocumented
Declaration
Swift
public var shader: Shader { get set }
-
Undocumented
Declaration
Swift
public var maskFilter: MaskFilter { get set }
-
Undocumented
Declaration
Swift
public var colorFilter: ColorFilter { get set }
-
Undocumented
Declaration
Swift
public var imageFilter: ImageFilter { get set }
-
Undocumented
Declaration
Swift
public var blendMode: BlendMode { get set }
-
Undocumented
Declaration
Swift
public var filterQuality: FilterQuality { get set }
-
Undocumented
Declaration
Swift
public var typeface: Typeface { get set }
-
Undocumented
Declaration
Swift
public var textSize: Float { get set }
-
Undocumented
Declaration
Swift
public var textAlign: TextAlign { get set }
-
Undocumented
Declaration
Swift
public var textEncoding: TextEncoding { get set }
-
Undocumented
Declaration
Swift
public var textScaleX: Float { get set }
-
Undocumented
Declaration
Swift
public var textSkewX: Float { get set }
-
Undocumented
Declaration
Swift
public var pathEffect: PathEffect { get set }
-
Undocumented
Declaration
Swift
public var fontSpacing: Float { get }
-
Undocumented
Declaration
Swift
public var fontMetrics: sk_fontmetrics_t { get }
-
Undocumented
Declaration
Swift
public func getFontMetrics(metrics: inout sk_fontmetrics_t, scale: Float = 0) -> Float
-
Undocumented
Declaration
Swift
public func clone() -> Paint
-
Undocumented
Declaration
Swift
public func measureText(text: String) -> Float
-
Undocumented
Declaration
Swift
public func measureText(text: String, bounds: inout Rect) -> Float