Tile.colorTransform.color has no effect?


#1

I’ve been updating BitmapFont ( https://github.com/Beeblerox/BitmapFont ) to use TileMap and work with recent versions of OpenFL. It all works except text coloring, so I tried a simple case and it seems to me that it’s just ignored ?

Here’s the code to reproduce :

var size:Int = 64;
var bmd:BitmapData = new BitmapData(size, size, false);// , 0x000000);
var tileSet:Tileset = new Tileset(bmd, [new Rectangle(0, 0, size, size)]);
var tileMap:Tilemap = new Tilemap(256, 256, tileSet);
addChild(tileMap);
		
var tile:Tile = new Tile(0, 200, 200);
tile.colorTransform.color = 0xff0000;
tileMap.addTile(tile);

Tried with pure white and pure black bitmapdata, the tile color remains white/black


#2

What platform is this?

Does it work differently if you try tile.colorTransform = tile.colorTransform to trigger the setter?


#3

Sorry I should have mentionned : it’s on flash and windows

I tried that, also tried creating a colorTransform. It doesn’t seem to do anything.

Just tried quickly on Neko and html5 and the tile.colorTransform = tile.colorTransform thing works on these. I will check windows again because I’m not 100% sure anymore I tried that (have to compile on the laptop because my desktop is on win8 and can’t run visual studio^^)


#4

Ok it does work on windows with that trick too, I must have tested it only with flash my bad :slight_smile:

The issue is only on flash

EDIT : By the way I didn’t expect the coloring to work like that : if I have white text with a black border, it colors everything the same (on windows at least) is it the expected behavior ?


#5

Setting colorTransform.color sets all the multipliers to zero, except for alpha, which is means it disregards the original color, and everywhere (based on the original alpha) draws things using your new color.

You could try using color mutlipliers instead of offset, so that black stays black, but the white areas are tinted?


#6

Cool ! Looking good now thanks !

It doesn’t work on flash target, which was expected after yesterday’s tests. Should I open an issue about that somewhere ?

I’ll do a bit of cleanup on BitmapFont and make it available, I’ll probably keep the “blit rendermode” thing for flash for now, until the colorTransform issue is sorted out.

EDIT : For anyone interested it’s available here https://github.com/MatseFR/BitmapFont I sent a pull request to the original author. I added some helper properties so that one can work with color and alpha as separate values.


#7

I just tried it on the latest development branch, we had a Tilemap rewrite, and adding tile.colorTransform = new ColorTransform (...) is working here on the Flash target :slight_smile:


#8

Oh great :slight_smile:

I’m using openFL 7.1.2 for now, I’ll remove the blit rendermode for flash when an openFL update comes then ! Thanks !