springroll.easeljs.BitmapUtils Class

Designed to provide utility related to Bitmaps.

bitmapFromTexture

(
  • texture
  • scale
)
static

Creates a faux Bitmap from a TextureAtlas entry.

Parameters:

  • texture Texture

    The texture from a TextureAtlas to create the Bitmap analogue from.

  • scale Number

    A scale for the spritesheet to undo, e.g. a half sized spritesheet gets a scale of 2 to restore it to normal size.

loadSpriteSheet

(
  • spritesheetData
  • spritesheetImage
  • [scale=1]
  • [libName='lib']
)
static

Defined in loadSpriteSheet:18

Replaces Bitmaps in the global lib dictionary with a faux Bitmap that pulls the image from a spritesheet. This function should be called after you have loaded up javascript assets exported from Flash, but before you have instantiated those assets.

Parameters:

  • spritesheetData Object

    The JSON object describing the frames in the atlas. This is expected to fit the JSON Hash format as exported from TexturePacker.

  • spritesheetImage Image | HTMLCanvasElement

    The spritesheet image that contains all of the frames.

  • [scale=1] Number optional

    The scale to apply to all sprites from the spritesheet. For example, a half sized spritesheet should have a scale of 2.

  • [libName='lib'] String optional

    The global dictionary to add items to.

replaceWithScaledBitmap

(
  • idOrDict
  • [scale=1]
  • [libName='lib']
)
static

Replaces Bitmaps in the global lib dictionary with a faux Bitmap that uses a scaled bitmap, so you can load up smaller bitmaps behind the scenes that are scaled back up to normal size, or high res bitmaps that are scaled down.

Parameters:

  • idOrDict String | Object

    A dictionary of Bitmap ids to replace, or a single id.

  • [scale=1] Number optional

    The scale to apply to the image(s).

  • [libName='lib'] String optional

    The global dictionary to add items to.