liusuyi
2023-04-24 4737f1e038743ced243c9e52423404d9034d6107
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { RectLike } from '../core/BoundingRect';
import Displayable from './Displayable';
import { VectorArray } from '../core/vector';
import { Dictionary, PropType, TextVerticalAlign, ImageLike, TextAlign } from '../core/types';
import { LinearGradientObject } from './LinearGradient';
import { RadialGradientObject } from './RadialGradient';
import { PatternObject } from './Pattern';
import { GradientObject } from './Gradient';
export declare class TextStyleOption {
    text?: string;
    textFill?: string | PatternObject | LinearGradientObject | RadialGradientObject;
    textStroke?: string | PatternObject | LinearGradientObject | RadialGradientObject;
    textStrokeWidth?: number;
    font?: string;
    textFont?: string;
    fontStyle?: string;
    fontWeight?: string;
    fontFamily?: string;
    fontSize?: number;
    textAlign?: TextAlign;
    textVerticalAlign?: TextVerticalAlign;
    textBaseline?: TextVerticalAlign;
    textLineHeight?: number;
    textWidth?: number | string;
    textHeight?: number;
    textTag?: string;
    textShadowColor?: string;
    textShadowBlur?: number;
    textShadowOffsetX?: number;
    textShadowOffsetY?: number;
    textBackgroundColor?: string | {
        image: ImageLike | string;
    };
    textPadding?: number | number[];
    textBorderColor?: string;
    textBorderWidth?: number;
    textBorderRadius?: number | number[];
    textBoxShadowColor?: string;
    textBoxShadowBlur?: number;
    textBoxShadowOffsetX?: number;
    textBoxShadowOffsetY?: number;
}
export declare class StyleOption extends TextStyleOption {
    x?: number;
    y?: number;
    fill?: string | PatternObject | LinearGradientObject | RadialGradientObject;
    stroke?: string | PatternObject | LinearGradientObject | RadialGradientObject;
    opacity?: number;
    fillOpacity?: number;
    strokeOpacity?: number;
    lineDash?: false | number[];
    lineDashOffset?: number;
    shadowBlur?: number;
    shadowOffsetX?: number;
    shadowOffsetY?: number;
    shadowColor?: string;
    lineWidth?: number;
    lineCap?: CanvasLineCap;
    lineJoin?: CanvasLineJoin;
    miterLimit?: number;
    strokeNoScale?: boolean;
    text?: string;
    textPosition?: string | number[];
    textRect?: RectLike;
    textOffset?: number[];
    textDistance?: number;
    transformText?: boolean;
    textRotation?: number;
    textOrigin?: 'center' | VectorArray;
    textPadding?: number | number[];
    rich?: Dictionary<TextStyleOption>;
    truncate?: {
        outerWidth?: number;
        outerHeight?: number;
        ellipsis?: string;
        placeholder?: string;
        minChar?: number;
    };
    blend?: string;
}
declare type StyleKey = keyof StyleOption;
declare type StyleValueType = PropType<StyleOption, StyleKey>;
export default class Style extends StyleOption {
    constructor(opts?: StyleOption);
    bind(ctx: CanvasRenderingContext2D, el: Displayable, prevEl: Displayable): void;
    hasFill(): boolean;
    hasStroke(): boolean;
    extendFrom(otherStyle: StyleOption, overwrite?: boolean): void;
    set(obj: StyleOption | StyleKey, value?: StyleValueType): void;
    clone(): Style;
    static getGradient(ctx: CanvasRenderingContext2D, obj: GradientObject, rect: RectLike): CanvasGradient;
    private static initDefaultProps;
}
export {};