Class RectangleLayer

const { LazyCanvas, RectangleLayer } = require('@hitomihiumi/lazy-canvas')

let rectangle = new RectangleLayer()
.setX(10)
.setY(10)
.setWidth(200)
.setHeight(100)
.setColor('#FF0000')

const lazy = new LazyCanvas()
.addLayers(rectangle)
//...

Hierarchy (view full)

Constructors

Properties

Methods

  • Parameters

    • operation:
          | "color"
          | "source-over"
          | "source-in"
          | "source-out"
          | "source-atop"
          | "destination-over"
          | "destination-in"
          | "destination-out"
          | "destination-atop"
          | "lighter"
          | "copy"
          | "xor"
          | "multiply"
          | "screen"
          | "overlay"
          | "darken"
          | "lighten"
          | "color-dodge"
          | "color-burn"
          | "hard-light"
          | "soft-light"
          | "difference"
          | "exclusion"
          | "hue"
          | "saturation"
          | "luminosity"

      The global composite operation of the layer

    Returns RectangleLayer

  • Returns {
        align:
            | "left"
            | "center"
            | "right"
            | "start"
            | "end";
        alpha: number;
        angle: number;
        angles: number[];
        baseline:
            | "alphabetic"
            | "top"
            | "hanging"
            | "middle"
            | "ideographic"
            | "bottom";
        centering: "legacy" | "new";
        clockwise: boolean;
        color: string | Gradient | Pattern;
        controlPoint: {
            x: number;
            y: number;
        };
        controlPoints: {
            x: number;
            y: number;
        }[];
        direction: "ltr" | "rtl" | "inherit";
        fill: boolean;
        filter: Filter;
        font: string;
        globalComposite:
            | "color"
            | "source-over"
            | "source-in"
            | "source-out"
            | "source-atop"
            | "destination-over"
            | "destination-in"
            | "destination-out"
            | "destination-atop"
            | "lighter"
            | "copy"
            | "xor"
            | "multiply"
            | "screen"
            | "overlay"
            | "darken"
            | "lighten"
            | "color-dodge"
            | "color-burn"
            | "hard-light"
            | "soft-light"
            | "difference"
            | "exclusion"
            | "hue"
            | "saturation"
            | "luminosity";
        height: number;
        image: string | Uint8Array;
        lineDash: number[];
        multiline: boolean;
        outline: LazyCanvasOutline;
        points: {
            x: number;
            y: number;
        }[];
        radius: number;
        rotation: number;
        shadow: {
            shadowBlur: number;
            shadowColor: string | Gradient | Pattern;
            shadowOffsetX: number;
            shadowOffsetY: number;
        };
        sides: number;
        size: number;
        stroke: number;
        structureType: string;
        text: string;
        type: string;
        weight:
            | "normal"
            | "bold"
            | "italic"
            | "bold italic"
            | "regular"
            | "semi-bold"
            | "extra-bold"
            | "light"
            | "extra-light";
        width: number;
        x: number;
        y: number;
        toJSON(): LazyCanvasLayer;
    }

    • align:
          | "left"
          | "center"
          | "right"
          | "start"
          | "end"
    • alpha: number
    • angle: number
    • angles: number[]
    • baseline:
          | "alphabetic"
          | "top"
          | "hanging"
          | "middle"
          | "ideographic"
          | "bottom"
    • centering: "legacy" | "new"
    • clockwise: boolean
    • color: string | Gradient | Pattern
    • controlPoint: {
          x: number;
          y: number;
      }
      • x: number
      • y: number
    • controlPoints: {
          x: number;
          y: number;
      }[]
    • direction: "ltr" | "rtl" | "inherit"
    • fill: boolean
    • filter: Filter
    • font: string
    • globalComposite:
          | "color"
          | "source-over"
          | "source-in"
          | "source-out"
          | "source-atop"
          | "destination-over"
          | "destination-in"
          | "destination-out"
          | "destination-atop"
          | "lighter"
          | "copy"
          | "xor"
          | "multiply"
          | "screen"
          | "overlay"
          | "darken"
          | "lighten"
          | "color-dodge"
          | "color-burn"
          | "hard-light"
          | "soft-light"
          | "difference"
          | "exclusion"
          | "hue"
          | "saturation"
          | "luminosity"
    • height: number
    • image: string | Uint8Array
    • lineDash: number[]
    • multiline: boolean
    • outline: LazyCanvasOutline
    • points: {
          x: number;
          y: number;
      }[]
    • radius: number
    • rotation: number
    • shadow: {
          shadowBlur: number;
          shadowColor: string | Gradient | Pattern;
          shadowOffsetX: number;
          shadowOffsetY: number;
      }
      • shadowBlur: number
      • shadowColor: string | Gradient | Pattern
      • shadowOffsetX: number
      • shadowOffsetY: number
    • sides: number
    • size: number
    • stroke: number
    • structureType: string
    • text: string
    • type: string
    • weight:
          | "normal"
          | "bold"
          | "italic"
          | "bold italic"
          | "regular"
          | "semi-bold"
          | "extra-bold"
          | "light"
          | "extra-light"
    • width: number
    • x: number
    • y: number
    • toJSON:function