40 void TFT_HorizontalLine(
unsigned int Xaxis,
unsigned int Yaxis,
unsigned int width ,
unsigned int color)
53 void TFT_VerticalLine(
unsigned int Xaxis,
unsigned int Yaxis,
unsigned int height ,
unsigned int color)
67 void TFT_Line(
unsigned int x1,
unsigned int y1,
unsigned int x2,
unsigned int y2,
unsigned int color)
69 unsigned int deltax, deltay, x,y;
91 if(y1 < y2) ystep = 1;
else ystep = -1;
93 for(x = x1; x <= x2; x++)
112 return ceil( value );
114 return floor( value );
126 void TFT_SlantyLine(
unsigned int lX1,
unsigned int lY1,
unsigned int lX2,
unsigned int lY2,
unsigned int color)
128 long lError, lDeltaX, lDeltaY, lYStep, bSteep;
132 if(((lY2 > lY1) ? (lY2 - lY1) : (lY1 - lY2)) > ((lX2 > lX1) ? (lX2 - lX1) : (lX1 - lX2))){
160 lDeltaY = (lY2 > lY1) ? (lY2 - lY1) : (lY1 - lY2);
162 lError = -lDeltaX / 2;
170 for(; lX1 <= lX2; lX1++)
205 void TFT_FullRectangle(
unsigned int Xaxis1,
unsigned int Yaxis1,
unsigned int Xaxis2 ,
unsigned int Yaxis2,
unsigned int color)
210 for(i=Xaxis1;i<= Xaxis2;i++)
212 for(j=Yaxis1;j<=Yaxis2;j++)
227 void TFT_EmptyRectangle(
unsigned int Xaxis1,
unsigned int Yaxis1,
unsigned int Xaxis2,
unsigned int Yaxis2,
unsigned int color)
229 unsigned int CurrentValue;
232 for (CurrentValue = 0; CurrentValue < Xaxis2 - Xaxis1+ 1; CurrentValue++)
239 for (CurrentValue = 0; CurrentValue < Yaxis2 - Yaxis1 + 1; CurrentValue++)
256 void TFT_RoundRectangle(
unsigned int x,
unsigned int y,
unsigned int width,
unsigned int height,
unsigned int radius,
unsigned int color)
258 int tSwitch, x1 = 0, y1 = radius;
259 tSwitch = 3 - 2 * radius;
265 TFT_SetPixel(x+width-radius + x1, y+radius - y1, color);
266 TFT_SetPixel(x+width-radius + y1, y+radius - x1, color);
268 TFT_SetPixel(x+width-radius + x1, y+height-radius + y1, color);
269 TFT_SetPixel(x+width-radius + y1, y+height-radius + x1, color);
271 TFT_SetPixel(x+radius - x1, y+height-radius + y1, color);
272 TFT_SetPixel(x+radius - y1, y+height-radius + x1, color);
275 tSwitch += (4 * x1 + 6);
277 tSwitch += (4 * (x1 - y1) + 10);
297 void TFT_Circle(
unsigned int CenterX,
unsigned int CenterY,
unsigned int Radius,
unsigned int color)
299 unsigned int y=0, x=0, d = 0;
301 d = CenterY - CenterX;
303 part = 3 - 2 * Radius;
315 if (part < 0) part += (4 * x + 6);
317 part += (4 * (x - y) + 10);
332 void TFT_Disk(
unsigned int CenterX,
unsigned int CenterY,
unsigned int Radius,
unsigned int color)
334 unsigned int i, x, yL, yU;
337 for (x = CenterX - Radius; x <= CenterX + Radius; x++)
339 yL =
TFT_dfloor(CenterY - sqrt(Radius * Radius - (x - CenterX) * (x - CenterX)));
340 yU =
TFT_dfloor(CenterY + sqrt(Radius * Radius - (x - CenterX) * (x - CenterX)));
342 for (i = 0; i < (yU - yL); i++)
344 if (i <= yU && yL >= 0)
350 if (yU < 80 && yU > 0)
355 if (yL < 80 && yL > 0)
370 void TFT_DrawCircle(
unsigned int CenterX,
unsigned int CenterY,
unsigned int Radius,
unsigned int color)
372 unsigned int x, yL, yU;
374 for (x = (CenterX - Radius); x <= CenterX + Radius; x++)
376 yL = CenterY - sqrt(Radius * Radius - (x - CenterX) * (x - CenterX));
377 yU = CenterY + sqrt(Radius * Radius - (x - CenterX) * (x - CenterX));
379 if (yL < 80 && yL > 0)
383 if (yU < 80 && yU > 0)
399 void TFT_Ellipse(
long CX,
long CY,
long XRadius,
long YRadius,
unsigned int color)
403 long XChange, YChange;
405 long TwoASquare,TwoBSquare;
406 long StoppingX, StoppingY;
407 TwoASquare = 2*XRadius*XRadius;
408 TwoBSquare = 2*YRadius*YRadius;
411 XChange = YRadius*YRadius*(1-2*XRadius);
412 YChange = XRadius*XRadius;
414 StoppingX = TwoBSquare*XRadius;
417 while ( StoppingX >=StoppingY )
421 StoppingY=StoppingY+ TwoASquare;
422 EllipseError = EllipseError+ YChange;
423 YChange=YChange+TwoASquare;
424 if ((2*EllipseError + XChange) > 0 ) {
426 StoppingX=StoppingX- TwoBSquare;
427 EllipseError=EllipseError+ XChange;
428 XChange=XChange+TwoBSquare;
434 YChange = XRadius*XRadius*(1-2*YRadius);
435 XChange = YRadius*YRadius;
437 StoppingY = TwoASquare*YRadius;
440 while ( StoppingY >=StoppingX )
444 StoppingX=StoppingX + TwoBSquare;
445 EllipseError=EllipseError+ XChange;
446 XChange=XChange+TwoBSquare;
447 if ((2*EllipseError + YChange) > 0 ) {
449 StoppingY=StoppingY- TwoASquare;
450 EllipseError=EllipseError+ YChange;
451 YChange=YChange+TwoASquare;
485 TFT_Line( topx,topy, rightx,righty,color );
486 TFT_Line ( topx,righty,topx,topy,color);
487 TFT_Line (topx,righty, rightx,righty,color);
void TFT_RoundRectangle(unsigned int x, unsigned int y, unsigned int width, unsigned int height, unsigned int radius, unsigned int color)
This function draws a rectangle with round corners.
void TFT_VerticalLine(unsigned int Xaxis, unsigned int Yaxis, unsigned int height, unsigned int color)
Draw a vertical line on the display.
double TFT_dfloor(double value)
Helper funrtion for truncating the double values.
void TFT_SlantyLine(unsigned int lX1, unsigned int lY1, unsigned int lX2, unsigned int lY2, unsigned int color)
Plot a slanty line from x1,y1 to x2,y2 on the display.
void TFT_FullRectangle(unsigned int Xaxis1, unsigned int Yaxis1, unsigned int Xaxis2, unsigned int Yaxis2, unsigned int color)
This function paints a filled rectangle on the screen.
void TFT_SetPixel(unsigned char x_start, unsigned char y_start, unsigned int color)
This functions sets a specific pixel on the TFT display.
void TFT_EmptyRectangle(unsigned int Xaxis1, unsigned int Yaxis1, unsigned int Xaxis2, unsigned int Yaxis2, unsigned int color)
This function paints an empty rectangle on the screen. The width of the contour is 1 pixel...
void TFT_RightTriangle(int topx, int topy, int rightx, int righty, unsigned int color)
This function paints a right angled triangle.
void Plot4EllipsePoints(long CX, long CY, long X, long Y, unsigned int color)
Helper function for plotting an ellipse.
void TFT_Disk(unsigned int CenterX, unsigned int CenterY, unsigned int Radius, unsigned int color)
This function plots a full disk on the display.
void TFT_Ellipse(long CX, long CY, long XRadius, long YRadius, unsigned int color)
This function paints a.
void TFT_HorizontalLine(unsigned int Xaxis, unsigned int Yaxis, unsigned int width, unsigned int color)
Draw a horizontal line on the display.
void TFT_Circle(unsigned int CenterX, unsigned int CenterY, unsigned int Radius, unsigned int color)
This function draws a circle centered a x,y with radius R and specific color.
void TFT_DrawCircle(unsigned int CenterX, unsigned int CenterY, unsigned int Radius, unsigned int color)
This function draws a circle centered a x,y with radius R and specific color.
void TFT_Line(unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2, unsigned int color)
This function paints a.