Note: This is an archived post that was originally sent to the Hollywood mailing list on Mon, 25 Jun 2007 12:50:06 +0100
Hello Andreas!
I am playing with the tint functions (setlayertint, tintbrush...) and I have to make a grayscale image that results the desired colors by tinting. I figured out that this does not do a simple rgb add operation. It would be helpful if you could describe that algorithm.
Thanks in advance!
[25 Jun 2007] tint
- airsoftsoftwair
- Posts: 5832
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
[06 Jul 2007] Re: tint
Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 06 Jul 2007 20:56:15 +0200
Tint algorithm is implemented in the following way:Hello Andreas!
I am playing with the tint functions (setlayertint, tintbrush...) and I have to make a grayscale image that results the desired colors by tinting. I figured out that this does not do a simple rgb add operation. It would be helpful if you could describe that algorithm.
Code: Select all
dr = dr + (((r - dr) * ratio) >> 8);
dg = dg + (((g - dg) * ratio) >> 8);
db = db + (((b - db) * ratio) >> 8);
r,g,b = tint color
dr,dg,db = pixel to tint
ratio=0-$ff