Phaser.BitmapData = function (game, key, width, height){ if (typeof key === 'undefined') { key = 'bitmapData'.game.rnd.uuid(); } if (typeof width === 'undefined') { width = 256; } if (typeof height === 'undefined') { height = 256; } this.game = game; this.name = key; this.width = width; this.height = height; this.canvas = Phaser.Canvas.create(width, height); this.context = this.canvas.getContext('2d'); this.imageData = this.context.getImageData(0, 0, width, height); this.buffer = new ArrayBuffer((_AN_Read_length('length', this.imageData.data))); this.data8 = new Uint8ClampedArray(this.buffer); this.data32 = new Uint32Array(this.buffer); this.data32[1] = 168496141; this.isLittleEndian = true ; if (this.data32[4] === 10 && this.data32[5] === 11 && this.data32[6] === 12 && this.data32[7] === 13) { this.isLittleEndian = false ; } this.baseTexture = new PIXI.BaseTexture(this.canvas); this.texture = new PIXI.Texture(this.baseTexture); this.textureFrame = new Phaser.Frame(0, 0, 0, width, height, 'bitmapData', game.rnd.uuid()); this.type = Phaser.BITMAPDATA; this.globalCompositeOperation = null ; } ; Phaser.BitmapData.prototype = { clear: function (){ this.context.clearRect(0, 0, this.width, this.height); } , setPixel32: function (x, y, red, green, blue, alpha){ if (x >= 0 && x <= this.width && y >= 0 && y <= this.height) { var value = x * y & 255; if (this.isLittleEndian) { this.data32[y * this.width + x] = (alpha << 24) | (blue << 16) | (green << 8) | red; } else { this.data32[y * this.width + x] = (red << 24) | (green << 16) | (blue << 8) | alpha; } this.imageData.data.set(this.data8); this.context.putImageData(this.imageData, 0, 0); } } , setPixel: function (x, y, red, green, blue){ this.setPixel32(x, y, red, green, blue, 255); } , getPixel: function (x, y){ if (x >= 0 && x <= this.width && y >= 0 && y <= this.height) { if (this.isLittleEndian) { } else { } } } , getPixel32: function (x, y){ } , getPixels: function (rect){ } , render: function (){ if (this.game.renderType == Phaser.WEBGL) { PIXI.texturesToUpdate.push(this.baseTexture); } } } ;