BitmapData#copyRect()

copyRect(source, area, x, y, alpha, blendMode, roundPx) → {Phaser.BitmapData}

Copies the area defined by the Rectangle parameter from the source image to this BitmapData at the given location.

Parameters
Name Type Argument Default Description
source Phaser.Sprite | Phaser.Image | Phaser.Text | Phaser.BitmapData | Phaser.RenderTexture | Image | string

The Image to copy from. If you give a string it will try and find the Image in the Game.Cache.

area Phaser.Rectangle

The Rectangle region to copy from the source image.

x number

The destination x coordinate to copy the image to.

y number

The destination y coordinate to copy the image to.

alpha number <optional>
1

The alpha that will be set on the context before drawing. A value between 0 (fully transparent) and 1, opaque.

blendMode string <optional>
null

The composite blend mode that will be used when drawing. The default is no blend mode at all. This is a Canvas globalCompositeOperation value such as 'lighter' or 'xor'.

roundPx boolean <optional>
false

Should the x and y values be rounded to integers before drawing? This prevents anti-aliasing in some instances.

Returns

This BitmapData object for method chaining.

Source code: gameobjects/BitmapData.js (Line 1534)
doc_phaser
2017-02-14 10:36:52
Comments
Leave a Comment

Please login to continue.