Composite colors...

Hi all

Colors:
-------
Light yellow = $0080FFFF. When I use FloodFill on a Canvas, and read the colors of each pixel, it is a mixture: ie White $00FFFFFF and Yellow $0000FFFF.

Question:
---------
How do I form a composite color if I know the 2 main colors, and vice versa?

Regards
Keith
LVL 1
keithcslAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

edeyCommented:
comp := (first_col + second_col)div 2;

or

var
 fr,fg,fb,sr,sg,sb,cr,cg,cb : byte;
begin
 fr := first_col;
 fg := first_col shr 8;
 fb := first_col shr 16;
 sr := second_col;
 sg := second_col shr 8;
 sb := second_col shr 16;

if (fb+sb) >= 512 then
 cb := 255
else
 cb := (fb+sb)div 2;
if (fg+sg) >= 512 then
 cg := 255
else
 cb := (fg+sg)div 2;
if (fr+sr) >= 512 then
 cr := 255
else
 cr := (fr+sr)div 2;

comp_col := cr+(cg shl 8)+(cb shl 16);



Or something like that :)
GL
Mike

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
keithcslAuthor Commented:
Thanks

I have posted another question about composite colors...

Keith
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.