SFML community forums

Help => Graphics => Topic started by: ShadowDancer on October 24, 2009, 04:52:19 pm

Title: Masked Color?
Post by: ShadowDancer on October 24, 2009, 04:52:19 pm
What will be color of masked image?
I have image as button, and i want to decect when user click, but image have some masked parts. I tried with GetPixel, but it return hmm impossible values(at start it's 3,0,3,0. and r and b values increasing over time). Anyway to solve it?
Title: Masked Color?
Post by: Laurent on October 24, 2009, 05:51:53 pm
A transparent pixel will have its alpha value to 0 (for complete transparency).
Code: [Select]
bool inside = sprite.GetPixel(x, y).a > 0;
Title: Masked Color?
Post by: ShadowDancer on October 24, 2009, 06:05:57 pm
Ach, true. I switched 0 as full visible and 255 as no visible.