Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool closeToBackgroundColor(uint Pixel, uint backgroundColour, uint approximation)
- {
- uint redPixel = 0, greenPixel = 0, bluePixel = 0, redBckgrnd = 0, greenBckgrnd = 0, blueBckgrnd = 0;
- uint distance = 0;
- redPixel = (Pixel >> 16) & 0xFF;
- greenPixel = (Pixel >> 8) & 0xFF;
- bluePixel = Pixel & 0xFF;
- redBckgrnd = (backgroundColour >> 16) & 0xFF;
- greenBckgrnd = (backgroundColour >> 8) & 0xFF;
- blueBckgrnd= backgroundColour & 0xFF;
- distance = (redPixel - redBckgrnd)*(redPixel - redBckgrnd) + (greenPixel - greenBckgrnd)*(greenPixel - greenBckgrnd) + (bluePixel - blueBckgrnd)*(bluePixel - blueBckgrnd);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement