25 #ifdef _VARIANT_ARDUINO_DUE_X_   //DUE    26 extern char *dtostrf(
double val, 
signed char width, 
unsigned char prec, 
char *sout);
    52         extern UTFT *globalLcd;
    59         return _lcd->orient == LANDSCAPE ? Landscape : Portrate;
    64         return _lcd->getDisplayXSize()-1;
    69         return _lcd->getDisplayYSize()-1;
    84     void Offset(
int offset_x,
int offset_y)
   109         LineTo(right,bottom);
   116     void FillRect(
int left,
int top,
int right,
int bottom)
   125         int length_x=
ToDC_X(right)-start_x;
   126         int length_y=
ToDC_Y(bottom)-start_y;
   130         rgb1[0]=color1.GetR();
   131         rgb1[1]=color1.GetG();
   132         rgb1[2]=color1.GetB();
   133         rgb2[0]=color2.GetR();
   134         rgb2[1]=color2.GetG();
   135         rgb2[2]=color2.GetB();
   137         for(
int i=0;i<=length_y;i++)
   139             fctr=(float)i/length_y;
   142                 rgb[j]=rgb1[j]+fctr*(rgb2[j]-rgb1[j]);
   146             _lcd->setColor(rgb[0],rgb[1],rgb[2]);
   147             _lcd->drawHLine (start_x,start_y+i,length_x);
   163         sprintf(_buffer,
"%d",number);
   173         dtostrf(number,0,dec,_buffer);
   177     void DrawText(
const __FlashStringHelper * text,
int x,
int y)
   183         stl = strlen_P((
const char PROGMEM *)text);
   184         if (_lcd->orient==PORTRAIT)
   187                 x=(_lcd->disp_x_size+1)-(stl*_lcd->cfont.x_size);
   189                 x=((_lcd->disp_x_size+1)-(stl*_lcd->cfont.x_size))/2;
   194                 x=(_lcd->disp_y_size+1)-(stl*_lcd->cfont.x_size);
   196                 x=((_lcd->disp_y_size+1)-(stl*_lcd->cfont.x_size))/2;
   198         for (i=0; i<stl; i++)
   200             unsigned char c = pgm_read_byte(&((
const char PROGMEM *)text)[i]);
   201             DrawSymbol(c, x + (i*(_lcd->cfont.x_size)), y);
   208         return _lcd->cfont.x_size;
   213         return _lcd->cfont.y_size;
   218         _lcd->printChar(c, dc_x, dc_y);
   230         x = x+(pos*_lcd->cfont.x_size);
   241         for(
int i=0;i<strlen(text);i++)
   246             DrawSymbol(c, x + (i*(_lcd->cfont.x_size)), y);
   250     void Sector(
int x0, 
int y0, 
int radius,
float angle_rad) 
   256         float tan_stop=tan(angle_rad/2);
   257         int delta = 2 - 2 * radius;
   265             _lcd->drawPixel(x0 + x, y0 - y);
   267             _lcd->drawPixel(x0 - x, y0 - y);
   268             error = 2 * (delta + y) - 1;
   269             if(delta < 0 && error <= 0)
   275             error = 2 * (delta - x) - 1;
   276             if(delta > 0 && error > 0)
   283             delta += 2 * (x - y);
   287     void SetDeviceColor(
Color color)
   289         _lcd->setColor(color.GetR(),color.GetG(),color.GetB());
   292     void SetColor(
Color color)
   294         SetDeviceColor(color);
   296     void SetBackColor(
Color color)
   298         _lcd->setBackColor(VGA_TRANSPARENT);
   299         SetDeviceColor(color);
   301     void SetFont(uint8_t *font)
   305     void MoveTo(
int x,
int y)
   310     void LineTo(
int x,
int y)
   316     void Line(
int x1,
int y1,
int x2,
int y2)
 void Rectangle(int left, int top, int right, int bottom)
Draws rectangle. Input coordinates have to be defined in the window coordinate system. 
Definition: DC.h:100
 
void DrawText(const __FlashStringHelper *text, int x, int y)
Draws PROGMEM string. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:177
 
Implements definition and operations with color. 
Definition: Color.h:27
 
void DrawSymbol(const char c, int dc_x, int dc_y)
Draws symbol. Input coordinates have to be defined in the screen system. 
Definition: DC.h:216
 
int ToDC_Y(int y)
Converts y coordinate from window into screen coordinate system. 
Definition: DC.h:95
 
int FontHeight()
Returns symbol jeight for the current font. 
Definition: DC.h:211
 
void FillRect(int left, int top, int right, int bottom)
Fills rectangle. Input coordinates have to be defined in the window coordinate system. 
Definition: DC.h:116
 
void Sector(int x0, int y0, int radius, float angle_rad)
Draws sector. Input coordinates have to be defined in the window coordinate system. 
Definition: DC.h:250
 
void DrawNumber(float number, int dec, int x, int y)
Draws float number. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:171
 
void DrawNumber(int number, int x, int y)
Draws integer number. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:161
 
ScreenOrientation ScreenOrientation()
Returns screen orientation vertical or horisontal. 
Definition: DC.h:57
 
Device context. Abstraction layer to the device specific drawing code. Coordinates in drawing functio...
Definition: DC.h:29
 
void DrawCaret(int pos, int x, int y)
Draw caret. Input coordinates have to be defined in the window coordinate system. ...
Definition: DC.h:228
 
void DrawChar(const char c, int x, int y)
Draws a character. Input coordinates have to be defined in the window coordinate system. 
Definition: DC.h:221
 
int FontWidth()
Returns symbol width for the current font. 
Definition: DC.h:206
 
int DeviceWidth()
Returns screen width. 
Definition: DC.h:62
 
void Offset(int offset_x, int offset_y)
Initializes drawing coordinate system offset. 
Definition: DC.h:84
 
void Reset()
Resets device context into initial condition. 
Definition: DC.h:72
 
int ToDC_X(int x)
Converts x coordinate from window into screen coordinate system. 
Definition: DC.h:90
 
DC()
Constructor that used locally. This constructor assumes that UTFT library is initialized already...
Definition: DC.h:50
 
void Rectangle3D(int left, int top, int right, int bottom, Color color1, Color color2)
Draws rectangle with 3D border. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:105
 
void DrawText(const char *text, int x, int y)
Definition: DC.h:235
 
void DrawRoundRect(int left, int top, int right, int bottom)
Draws rounded rectangle. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:156
 
void FillGradientRect(int left, int top, int right, int bottom, Color color1, Color color2)
Fills rectangle with gradient color. Input coordinates have to be defined in the window coordinate sy...
Definition: DC.h:121
 
int DeviceHeight()
Returns screen height. 
Definition: DC.h:67
 
void FillRoundRect(int left, int top, int right, int bottom)
Fills rounded rectangle. Input coordinates have to be defined in the window coordinate system...
Definition: DC.h:151
 
DC(UTFT *lcd)
Constructor for global context, that created only once in WindowsManager. 
Definition: DC.h:44