Skip to content

Commit 62c8705

Browse files
committed
Merge pull request phaserjs#1985 from yahiko00/master
Extra documentation and TypeScript definition file update
2 parents 534f6ff + 0416c6a commit 62c8705

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

docs/Phaser.BitmapData.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1886,7 +1886,8 @@ <h3 class="subsection-title">Members</h3>
18861886

18871887

18881888
<div class="description">
1889-
<p>The context image data.</p>
1889+
<p>The context image data.
1890+
Please note that a call to BitmapData.draw() or BitmapData.copy() does not update this property for performance reason. Use BitmapData.update() to do so.</p>
18901891
</div>
18911892

18921893

src/gameobjects/BitmapData.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ Phaser.BitmapData = function (game, key, width, height) {
6161

6262
/**
6363
* @property {ImageData} imageData - The context image data.
64+
* Please note that a call to BitmapData.draw() or BitmapData.copy() does not update immediately this property for performance reason. Use BitmapData.update() to do so.
65+
* This property is updated automatically after the first game loop, according to the dirty flag property.
6466
*/
6567
this.imageData = this.context.getImageData(0, 0, width, height);
6668

typescript/phaser.d.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ declare module Phaser {
422422
addBitmapFont(key: string, url: string, data: any, atlasData: any, atlasType: string, xSpacing?: number, ySpacing?: number): void;
423423
addCanvas(key: string, canvas: HTMLCanvasElement, context?: CanvasRenderingContext2D): void;
424424
addDefaultImage(): void;
425-
addImage(key: string, url: string, data: any): void;
425+
addImage(key: string, url: string, data: any): Phaser.CachedImage;
426426
addJSON(key: string, urL: string, data: any): void;
427427
addMissingImage(): void;
428428
addPhysicsData(key: string, url: string, JSONData: any, format: number): void;
@@ -466,7 +466,7 @@ declare module Phaser {
466466
getFrameByName(key: string, name: string, cache?: number): Phaser.Frame;
467467
getFrameCount(key: string, cache?: number): number;
468468
getFrameData(key: string, cache?: number): Phaser.FrameData;
469-
getImage(key: string, full?: boolean): Phaser.Image;
469+
getImage(key: string, full?: boolean): Phaser.CachedImage;
470470
getItem(key: string, cache: number, method?: string, property?: string): any;
471471
getJSON(key: string, clone?: boolean): any;
472472
getKeys(cache: number): string[];
@@ -514,6 +514,17 @@ declare module Phaser {
514514
updateSound(key: string, property: string, value: Phaser.Sound): void;
515515

516516
}
517+
518+
interface CachedImage {
519+
520+
key: string,
521+
url: string,
522+
data: HTMLImageElement,
523+
base: PIXI.BaseTexture,
524+
frame: Phaser.Frame,
525+
frameData: Phaser.FrameData
526+
527+
}
517528

518529
class Camera {
519530

0 commit comments

Comments
 (0)