Module

x/canvas/mod.ts

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Go to Latest
interface SkPaint
implements EmbindObject<SkPaint>
import { type SkPaint } from "https://deno.land/x/canvas@v1.0.0/mod.ts";

See SkPaint.h for more information on this class.

Methods

copy(): SkPaint

Returns a copy of this paint.

getBlendMode(): BlendMode

Returns the blend mode, that is, the mode used to combine source color with destination color.

getColor(): SkColor

Retrieves the alpha and RGB unpremultiplied. RGB are extended sRGB values (sRGB gamut, and encoded with the sRGB transfer function).

getFilterQuality(): FilterQuality

Returns the image filtering level. [deprecated] This will be removed in an upcoming release.

getStrokeCap(): StrokeCap

Returns the geometry drawn at the beginning and end of strokes.

getStrokeJoin(): StrokeJoin

Returns the geometry drawn at the corners of strokes.

getStrokeMiter(): number

Returns the limit at which a sharp corner is drawn beveled.

getStrokeWidth(): number

Returns the thickness of the pen used to outline the shape.

setAlphaf(alpha: number): void

Replaces alpha, leaving RGBA unchanged. 0 means fully transparent, 1.0 means opaque.

setAntiAlias(aa: boolean): void

Requests, but does not require, that edge pixels draw opaque or with partial transparency.

setBlendMode(mode: BlendMode): void

Sets the blend mode that is, the mode used to combine source color with destination color.

setColor(color: InputColor, colorSpace?: ColorSpace): void

Sets alpha and RGB used when stroking and filling. The color is four floating point values, unpremultiplied. The color values are interpreted as being in the provided colorSpace.

setColorComponents(
r: number,
g: number,
b: number,
a: number,
colorSpace?: ColorSpace,
): void

Sets alpha and RGB used when stroking and filling. The color is four floating point values, unpremultiplied. The color values are interpreted as being in the provided colorSpace.

setColorFilter(filter: SkColorFilter): void

Sets the current color filter, replacing the existing one if there was one.

setColorInt(color: SkColorInt, colorSpace?: ColorSpace): void

Sets the color used when stroking and filling. The color values are interpreted as being in the provided colorSpace.

setFilterQuality(quality: FilterQuality): void

Sets the image filtering level. [deprecated] This will be removed in an upcoming release.

setImageFilter(filter: SkImageFilter): void

Sets the current image filter, replacing the existing one if there was one.

setMaskFilter(filter: SkMaskFilter): void

Sets the current mask filter, replacing the existing one if there was one.

setPathEffect(effect: SkPathEffect): void

Sets the current path effect, replacing the existing one if there was one.

setShader(shader: SkShader): void

Sets the current shader, replacing the existing one if there was one.

setStrokeCap(cap: StrokeCap): void

Sets the geometry drawn at the beginning and end of strokes.

setStrokeJoin(join: StrokeJoin): void

Sets the geometry drawn at the corners of strokes.

setStrokeMiter(limit: number): void

Sets the limit at which a sharp corner is drawn beveled.

setStrokeWidth(width: number): void

Sets the thickness of the pen used to outline the shape.

setStyle(style: PaintStyle): void

Sets whether the geometry is filled or stroked.