Page 1 of 1

Colorizing black pixels

Posted: Thu Dec 19, 2013 7:25 pm
by hryx
I'm balls deep in a graphic tile-based level with several layers à la Photoshop, which I'm porting to 0.9.0. All drawable tile objects contain only black, white, and alpha.

I used to be able to "colorize" the black pixels of the current layer with a slight green using setColorMode. It was kind of awkward and I didn't understand it, but it worked.

I'm having trouble doing this in 0.9.0, now that setColorMode is gone. I thought an additive blend mode would be able to lighten dark pixels, but right now additive is only making the layer's images disappear. Also note that I only want to affect the current layer, not those below or above.

Any advice? I'd rather not use shaders just for this.

Re: Colorizing black pixels

Posted: Thu Dec 19, 2013 7:28 pm
by bartbes
Additive should work, but if you only want it applied to that layer, you might need to do some canvas magic.

Re: Colorizing black pixels

Posted: Thu Dec 19, 2013 7:37 pm
by hryx
I could live with that, though it's too bad I'd have to introduce a hardware-dependent feature.

Still, it's curious I can't get additive to do anything right now. Exchanging "multiplicative" with "additive" in the wiki example code works, but not in my own app (which uses spritebatches rather than rectangle primitives).