canvg
Namespaces​
Classes​
- BoundingBox
- Canvg
- AElement
- AnimateColorElement
- AnimateElement
- AnimateTransformElement
- CircleElement
- ClipPathElement
- DefsElement
- DescElement
- Document
- Element
- EllipseElement
- FeColorMatrixElement
- FeCompositeElement
- FeDropShadowElement
- FeGaussianBlurElement
- FeMorphologyElement
- FilterElement
- FontElement
- FontFaceElement
- GElement
- GlyphElement
- GradientElement
- ImageElement
- LineElement
- LinearGradientElement
- MarkerElement
- MaskElement
- MissingGlyphElement
- PathElement
- PatternElement
- PolygonElement
- PolylineElement
- RadialGradientElement
- RectElement
- RenderedElement
- SVGElement
- StopElement
- StyleElement
- SymbolElement
- TRefElement
- TSpanElement
- TextElement
- TextPathElement
- TitleElement
- UnknownElement
- UseElement
- Font
- Mouse
- Parser
- PathParser
- Point
- Property
- SVGFontLoader
- Screen
- Matrix
- Rotate
- Scale
- Skew
- SkewX
- SkewY
- Transform
- Translate
- ViewPort
Interfaces​
- IOptions
- IDocumentOptions
- IEvent
- IParserOptions
- IScreenOptions
- IScreenStartOptions
- IScreenViewBoxConfig
- IViewPortSize
Type Aliases​
CreateCanvas​
Ƭ CreateCanvas: (width
: number
, height
: number
) => HTMLCanvasElement
| OffscreenCanvas
& { getContext
: (contextId
: "2d"
) => OffscreenCanvasRenderingContext2D
}
Type declaration​
â–¸ (width
, height
): HTMLCanvasElement
| OffscreenCanvas
& { getContext
: (contextId
: "2d"
) => OffscreenCanvasRenderingContext2D
}
Function to create new canvas.
Parameters​
Name | Type |
---|---|
width | number |
height | number |
Returns​
HTMLCanvasElement
| OffscreenCanvas
& { getContext
: (contextId
: "2d"
) => OffscreenCanvasRenderingContext2D
}
Defined in​
CreateImage​
Ƭ CreateImage: (src
: string
, anonymousCrossOrigin?
: boolean
) => Promise
<CanvasImageSource
>
Type declaration​
â–¸ (src
, anonymousCrossOrigin?
): Promise
<CanvasImageSource
>
Function to create new image.
Parameters​
Name | Type |
---|---|
src | string |
anonymousCrossOrigin? | boolean |
Returns​
Promise
<CanvasImageSource
>
Defined in​
IViewBoxConfig​
Ƭ IViewBoxConfig: Omit
<IScreenViewBoxConfig
, "document"
>
Defined in​
AnyElement​
Ƭ AnyElement: Elements
[keyof Elements
]
Defined in​
CommandType​
Ƭ CommandType: SVGCommand
["type"
]
Defined in​
Command​
Ƭ Command: { type
: CommandType
} & Omit
<CommandM
, "type"
> & Omit
<CommandL
, "type"
> & Omit
<CommandH
, "type"
> & Omit
<CommandV
, "type"
> & Omit
<CommandZ
, "type"
> & Omit
<CommandQ
, "type"
> & Omit
<CommandT
, "type"
> & Omit
<CommandC
, "type"
> & Omit
<CommandS
, "type"
> & Omit
<CommandA
, "type"
>
Defined in​
Axis​
Ƭ Axis: "x"
| "y"
Defined in​
MatrixValue​
Ƭ MatrixValue: readonly [number
, number
, number
, number
, number
, number
]
Defined in​
VectorValue​
Ƭ VectorValue: readonly [number
, number
]
Defined in​
RenderingContext2D​
Ƭ RenderingContext2D: CanvasRenderingContext2D
| OffscreenCanvasRenderingContext2D
Defined in​
Fetch​
Ƭ Fetch: typeof __type
Defined in​
Variables​
elements​
• Const
elements: Object
Type declaration​
Name | Type |
---|---|
svg | typeof SVGElement |
rect | typeof RectElement |
circle | typeof CircleElement |
ellipse | typeof EllipseElement |
line | typeof LineElement |
polyline | typeof PolylineElement |
polygon | typeof PolygonElement |
path | typeof PathElement |
pattern | typeof PatternElement |
marker | typeof MarkerElement |
defs | typeof DefsElement |
linearGradient | typeof LinearGradientElement |
radialGradient | typeof RadialGradientElement |
stop | typeof StopElement |
animate | typeof AnimateElement |
animateColor | typeof AnimateColorElement |
animateTransform | typeof AnimateTransformElement |
font | typeof FontElement |
font-face | typeof FontFaceElement |
missing-glyph | typeof MissingGlyphElement |
glyph | typeof GlyphElement |
text | typeof TextElement |
tspan | typeof TSpanElement |
tref | typeof TRefElement |
a | typeof AElement |
textPath | typeof TextPathElement |
image | typeof ImageElement |
g | typeof GElement |
symbol | typeof SymbolElement |
style | typeof StyleElement |
use | typeof UseElement |
mask | typeof MaskElement |
clipPath | typeof ClipPathElement |
filter | typeof FilterElement |
feDropShadow | typeof FeDropShadowElement |
feMorphology | typeof FeMorphologyElement |
feComposite | typeof FeCompositeElement |
feColorMatrix | typeof FeColorMatrixElement |
feGaussianBlur | typeof FeGaussianBlurElement |
title | typeof TitleElement |
desc | typeof DescElement |
Defined in​
PSEUDO_ZERO​
• Const
PSEUDO_ZERO: 1e-8
Defined in​
Functions​
vectorMagnitude​
â–¸ vectorMagnitude(v
): number
Vector magnitude.
Parameters​
Name | Type |
---|---|
v | VectorValue |
Returns​
number
Number result.
Defined in​
vectorsRatio​
â–¸ vectorsRatio(u
, v
): number
Ratio between two vectors.
Parameters​
Name | Type |
---|---|
u | VectorValue |
v | VectorValue |
Returns​
number
Number result.
Defined in​
vectorsAngle​
â–¸ vectorsAngle(u
, v
): number
Angle between two vectors.
Parameters​
Name | Type |
---|---|
u | VectorValue |
v | VectorValue |
Returns​
number
Number result.
Defined in​
CB1​
â–¸ CB1(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
CB2​
â–¸ CB2(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
CB3​
â–¸ CB3(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
CB4​
â–¸ CB4(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
QB1​
â–¸ QB1(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
QB2​
â–¸ QB2(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
QB3​
â–¸ QB3(t
): number
Parameters​
Name | Type |
---|---|
t | number |
Returns​
number
Defined in​
compressSpaces​
â–¸ compressSpaces(str
): string
HTML-safe compress white-spaces.
Parameters​
Name | Type | Description |
---|---|---|
str | string | String to compress. |
Returns​
string
String.
Defined in​
trimLeft​
â–¸ trimLeft(str
): string
HTML-safe left trim.
Parameters​
Name | Type | Description |
---|---|---|
str | string | String to trim. |
Returns​
string
String.
Defined in​
trimRight​
â–¸ trimRight(str
): string
HTML-safe right trim.
Parameters​
Name | Type | Description |
---|---|---|
str | string | String to trim. |
Returns​
string
String.
Defined in​
toNumbers​
â–¸ toNumbers(str
): number
[]
String to numbers array.
Parameters​
Name | Type | Description |
---|---|---|
str | string | Numbers string. |
Returns​
number
[]
Numbers array.
Defined in​
toMatrixValue​
â–¸ toMatrixValue(str
): MatrixValue
String to matrix value.
Parameters​
Name | Type | Description |
---|---|---|
str | string | Numbers string. |
Returns​
Matrix value.
Defined in​
normalizeAttributeName​
â–¸ normalizeAttributeName(name
): string
Normalize attribute name.
Parameters​
Name | Type | Description |
---|---|---|
name | string | Attribute name. |
Returns​
string
Normalized attribute name.
Defined in​
parseExternalUrl​
â–¸ parseExternalUrl(url
): string
Parse external URL.
Parameters​
Name | Type | Description |
---|---|---|
url | string | CSS url string. |
Returns​
string
Parsed URL.
Defined in​
normalizeColor​
â–¸ normalizeColor(color
): string
Transform floats to integers in rgb colors.
Parameters​
Name | Type | Description |
---|---|---|
color | string | Color to normalize. |
Returns​
string
Normalized color.
Defined in​
getSelectorSpecificity​
â–¸ getSelectorSpecificity(selector
): string
Measure selector specificity.
Parameters​
Name | Type | Description |
---|---|---|
selector | string | Selector to measure. |
Returns​
string
Specificity.