Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int blackAndWhiteInt(SDL_Surface *surf,int x,int y,int contrast)
- {
- Uint8 r, g, b;
- SDL_GetRGB(getPixel(surf,x,y),surf->format, &r,&g,&b);
- Uint8 compt = r * 0.3 + g * 0.59 + b * 0.11;
- if((int)compt >= contrast) return 0;
- else return 1;
- }
- /*Créer un tableau de int dans lequel sont insere les pixels:
- * 1 = noir, 0 = blanc.*/
- int *tabs(int *tab,SDL_Surface *surf,int contrast)
- {
- int w = surf->w;
- int h = surf->h;
- for(int y= 0;y<h;y++)
- {
- for(int x= 0;x<w;x++)
- {
- int pi = 2;
- pi = blackAndWhiteInt(surf,x,y,contrast);
- tab[y*w+x]=pi;
- }
- }
- return tab;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement