libtthimage/Lib/pixels.c

39 lines
873 B
C
Raw Normal View History

2022-06-27 09:48:18 +11:00
/*
* 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)
{
2022-07-07 21:52:00 +11:00
int pr, pg, pb;
2022-06-27 09:48:18 +11:00
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)
{
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;
}
/*::------------------------------------------------------------------::*/