Hierarchy

  • ClipMask

Properties

rect: Rect
src_url?: string

file path of the source image, or base64 data uri
if a base64 data uri is provided, then once it has been turned trasnparent and converted into this.data_uri, this.src_url will be deleted
at any given time, one of either this.src_url or this.data_blob will be present

data_blob?: Blob

Constructors

  • Parameters

    • Optional src_url: string
    • Optional rect: Partial<Rect>

    Returns ClipMask

Methods

  • load an image from a local path or url, such as: "./bitmasks/juice.png" or "https://picsum.photos/200/300?grayscale"

    Parameters

    • src_url: string
    • rect: Partial<Rect>

    Returns Promise<void>

  • load an image from a string of data uri, such as: "data:image/gif;base64,R0l..."

    Parameters

    • data_uri: string
    • rect: Partial<Rect>

    Returns Promise<void>

  • load an image from a Uint8Array of RGBA pixels. the width and height must be defined in the passed rect

    Parameters

    • buf: Uint8Array | Uint8ClampedArray
    • rect: {
          x?: number;
          y?: number;
          width: number;
          height: number;
      }
      • Optional x?: number
      • Optional y?: number
      • width: number
      • height: number

    Returns Promise<void>

  • turn the provided buffer of pixels to become transparent where a black pixel is present

    Parameters

    • buf: Uint8Array | Uint8ClampedArray

    Returns Uint8ClampedArray

  • Returns undefined

  • Parameters

    • img: CanvasImageSource

    Returns Promise<OffscreenCanvas>

Generated using TypeDoc