libtthimage/Lib/pixels.c

41 lines
916 B
C

/*
* PIXELS dot C
*/
#include <stdio.h>
#include "../tthimage.h"
/*::------------------------------------------------------------------::*/
int
Image_XOR_pixel(Image_Desc *img, int x, int y, int r, int g, int b)
{
int pr, pg, pb;
if ( (x<0) || (y<0) || (x>=img->width) || (y>=img->height) )
{
fprintf(stderr, "%s : out of pic (%d, %d)\n", __func__, x, y);
return OUT_OF_IMAGE;
}
img->Rpix[y][x] ^= r;
img->Gpix[y][x] ^= g;
img->Bpix[y][x] ^= b;
return FULL_NUCKED;
}
/*::------------------------------------------------------------------::*/
int Image_rot_pixel(Image_Desc *img, int x, int y, int r, int g, int b)
{
fprintf(stderr, "%s is wtf\n", __func__);
if ( (x<0) || (y<0) || (x>=img->width) || (y>=img->height) )
{
fprintf(stderr, "%s : out of pic (%d, %d)\n", __func__, x, y);
return OUT_OF_IMAGE;
}
return 42;
}
/*::------------------------------------------------------------------::*/