Bitmap.d overview
Table of contents
- utils
- Bitmap (class)
- load (static method)
- snap (static method)
- isReady (method)
- isError (method)
- destroy (method)
- resize (method)
- blt (method)
- getPixel (method)
- getAlphaPixel (method)
- clearRect (method)
- clear (method)
- fillRect (method)
- fillAll (method)
- strokeRect (method)
- gradientFillRect (method)
- drawCircle (method)
- drawText (method)
- measureTextWidth (method)
- addLoadListener (method)
- retry (method)
- _makeFontNameText (method)
- _drawTextOutline (method)
- _drawTextBody (method)
- _createCanvas (method)
- _ensureCanvas (method)
- _destroyCanvas (method)
- _createBaseTexture (method)
- _updateScaleMode (method)
- _startLoading (method)
- _startDecrypting (method)
- _onXhrLoad (method)
- _onLoad (method)
- _callLoadListeners (method)
- _onError (method)
- _canvas (property)
- _context (property)
- _baseTexture (property)
- _image (property)
- _url (property)
- _paintOpacity (property)
- _smooth (property)
- _loadListeners (property)
- _loadingState (property)
- fontFace (property)
- fontSize (property)
- fontBold (property)
- fontItalic (property)
- textColor (property)
- outlineColor (property)
- outlineWidth (property)
- Bitmap (class)
utils
Bitmap (class)
The basic object that represents an image.
Signature
export declare class Bitmap {
constructor(width?: number, height?: number)
}
load (static method)
Loads a image file.
Signature
static load(url: string): Bitmap
snap (static method)
Takes a snapshot of the game screen.
Signature
static snap(stage: Stage): Bitmap
isReady (method)
Checks whether the bitmap is ready to render.
Signature
isReady(): boolean
isError (method)
Checks whether a loading error has occurred.
Signature
isError(): boolean
destroy (method)
Destroys the bitmap.
Signature
destroy(): void
resize (method)
Resizes the bitmap.
Signature
resize(width: number, height: number): void
blt (method)
Performs a block transfer.
Signature
blt(
source: Bitmap,
sx: number,
sy: number,
sw: number,
sh: number,
dx: number,
dy: number,
dw?: number,
dh?: number
): void
getPixel (method)
Returns pixel color at the specified point.
Signature
getPixel(x: number, y: number): string
getAlphaPixel (method)
Returns alpha pixel value at the specified point.
Signature
getAlphaPixel(x: number, y: number): number
clearRect (method)
Clears the specified rectangle.
Signature
clearRect(x: number, y: number, width: number, height: number): void
clear (method)
Clears the entire bitmap.
Signature
clear(): void
fillRect (method)
Fills the specified rectangle.
Signature
fillRect(x: number, y: number, width: number, height: number, color: string): void
fillAll (method)
Fills the entire bitmap.
Signature
fillAll(color: string): void
strokeRect (method)
Draws the specified rectangular frame.
Signature
strokeRect(x: number, y: number, width: number, height: number, color: string): void
gradientFillRect (method)
Draws the rectangle with a gradation.
Signature
gradientFillRect(
x: number,
y: number,
width: number,
height: number,
color1: string,
color2: string,
vertical?: boolean
): void
drawCircle (method)
Draws a bitmap in the shape of a circle.
Signature
drawCircle(x: number, y: number, radius: number, color: string): void
drawText (method)
Draws the outline text to the bitmap.
Signature
drawText(
text: string,
x: number,
y: number,
maxWidth: number,
lineHeight: number,
align?: CanvasTextAlign
): void
measureTextWidth (method)
Returns the width of the specified text.
Signature
measureTextWidth(text: string): number
addLoadListener (method)
Adds a callback function that will be called when the bitmap is loaded.
Signature
addLoadListener(listner: (bitmap: Bitmap) => void): void
retry (method)
Tries to load the image again.
Signature
retry(): void
_makeFontNameText (method)
Signature
_makeFontNameText(): string
_drawTextOutline (method)
Signature
_drawTextOutline(text: string, tx: number, ty: number, maxWidth: number): void
_drawTextBody (method)
Signature
_drawTextBody(text: string, tx: number, ty: number, maxWidth: number): void
_createCanvas (method)
Signature
_createCanvas(width: number, height: number): void
_ensureCanvas (method)
Signature
_ensureCanvas(): void
_destroyCanvas (method)
Signature
_destroyCanvas(): void
_createBaseTexture (method)
Signature
_createBaseTexture(source: HTMLImageElement | HTMLCanvasElement): void
_updateScaleMode (method)
Signature
_updateScaleMode(): void
_startLoading (method)
Signature
_startLoading(): void
_startDecrypting (method)
Signature
_startDecrypting(): void
_onXhrLoad (method)
Signature
_onXhrLoad(xhr: XMLHttpRequest): void
_onLoad (method)
Signature
_onLoad(): void
_callLoadListeners (method)
Signature
_callLoadListeners(): void
_onError (method)
Signature
_onError(): void
_canvas (property)
Signature
_canvas: HTMLCanvasElement | null
_context (property)
Signature
_context: CanvasRenderingContext2D | null
_baseTexture (property)
Signature
_baseTexture: any
_image (property)
Signature
_image: HTMLImageElement | null
_url (property)
Signature
_url: string
_paintOpacity (property)
Signature
_paintOpacity: number
_smooth (property)
Signature
_smooth: boolean
_loadListeners (property)
Signature
_loadListeners: ((bitmap: Bitmap) => void)[]
_loadingState (property)
Signature
_loadingState: string
fontFace (property)
The face name of the font.
Signature
fontFace: string
fontSize (property)
The size of the font in pixels.
Signature
fontSize: number
fontBold (property)
Whether the font is bold.
Signature
fontBold: boolean
fontItalic (property)
Whether the font is italic.
Signature
fontItalic: boolean
textColor (property)
The color of the text in CSS format.
Signature
textColor: string
outlineColor (property)
The color of the outline of the text in CSS format.
Signature
outlineColor: string
outlineWidth (property)
The width of the outline of the text.
Signature
outlineWidth: number