libtthimage/Lib/pixels.c

41 lines
916 B
C
Raw Normal View History

2022-06-27 00:48:18 +02: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 12:52:00 +02:00
int pr, pg, pb;
2022-06-27 00:48:18 +02: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)
{
2023-09-28 23:50:23 +02:00
fprintf(stderr, "%s is wtf\n", __func__);
2022-06-27 00:48:18 +02: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;
}
return 42;
}
/*::------------------------------------------------------------------::*/