Constructors
constructor
- new TextureBase<type>(type: "image", dataType: DataType, texture: HTMLImageElement, w: number, h: number): TextureBase<type>
- new TextureBase<type>(type: "color", dataType: DataType, texture: string, w: number, h: number): TextureBase<type>
- new TextureBase<type>(type: "either", dataType: DataType, texture: string | HTMLImageElement, w: number, h: number): TextureBase<type>
Type parameters
Parameters
type: "image"
texture: HTMLImageElement
w: number
h: number
Type parameters
Parameters
type: "color"
texture: string
w: number
h: number
Type parameters
Parameters
type: "either"
texture: string | HTMLImageElement
w: number
h: number
Properties
texture
texture
: type extends "image" ? HTMLImageElement : type extends "either" ? string | HTMLImageElement : stringMethods
setFillColor
- setFillColor(color: string | number): void
setImagePath
- setImagePath(imagePath: string): void
Static fromColor
- fromColor(color: string, w: number, h: number): TextureBase<"color">
Parameters
color: string
w: number
h: number
Static fromEither
- fromEither(fillColorOrIMGPath: string, w: number, h: number): TextureBase<"either">
Parameters
fillColorOrIMGPath: string
w: number
h: number
Static fromTexture
- fromTexture(imgpath: string, w: number, h: number): TextureBase<"image">
Parameters
imgpath: string
w: number
h: number
Creates an image texture
2.1.0