daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Dec 11th, 2017 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bool closeToBackgroundColor(uint Pixel, uint backgroundColour, uint approximation)
  2. {
  3.     uint redPixel = 0, greenPixel = 0, bluePixel = 0, redBckgrnd = 0, greenBckgrnd = 0, blueBckgrnd = 0;
  4.     uint distance = 0;
  5.     redPixel = (Pixel >> 16) & 0xFF;
  6.     greenPixel = (Pixel >> 8) & 0xFF;
  7.     bluePixel = Pixel & 0xFF;
  8.     redBckgrnd = (backgroundColour >> 16) & 0xFF;
  9.     greenBckgrnd = (backgroundColour >> 8) & 0xFF;
  10.     blueBckgrnd= backgroundColour & 0xFF;
  11.     distance = (redPixel - redBckgrnd)*(redPixel - redBckgrnd) + (greenPixel - greenBckgrnd)*(greenPixel - greenBckgrnd) + (bluePixel - blueBckgrnd)*(bluePixel - blueBckgrnd);
  12. }
RAW Paste Data
Top