]> hackdaworld.org Git - my-code/arm.git/commitdiff
display extended (untested!)
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Fri, 14 Sep 2007 14:17:42 +0000 (16:17 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Fri, 14 Sep 2007 14:17:42 +0000 (16:17 +0200)
betty/display.c
betty/display.h

index ce8fd7c1aeca22236c863598c9b64fb350360b3b..a439fcdff09b4483953574e30d2a8d920300583e 100644 (file)
@@ -50,7 +50,7 @@ void display_fill_screen(u8 fill) {
        }
 
        for(page=0;page<DISPLAY_PAGE_MAX;page++) {
-               DISPLAY_SET_C_ADDR(0);
+               DISPLAY_SET_COL_ADDR(0);
                DISPLAY_SET_PAGE_ADDR(page);
                for(width=0;width<DISPLAY_DIMX;width++) {
                        DISPLAY_DATA=buf[0];
@@ -99,7 +99,7 @@ void display_load_logo(u8 *src) {
                s=default_logo;
 
        for(page=0;page<DISPLAY_PAGE_MAX;page++) {
-               DISPLAY_SET_C_ADDR(0);
+               DISPLAY_SET_COL_ADDR(0);
                DISPLAY_SET_PAGE_ADDR(page);
                for(width=0;width<DISPLAY_DIMX;width++) {
                        DISPLAY_DATA=*s++;
@@ -128,7 +128,7 @@ void display_draw_rectangle(u8 x,u8 y,u8 w,u8 h,u8 fill,u8 alpha) {
                if(rmax>y+h)
                        rmax=y+h;
                for(col=x;col<x+w;col++) {
-                       DISPLAY_SET_C_ADDR(col);
+                       DISPLAY_SET_COL_ADDR(col);
                        d[0]=DISPLAY_DATA;              // dummy read (p.16)
                        d[0]=DISPLAY_DATA;
                        d[1]=DISPLAY_DATA;
@@ -145,16 +145,85 @@ void display_draw_rectangle(u8 x,u8 y,u8 w,u8 h,u8 fill,u8 alpha) {
                                d[0]|=((c>>1)&1)<<row;
                                d[1]|=(c&1)<<row;
                        }
-                       DISPLAY_SET_C_ADDR(col);
+                       DISPLAY_SET_COL_ADDR(col);
                        DISPLAY_DATA=b[0];
                        DISPLAY_DATA=b[1];
                }
+               h-=(rmax-y);
+               y=rmax;
+       }
+}
+
+void display_draw_font(u8 x,u8 y,u8 *font,u8 fill,u8 alpha) {
+
+       u8 page,col,row,rmax,cnt,left;
+       u8 d[2];
+       int ca,cb;
+       u8 a,b,c;                       // c = a over b
+
+       left=8;
+
+       a=fill&0x03;
+       ca=0;
+       for(cnt=0;cnt<a;cnt++)          // contribution of a: alpha*a
+               ca+=alpha;
+
+       for(page=(y>>3);page<=((y+8)>>3);page++) {      // page = y/8
+               DISPLAY_SET_PAGE_ADDR(page);
+               rmax=(page+1)<<3;                       // row max
+               if(rmax>y+left)
+                       rmax=y+left;
+               cf=0;
+               for(col=x;col<x+8;col++) {
+                       DISPLAY_SET_COL_ADDR(col);
+                       d[0]=DISPLAY_DATA;              // dummy read (p.16)
+                       d[0]=DISPLAY_DATA;
+                       d[1]=DISPLAY_DATA;
+                       rf=0;
+                       for(row=y;row<rmax;row++) {
+                               // contribution of b: (255-alpha)*b
+                               b=display_m2i(d,row);
+                               cb=0;
+                               for(cnt=0;cnt<b;cnt++)
+                                       cb+=(255-alpha);
+                               // finally there is c
+                               if((font[cf]>>row)&1) {
+                                       c=(ca+cb)>>8;
+                                       d[0]&=~(1<<row);
+                                       d[1]&=~(1<<row);
+                                       d[0]|=((c>>1)&1)<<row;
+                                       d[1]|=(c&1)<<row;
+                               }
+                               rf+=1;
+                       }
+                       DISPLAY_SET_COL_ADDR(col);
+                       DISPLAY_DATA=b[0];
+                       DISPLAY_DATA=b[1];
+                       cf+=1;
+               }
+               left-=(rmax-y);
                y=rmax;
        }
 }
 
 void display_draw_buf(u8 x,u8 y,u8 w,u8 h,u8 *buf,u8 alpha) {
 
+       u8 page,col,row,rmax,cnt;
+       u8 d[2];
+       int ca,cb;
+       u8 a,b,c;
+
+       for(page=(y>>3);page<=((y+h)>>3);page++) {
+               DISPLAY_SET_PAGE_ADDR(page);
+               for(col=x;col<x+w;col++) {
+                       DISPLAY_SET_COL_ADDR(col);
+                       d[0]=DISPLAY_DATA;
+                       d[0]=DISPLAY_DATA;
+                       d[1]=DISPLAY_DATA;
+                       for(row=y;row<rmax;row++) {
+                       }
+               }
+       }
 }
 
 void display_bl_init(void) {
index df371ac4eb67efa361a948e3f49381e7cf466732..b10835a0fa560ef9d3ec75103cb7daf6900b2554 100644 (file)
@@ -24,7 +24,7 @@
 #define DISPLAY_RAM_CONTENT            (DISPLAY_PAGE_MAX*DISPLAY_COL_MAX*2)
 
 /* display cmds */
-#define DISPLAY_SET_C_ADDR(c)          DISPLAY_CMD=(0x00|((c)&0x0f)); \
+#define DISPLAY_SET_COL_ADDR(c)                DISPLAY_CMD=(0x00|((c)&0x0f)); \
                                        DISPLAY_CMD=(0x10|(((c)&0x70)>>4))
 #define DISPLAY_SET_MASTER             DISPLAY_CMD=0x18
 #define DISPLAY_SET_SLAVE              DISPLAY_CMD=0x19
                                        DISPLAY_CMD=(c)
 #define DISPLAY_EXTENDED_FEATURES      DISPLAY_CMD=0xf0
 
+/* experimental cmds */
+#define DISPLAY_SET_READ_MODIFY_WRITE  DISPLAY_CMD=0xe0;
+#define DISPLAY_UNSET_READ_MODIFY_WRITE        DISPLAY_CMD=0xee;
+
 /* display api specific defines */
 #define DISPLAY_FILL_W                 0x00
 #define DISPLAY_FILL_LG                        0x01