Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Bitmap

Hierarchy

  • Bitmap

Index

Constructors

constructor

  • new Bitmap(): Bitmap
  • new Bitmap(width: number, height: number): Bitmap

Properties

Protected _baseTexture

_baseTexture: BaseTexture

Protected _canvas

_canvas: HTMLCanvasElement

Protected _context

_context: CanvasRenderingContext2D

Protected _hasError

_hasError: boolean

Protected _image

_image: HTMLImageElement

Protected _isLoading

_isLoading: boolean

Protected _loadListeners

_loadListeners: function

Type declaration

    • (): void
    • Returns void

Protected _paintOpacity

_paintOpacity: number

Protected _smooth

_smooth: boolean

Protected _url

_url: string

baseTexture

baseTexture: BaseTexture

[read-only] The base texture that holds the image.

property

baseTexture

type

PIXI.BaseTexture

cacheEntry

cacheEntry: CacheEntry

Cache entry, for images. In all cases _url is the same as cacheEntry.key

type

CacheEntry

canvas

canvas: HTMLCanvasElement

[read-only] The bitmap canvas.

property

canvas

type

HTMLCanvasElement

context

context: CanvasRenderingContext2D

[read-only] The 2d context of the bitmap canvas.

property

context

type

CanvasRenderingContext2D

fontFace

fontFace: string

The face name of the font.

property

fontFace

type

String

fontItalic

fontItalic: number

Whether the font is italic.

property

fontItalic

type

Boolean

fontSize

fontSize: number

The size of the font in pixels.

property

fontSize

type

Number

height

height: number

[read-only] The height of the bitmap.

property

height

type

Number

outlineColor

outlineColor: string

The color of the outline of the text in CSS format.

property

outlineColor

type

String

outlineWidth

outlineWidth: number

The width of the outline of the text.

property

outlineWidth

type

Number

paintOpacity

paintOpacity: number

The opacity of the drawing object in the range (0, 255).

property

paintOpacity

type

Number

rect

rect: Rectangle

[read-only] The rectangle of the bitmap.

property

rect

type

Rectangle

smooth

smooth: boolean

Whether the smooth scaling is applied.

property

smooth

type

Boolean

textColor

textColor: string

The color of the text in CSS format.

property

textColor

type

String

url

url: string

[read-only] The url of the image file.

property

url

type

String

width

width: number

[read-only] The width of the bitmap.

property

width

type

Number

Methods

Private _callLoadListeners

  • _callLoadListeners(): void

Private _drawTextBody

  • _drawTextBody(text: string, tx: number, ty: number, maxWidth: number): void

Private _drawTextOutline

  • _drawTextOutline(text: number, tx: number, ty: number, maxWidth: number): void

Private _makeFontNameText

  • _makeFontNameText(): string

Private _onError

  • _onError(): void

Private _onLoad

  • _onLoad(): void

Private _setDirty

  • _setDirty(): void

addLoadListener

  • addLoadListener(listner: function): void
  • Add a callback function that will be called when the bitmap is loaded.

    method

    addLoadListener

    Parameters

    • listner: function

      The callback function

        • (): void
        • Returns void

    Returns void

adjustTone

  • adjustTone(r: number, g: number, b: number): void
  • Changes the color tone of the entire bitmap.

    method

    adjustTone

    Parameters

    • r: number

      The red strength in the range (-255, 255)

    • g: number

      The green strength in the range (-255, 255)

    • b: number

      The blue strength in the range (-255, 255)

    Returns void

blt

  • blt(source: Bitmap, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw?: number, dh?: number): void
  • Performs a block transfer.

    method

    blt

    Parameters

    • source: Bitmap

      The bitmap to draw

    • sx: number

      The x coordinate in the source

    • sy: number

      The y coordinate in the source

    • sw: number

      The width of the source image

    • sh: number

      The height of the source image

    • dx: number

      The x coordinate in the destination

    • dy: number

      The y coordinate in the destination

    • Optional dw: number
    • Optional dh: number

    Returns void

bltImage

  • bltImage(source: Bitmap, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void
  • Performs a block transfer, using assumption that original image was not modified (no hue)

    method

    blt

    Parameters

    • source: Bitmap

      The bitmap to draw

    • sx: number

      The x coordinate in the source

    • sy: number

      The y coordinate in the source

    • sw: number

      The width of the source image

    • sh: number

      The height of the source image

    • dx: number

      The x coordinate in the destination

    • dy: number

      The y coordinate in the destination

    • dw: number
    • dh: number

    Returns void

blur

  • blur(): void

clear

  • clear(): void

clearRect

  • clearRect(x: number, y: number, width: number, height: number): void
  • Clears the specified rectangle.

    method

    clearRect

    Parameters

    • x: number

      The x coordinate for the upper-left corner

    • y: number

      The y coordinate for the upper-left corner

    • width: number

      The width of the rectangle to clear

    • height: number

      The height of the rectangle to clear

    Returns void

drawCircle

  • drawCircle(x: number, y: number, radius: number, color: string): void
  • Draw the filled circle.

    method

    drawCircle

    Parameters

    • x: number

      The x coordinate of the center of the circle

    • y: number

      The y coordinate of the center of the circle

    • radius: number

      The radius of the circle

    • color: string

      The color of the circle in CSS format

    Returns void

drawText

  • drawText(text: string, x: number, y: number, maxWidth: number, lineHeight: number, align: string): void
  • Draws the outline text to the bitmap.

    method

    drawText

    Parameters

    • text: string

      The text that will be drawn

    • x: number

      The x coordinate for the left of the text

    • y: number

      The y coordinate for the top of the text

    • maxWidth: number

      The maximum allowed width of the text

    • lineHeight: number

      The height of the text line

    • align: string

      The alignment of the text

    Returns void

fillAll

  • fillAll(color: string): void
  • Fills the entire bitmap.

    method

    fillAll

    Parameters

    • color: string

      The color of the rectangle in CSS format

    Returns void

fillRect

  • fillRect(x: number, y: number, width: number, height: number, color: string): void
  • Fills the specified rectangle.

    method

    fillRect

    Parameters

    • x: number

      The x coordinate for the upper-left corner

    • y: number

      The y coordinate for the upper-left corner

    • width: number

      The width of the rectangle to clear

    • height: number

      The height of the rectangle to clear

    • color: string

      The color of the rectangle in CSS format

    Returns void

getAlphaPixel

  • getAlphaPixel(x: number, y: number): string
  • Returns alpha pixel value at the specified point.

    method

    getAlphaPixel

    Parameters

    • x: number

      The x coordinate of the pixel in the bitmap

    • y: number

      The y coordinate of the pixel in the bitmap

    Returns string

    The alpha value

getPixel

  • getPixel(x: number, y: number): string
  • Returns pixel color at the specified point.

    method

    getPixel

    Parameters

    • x: number

      The x coordinate of the pixel in the bitmap

    • y: number

      The y coordinate of the pixel in the bitmap

    Returns string

    The pixel color (hex format)

gradientFillRect

  • gradientFillRect(x: number, y: number, width: number, height: number, color1: string, color2: string, vertical?: boolean): void
  • Draws the rectangle with a gradation.

    method

    gradientFillRect

    Parameters

    • x: number

      The x coordinate for the upper-left corner

    • y: number

      The y coordinate for the upper-left corner

    • width: number

      The width of the rectangle to clear

    • height: number

      The height of the rectangle to clear

    • color1: string

      The start color of the gradation

    • color2: string

      The end color of the gradation

    • Optional vertical: boolean

      Whether it draws a vertical gradient

    Returns void

isError

  • isError(): boolean

isReady

  • isReady(): boolean
  • Checks whether the bitmap is ready to render.

    method

    isReady

    Returns boolean

    True if the bitmap is ready to render

measureTextWidth

  • measureTextWidth(text: string): number
  • Returns the width of the specified text.

    method

    measureTextWidth

    Parameters

    • text: string

      The text to be measured

    Returns number

    The width of the text in pixels

resize

  • resize(width: number, height: number): void
  • Resizes the bitmap.

    method

    resize

    Parameters

    • width: number

      The new width of the bitmap

    • height: number

      The new height of the bitmap

    Returns void

rotateHue

  • rotateHue(offset: number): void
  • Rotates the hue of the entire bitmap.

    method

    rotateHue

    Parameters

    • offset: number

      The hue offset in 360 degrees

    Returns void

touch

  • touch(): void

Static load

  • Loads a image file and returns a new bitmap object.

    static
    method

    load

    Parameters

    • url: string

      The image url of the texture

    Returns Bitmap

    Bitmap

Static snap

Generated using TypeDoc