- 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
import { Texture } from '@pixi/core';
import type { Matrix } from '@pixi/math';
/**
 * Fill style object for Graphics.
 * @memberof PIXI
 */
export class FillStyle
{
    /**
     * The hex color value used when coloring the Graphics object.
     * @default 0xFFFFFF
     */
    public color = 0xFFFFFF;
    /** The alpha value used when filling the Graphics object. */
    public alpha = 1.0;
    /**
     * The texture to be used for the fill.
     * @default 0
     */
    public texture: Texture = Texture.WHITE;
    /**
     * The transform applied to the texture.
     * @default null
     */
    public matrix: Matrix = null;
    /** If the current fill is visible. */
    public visible = false;
    constructor()
    {
        this.reset();
    }
    /** Clones the object */
    public clone(): FillStyle
    {
        const obj = new FillStyle();
        obj.color = this.color;
        obj.alpha = this.alpha;
        obj.texture = this.texture;
        obj.matrix = this.matrix;
        obj.visible = this.visible;
        return obj;
    }
    /** Reset */
    public reset(): void
    {
        this.color = 0xFFFFFF;
        this.alpha = 1;
        this.texture = Texture.WHITE;
        this.matrix = null;
        this.visible = false;
    }
    /** Destroy and don't use after this. */
    public destroy(): void
    {
        this.texture = null;
        this.matrix = null;
    }
}