Advertisement
sicount

Untitled

Oct 10th, 2015
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. if (x < img->w && y < img->h) {
  2. for (int i = 0; i < img->w; i++) {
  3. for (int j = 0; j < img->h; j++) {
  4. pixel = getpixel(img, i, j);
  5. SDL_GetRGB(pixel, img->format, &r, &g, &b);
  6. coef = 0.3 * r + 0.59 * g + 0.11 * b;
  7. r = (Uint8)coef;
  8. g = (Uint8)coef;
  9. b = (Uint8)coef;
  10. pixel = SDL_MapRGB(img-> format, r, g, b);
  11. putpixel(img, i, j, pixel);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement