libmonochrome/src/ML_bmp_16_xor.c

31 lines
1.2 KiB
C

/* ************************************************************************** */
/* */
/* ML_bmp_16_xor.c */
/* | Project : libmonochrome */
/* */
/* By: Pierre "PierrotLL" Le Gall <legallpierre89@gmail.com> */
/* Last updated: 2011/11/22 */
/* */
/* ************************************************************************** */
#include <monochrome/internals.h>
void ML_bmp_16_xor(const unsigned short *bmp, int x, int y)
{
unsigned long line;
char i, shift, begin=0, end=16, *screen, *p=(char*)&line+1;
if(!bmp || x<0 || x>112 || y<-15 || y>63) return;
if(y < 0) begin = -y;
if(y > 48) end = 64-y;
shift = 8-(x&7);
screen = ML_vram_adress()+(y+begin<<4)+(x>>3);
for(i=begin ; i<end ; i++)
{
line = bmp[i]<<shift;
screen[0] ^= *p;
screen[1] ^= *(p+1);
if(shift!=8) screen[2] ^= *(p+2);
screen += 16;
}
}