X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=betty%2Fdisplay.c;h=2da19efe9ffa8f4ba42d32bd89c5339c369cfa13;hb=96c6e10b97b3cce49a3c2090108ea29d23ec3950;hp=4d4e1e1a292498939fc9cc8ecd31cbbde1c199f8;hpb=dae61ba4bd4aa88003cae65e454c03aa0a1f85f4;p=my-code%2Farm.git diff --git a/betty/display.c b/betty/display.c index 4d4e1e1..2da19ef 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" @@ -17,55 +24,64 @@ 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; } @@ -88,6 +104,54 @@ void display_load_logo(u8 *src) { } } +void display_draw_rectangle(int x,int y,int w,int h,u8 fill,u8 alpha) { + + int c,r,rmax; + u8 p,spage,epage; + u8 b[2],a[2]; // c = a over b => 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