Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Color blending programming question regarding tinting the greyscale tile image.  (Read 590 times)

Dramier

  • Bay Watcher
  • Dwarf Sinfonia
    • View Profile
    • Avatar Ascension Development

Does anyone know how the colors are applied from the tileset images?

What I mean is this:  The tileset has a greyscale PNG file that can be tinted to achieve the desired color..    for example:

The oak tree.   The color of the trunk is brown which is set in the PNG file, and the leaves are tinted using the TREE_COLOR:2:0:1.   This doesn't correspond to an RGB value though, as it would just be extremely dark red and not visible.   It's not a floating point RGB either since that uses a range of 0 to 1.0.   

So my question is how is the tree drawn so that the trunk stays brown, and the leaves are tinted to the correct color, and when it does that how does it translate that TREE_COLOR:2:0:1 into green leaves?

(Yes I'm programming, and yes I'm working with a tileset.  This has seriously got me stumped though.   I understand that the drawing routine must be applying a tint only to the greyscale pixels and copying any color pixels straight, but unless he has a custom written drawing routine for that, I'm not sure how it translates that 2:0:1 into green.)

Logged
Independent Game Developer

Dramier

  • Bay Watcher
  • Dwarf Sinfonia
    • View Profile
    • Avatar Ascension Development

Thanks Dwarfu, I did indeed take a good look at that program.   Quite a nice editor!   

I was faced with choosing between writing my own custom drawing routine to handle it, or simply coloring the tileset tiles and adding the new ones.   Since I'm not limited to a single tileset like DF, I chose the latter route in order to save development time.

I still would like to know how Toady handles the RGB color values and such, but as busy as he is, the last thing I want to do is waste his time with such a simple question that has no intrinsic value other than my own programming curiosity.   =P   Stalling the development cycle of DF even for a minute or two would probably get me my own noble room with special 'heated drop floors'.   ;)
Logged
Independent Game Developer