[25 Jun 2007] tint

Contains all messages from the Hollywood mailing list between 01/2006 and 08/2012
Locked
User avatar
lazi
Posts: 646
Joined: Thu Feb 24, 2011 11:08 pm

[25 Jun 2007] tint

Post by lazi »

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!
User avatar
airsoftsoftwair
Posts: 5832
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

[06 Jul 2007] Re: tint

Post by airsoftsoftwair »

Note: This is an archived post that was originally sent to the Hollywood mailing list on Fri, 06 Jul 2007 20:56:15 +0200
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.
Tint algorithm is implemented in the following way:

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
Locked