int
getPixel32(num x, num y)
Source
int getPixel32(num x, num y) {
int r = 0, g = 0, b = 0, a = 0;
var rectangle = new Rectangle<num>(x, y, 1, 1);
var renderTextureQuad = this.bitmapData.renderTextureQuad.clip(rectangle);
if (renderTextureQuad.sourceRectangle.isEmpty) return Color.Transparent;
var isLittleEndianSystem = env.isLittleEndianSystem;
var imageData = renderTextureQuad.getImageData();
var pixels = imageData.width * imageData.height;
var data = imageData.data;
for (int i = 0; i <= data.length - 4; i += 4) {
r += isLittleEndianSystem ? data[i + 0] : data[i + 3];
g += isLittleEndianSystem ? data[i + 1] : data[i + 2];
b += isLittleEndianSystem ? data[i + 2] : data[i + 1];
a += isLittleEndianSystem ? data[i + 3] : data[i + 0];
}
r = r ~/ pixels;
g = g ~/ pixels;
b = b ~/ pixels;
a = a ~/ pixels;
return (a << 24) + (r << 16) + (g << 8) + b;
}