Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Masked Color?  (Read 2362 times)

0 Members and 1 Guest are viewing this topic.

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Masked Color?
« 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?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Masked Color?
« Reply #1 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;
Laurent Gomila - SFML developer

ShadowDancer

  • Newbie
  • *
  • Posts: 26
    • View Profile
Masked Color?
« Reply #2 on: October 24, 2009, 06:05:57 pm »
Ach, true. I switched 0 as full visible and 255 as no visible.