Basically i glued Peter Drescher and Simon Ford libs in a GraphicsDisplay class, then derived TFT or LCD class (which inherits Protocols class), then the most derived ones (Inits), which are per-display and are the only part needed to be adapted to diff hw.

Fork of UniGraphic by GraphicsDisplay

Revision:
7:bb0383b91104
Parent:
4:12ba0ecc2c1f
Child:
10:668cf78ff93a
--- a/Display/LCD.h	Mon Feb 16 01:18:29 2015 +0000
+++ b/Display/LCD.h	Tue Feb 17 11:02:06 2015 +0000
@@ -53,9 +53,6 @@
     */
     virtual void pixel(int x, int y, unsigned short color);
 
-    
-        
-    
     /** Set the window, which controls where items are written to the screen.
     * When something hits the window width, it wraps back to the left side
     * and down a row. If the initial write is outside the window, it will
@@ -66,6 +63,8 @@
     * @param h is the window height in pixels.
     */
     virtual void window(int x, int y, int w, int h);
+    
+    
 
     /** Push a single pixel into the window and increment position.
     * You must first call window() then push pixels in loop.
@@ -102,7 +101,7 @@
       */
     int get_contrast(void);
 
-    /** invert the screen
+    /** display inverted colors
       *
       * @param o = 0 normal, 1 invert
       */
@@ -114,10 +113,6 @@
     */
     virtual void cls();
     
-    
-    
-    
-    
     /** Set the orientation of the screen
     *  x,y: 0,0 is always top left 
     *
@@ -135,6 +130,29 @@
     */
     virtual void BusEnable(bool enable);
     
+    /** get display X size in pixels (native, orientation independent)
+    * @returns X size in pixels
+    */
+    int sizeX();
+
+    /** get display X size in pixels (native, orientation independent)
+    * @returns screen height in pixels.
+    */
+    int sizeY();
+    
+////////////////////////////////////////////////////////////////////////////////    
+    // not implemented yet
+//////////////////////////////////////////////////////////////////
+    virtual unsigned short pixelread(int x, int y){return 0;};
+    virtual void window4read(int x, int y, int w, int h){};
+    void setscrollarea (int startY, int areasize){};
+    void scroll (int lines){};
+    void scrollreset(){};
+    
+    unsigned int tftID;
+    
+    
+    
     
 protected:
 
@@ -196,12 +214,12 @@
     Protocols* proto;
     unsigned char *buffer;
     unsigned short *buffer16;
-    const int LCDSIZE_X;
-    const int LCDSIZE_Y;
-    const int LCDPAGES;
-    const int IC_X_SEGS;
-    const int IC_Y_COMS;
-    const int IC_PAGES;
+    const int screensize_X;
+    const int screensize_Y;
+    const int _LCDPAGES;
+    const int _IC_X_SEGS;
+    const int _IC_Y_COMS;
+    const int _IC_PAGES;
     
     int page_offset;
     int col_offset;