Hello everyone,
I am working on a project where I need to draw pixels to a bitmap. I think I am doing it wrong because the color is completely off.
Here is the code I am using:
var r = target.transparentColor.r;
var g = target.transparentColor.g;
var b = target.transparentColor.b;
var data = new BitmapData(target.width, target.height, false,
AGIColorConverter.convertRGBAToInteger(r, g, b));
try {
// This draws correctly but the color is WAAAAAAAAAAAAY off!
for (x in 0...target.width) {
for (y in 0...target.height) {
var pixel = target.data[y * target.width + x];
data.setPixel32(x, y, pixel);
}
}
} catch (e:String) {
trace(e);
}
var bitmap = new Bitmap(data);
bitmap.scaleX = 4;
bitmap.scaleY = 4;
addChild(bitmap);
I am not sure what I am doing wrong but the colors I am drawing (such as rgb(168,0,0)) shows up way darker and more purple than they should be. I am building against windows. Is there a way to define the color space or perform RGB mapping on the bitmap?