Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. void grayScale(){
  2. S_RGBA color;
  3. int x;
  4. int y;
  5. unsigned char gs;
  6.  
  7. for(x=0; x<width; x++){
  8. for(y=0; y<height; y++){
  9. color = getPixel(x,y);
  10. gs = ROUND(color.red * 0.299 + color.green * 0.587 + color.blue * 0.114);
  11. color.red = gs;
  12. color.blue = gs;
  13. color.green = gs;
  14. putPixel(x,y,color);
  15. }
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement