libmonochrome/src/ML_bmp_8_and.c

30 lines
1.2 KiB
C

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