Problem the BitmapData. Wrong colors on old device API10

Hello!
I’m stuck with problem the BitmapData. Colors from BitmapData a incorrectly displayed on old device.

device: samsung gt-6802
cpu: armv6 - compatible processor rev 5 (v6l)
id: gingerbread
version: 2.3.6
opengl supported: 2.0 / OpenGL ES-CM 1.1

Example:

//drew a rectangle filled with blue:
private var bitmap:Bitmap = new Bitmap(new BitmapData(width, heigh, false, 0x0000FF));

On the old device a rectangle doesn’t blue (0x0000FF), it’s red (0xFF0000). Color are reads backwards.
Green is green (0x00FF00 > 0x00FF00). Blue is red (0x0000FF > 0xFF0000). Red is blue. Any colors is backwards color, if it isn’t mirror. (as green (0x00FF00) or 0x321123.

Shape is correctly display colors. Problem only with BitmapData. Can it fixed (for specific device)?

Sorry for my “amazing” english.

It looks like a problem with Endian-ness. Devices can be big-endian or little-endian which means they read numbers from left to right or right to left. I can’t see any place where this is checked / accounted for in the OpenFL source and I’m not sure if / where a check would be required.

@singmajesty On a side note… what’s the trick to find the CPP code called from a lime_* library function in legacy? I track it as far as the ExternalInterface.cpp and then lose it. I found the other ExternalInterface.cpp in the common folder.

Does this problem happen on Neko or Windows? Perhaps it’s an issue with the bitmap file encoding?

Problem on android device.

build: Haxe + Lime + Openfl
os: windows

I think, no. Becouse I tried this:

//draw a rectangle filled with blue:
var bitmap:Bitmap = new Bitmap(new BitmapData(width, heigh, false, 0x0000FF));

But color on android device show it as 0xFF0000. Considered whether it is for the encoding?

If trace the color pixel (0,0), I get true color, but displays another.

trace(bitmap.bitmapData.getPixel(0,0); //output: 255 - true

Sorry, I meant have you tried it on Windows or Neko to see if the problem is still there. I seem to remember reading somewhere that bitmaps are usually saved in RGBA format but Flash uses BGRA format which could explain this issue if it’s getting confused somewhere?

Oh. If I understand you, test build on neko and windows showed true color.

true colors:

var shape:Shape = new Shape();
shape.graphics.beginFill(0x0000FF);
shape.graphics.drawRect(0,0, width, height);
shape.graphics.endFill();

wrong colors:

var bitmapData:BitmapData = new BitmapData(10, 10);
bitmapData.draw(shape);

I want to track “changing colors”, but nothing. If I got it, I will apply colorTransform to achieve “true” color. :grimacing:

That’s interesting because the Windows and Neko builds should be using mostly the same code as the Android version. Have you tried it with later versions of Android? If that shows the true colours it may be something to do with architectures again. Maybe something like the endian-ness I mentioned in my first post.

What device are you using?

Yep. True colors on 4.2 android. Problem only on old device.

What device are you using?

API10:

device: samsung gt-6802
cpu: armv6 - compatible processor rev 5 (v6l)
id: gingerbread
version: 2.3.6
opengl supported: 2.0 / OpenGL ES-CM 1.1

I think, that problem only on specific device. BitmapData colors reading right to left. Question, how it’s track (I know solving problem, but I do not know when to apply the solution)?

I think, you are right. But how track this?

Problem only on BitmapData. Shape got true colors. BitmapData is not.

I am having the same problems on old devices like Galaxy Y. Some colors (not all ) are inverted.

The pixel order must be the same, not sure if it would be endianness or just straight up RGBA vs. ARGB vs. BGRA (etc)

I wonder if there’s a way to detect it

Indeed it seems that the color Blue is swapped with the color Red and only on textures.
If I use a white sprite with color transforms the colors look right.

This happens only on ARMv5 devices like Samsung Galaxy Y on android 2.3.
It started 1 year ago after upgrading the OpenFL, before the upgrade the colors were correct.
I still have apks build in February 2014 that don’t have this problems on the same old devices.

Does this occur to a standard loaded image, or to images that have color transforms applied, or both?

Are you using -Dlegacy?

I think I ran into a similar issue. One of the android reviews of our game had a color swap ( starts at minute 2 ) https://www.youtube.com/watch?v=XvquQjmNcBE

Yellow is swapped with blueish
Blueish with yellowish
Some reds are shown as blue

Not everywhere though, some SVG loaded images are showing up fine, and others aren’t. ( Stars are showing up correctly as yellow, also the blobs, which are textures, show up correctly as pink )

Interestingly the game camera itself seems to be fine, however our UI and background cameras have that weird color swap.

I’m not sure if related, but when we tried making programmatical screenshots on Android, we also get a color swap issue that we first thought was blend mode related.

It may have to do with the device’s default color order, I believe we resolved this in newer versions of OpenFL :slight_smile: