4DGL-uLCD-SE with removed color defines

Fork of 4DGL-uLCD-SE by

Revision:
7:e39a44de229a
Parent:
6:b759b69cbaf9
```--- a/uLCD_4DGL_Graphics.cpp	Mon Nov 25 04:24:22 2013 +0000
+++ b/uLCD_4DGL_Graphics.cpp	Sat Nov 30 02:05:15 2013 +0000
@@ -2,6 +2,7 @@
// uLCD_4DGL is a class to drive 4D Systems LCD screens
//
// Copyright (C) <2010> Stephane ROCHON <stephane.rochon at free.fr>
+// Modifed for Goldelox processor <2013> Jim Hamblen
//
// uLCD_4DGL is free software: you can redistribute it and/or modify
@@ -46,6 +47,31 @@

writeCOMMAND(command, 9);
}
+//****************************************************************************************************
+void uLCD_4DGL :: filled_circle(int x, int y , int radius, int color)     // draw a circle in (x,y)
+{
+    char command[9]= "";
+
+    command[0] = FCIRCLE;
+
+    command[1] = (x >> 8) & 0xFF;
+    command[2] = x & 0xFF;
+
+    command[3] = (y >> 8) & 0xFF;
+    command[4] = y & 0xFF;
+
+    command[5] = (radius >> 8) & 0xFF;
+    command[6] = radius & 0xFF;
+
+    int red5   = (color >> (16 + 3)) & 0x1F;              // get red on 5 bits
+    int green6 = (color >> (8 + 2))  & 0x3F;              // get green on 6 bits
+    int blue5  = (color >> (0 + 3))  & 0x1F;              // get blue on 5 bits
+
+    command[7] = ((red5 << 3)   + (green6 >> 3)) & 0xFF;  // first part of 16 bits color
+    command[8] = ((green6 << 5) + (blue5 >>  0)) & 0xFF;  // second part of 16 bits color
+
+    writeCOMMAND(command, 9);
+}

//****************************************************************************************************
void uLCD_4DGL :: triangle(int x1, int y1 , int x2, int y2, int x3, int y3, int color)     // draw a traingle
@@ -141,23 +167,23 @@
}

//****************************************************************************************************
-void uLCD_4DGL :: ellipse(int x, int y , int radius_x, int radius_y, int color)     // draw an ellipse
+void uLCD_4DGL :: filled_rectangle(int x1, int y1 , int x2, int y2, int color)     // draw a rectangle
{
char command[11]= "";

-    command[0] = ELLIPSE;
+    command[0] = FRECTANGLE;

-    command[1] = (x >> 8) & 0xFF;
-    command[2] = x & 0xFF;
+    command[1] = (x1 >> 8) & 0xFF;
+    command[2] = x1 & 0xFF;

-    command[3] = (y >> 8) & 0xFF;
-    command[4] = y & 0xFF;
+    command[3] = (y1 >> 8) & 0xFF;
+    command[4] = y1 & 0xFF;

-    command[5] = (radius_x >> 8) & 0xFF;
-    command[6] = radius_x & 0xFF;
+    command[5] = (x2 >> 8) & 0xFF;
+    command[6] = x2 & 0xFF;

-    command[7] = (radius_y >> 8) & 0xFF;
-    command[8] = radius_y & 0xFF;
+    command[7] = (y2 >> 8) & 0xFF;
+    command[8] = y2 & 0xFF;

int red5   = (color >> (16 + 3)) & 0x1F;               // get red on 5 bits
int green6 = (color >> (8 + 2))  & 0x3F;               // get green on 6 bits
@@ -169,6 +195,8 @@
writeCOMMAND(command, 11);
}

+
+
//****************************************************************************************************
void uLCD_4DGL :: pixel(int x, int y, int color)     // draw a pixel
{
@@ -195,13 +223,13 @@
void uLCD_4DGL :: BLIT(int x, int y, int w, int h, int *colors)     // draw a block of pixels
{
int red5, green6, blue5;
-    writeBYTE('\x00');
-    writeBYTE(BLITCOM);
-    writeBYTE((x >> 8) & 0xFF);
-    writeBYTE(x & 0xFF);
-    writeBYTE((y >> 8) & 0xFF);
-    writeBYTE(y & 0xFF);
-    writeBYTE((w >> 8) & 0xFF);
+    writeBYTEfast('\x00');
+    writeBYTEfast(BLITCOM);
+    writeBYTEfast((x >> 8) & 0xFF);
+    writeBYTEfast(x & 0xFF);
+    writeBYTEfast((y >> 8) & 0xFF);
+    writeBYTEfast(y & 0xFF);
+    writeBYTEfast((w >> 8) & 0xFF);
writeBYTE(w & 0xFF);
writeBYTE((h >> 8) & 0xFF);
writeBYTE(h & 0xFF);
@@ -267,34 +295,6 @@
return color; // WARNING : this is 16bits color, not 24bits... need to be fixed
}

-//******************************************************************************************************
-void uLCD_4DGL :: screen_copy(int xs, int ys , int xd, int yd , int width, int height)
-{
-
-    char command[13]= "";
-
-    command[0] = SCREENCOPY;
-
-    command[1] = (xs >> 8) & 0xFF;
-    command[2] = xs & 0xFF;
-
-    command[3] = (ys >> 8) & 0xFF;
-    command[4] = ys & 0xFF;
-
-    command[5] = (xd >> 8) & 0xFF;
-    command[6] = xd & 0xFF;
-
-    command[7] = (yd >> 8) & 0xFF;
-    command[8] = yd & 0xFF;
-
-    command[9] = (width >> 8) & 0xFF;
-    command[10] = width & 0xFF;
-
-    command[11] = (height >> 8) & 0xFF;
-    command[12] = height & 0xFF;
-
-    writeCOMMAND(command, 13);
-}

//****************************************************************************************************
void uLCD_4DGL :: pen_size(char mode)     // set pen to SOLID or WIREFRAME
@@ -303,8 +303,8 @@

command[0] = PENSIZE;
command[1] = mode;
-
writeCOMMAND(command, 2);
}

+
```