X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=betty%2Fdisplay.c;h=916ffa163976b7db147aae16e1060e5daf3709f4;hb=b70621d18eeb404cac19bdc3333b559c5899d6eb;hp=71791fc0449fd97013c6d7b14ea7b43e3272b278;hpb=ec21607f7dc421c6a474d93b90e9045ec465a222;p=my-code%2Farm.git diff --git a/betty/display.c b/betty/display.c index 71791fc..916ffa1 100644 --- a/betty/display.c +++ b/betty/display.c @@ -5,6 +5,13 @@ * */ +/* + * some comments on alpha blending! + * + * ... + * + */ + #include "display.h" #include "system.h" #include "default_logo.h" @@ -14,72 +21,135 @@ * functions */ -void display_clear_screen(void) { - - u32 cnt; +void display_fill_screen(u8 fill) { + + u8 page,width; + u8 buf[2]; + + buf[0]=0; + buf[1]=0; + + switch(fill) { + case DISPLAY_FILL_LG: + buf[1]=0xff; + break; + case DISPLAY_FILL_DG: + buf[0]=0xff; + break; + case DISPLAY_FILL_B: + buf[0]=0xff; + buf[1]=0xff; + break; + case DISPLAY_FILL_W: + default: + break; + } + + for(page=0;page white, 11 -> black + DISPLAY_SET_COM_ODIR_REMAPPED; // start counting at the top + /* switch on the display */ DISPLAY_SET_ON; } void display_load_logo(u8 *src) { - u32 cnt; u8 *s; + u8 page,width; s=src; if(s==0) s=default_logo; - DISPLAY_SET_PAGE_ADDR(0); - DISPLAY_SET_C_ADDR(0); + for(page=0;page c=alpha*a+(1-alpha)*b + + a[0]=0; + a[1]=0; + switch(fill) { + case DISPLAY_FILL_LG: + a[1]=1; + break; + case DISPLAY_FILL_DG: + a[0]=1; + break; + case DISPLAY_FILL_B: + a[0]=1; + a[1]=1; + case DISPLAY_FILL_W: + default: + break; + } + + spage=y>>3; // start page = y/8 + epage=(y+h)>>3; // end page (y+h)/8 + + for(p=spage;p<=epage;p++) { + DISPLAY_SET_PAGE_ADDR(p); + for(c=x;cy+h?y+h:y+8; + for(r=y;r