Bienvenido a los foros de FT81x Manía. Te invitamos a regístrate totalmente gratis. Disfruta de tu experiencia con un grandes amigos y Staff.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Thread Contributor: raufjayHow to draw ARC

#1
0
Hello,
I could not find any direct command to draw arc. I am trying to draw wifi signal symbol.
Thanks,
Rauf
Reply
#2
0
Uff this is one the most pursuit "self made widget". 

The approach must be reached mixing some basic primitives like "line" and maybe "point", but require some skills on programming.

Let me finish some urgents on my work, in order to find some useful example.
Reply
#3
3
Better response on post RE: How to draw ARC     I made a ready function to draw an ARC.
By using this simple function, we can draw an ARC of any size, in any line thickness, at any angle, any where on the screen.
Please see attached code with examples and pictures.
Good luck
Rauf

/*
*  Tested on STM32F103C8T6 with FT811 5" LCD.
*  This example will plots arc at any where in any angle with all possible line thickness.
*  
*  void arc(int x, int y, int la, int ra, int s, int t)
  * x,y = co-ordinates
  * la= left side angle from 0 to 360
  * ra= right side angel from 0 to 360
  * s = size of the arc, the distance of arc from x,y
  * t = line thickness 1 to 4080.
  * c = color in 0xffffff
 
*  This code or part of this code is free for any one to use without
*  any obligation.
*  Abdul Rauf Jangda raufjay@gmail.com
*/


#include<GD2UB.h>

void setup()
{
 Serial.begin(115200);
 GD.begin();
}

void loop()
  {
         
       GD.Clear();

       arc(200,100,135,225,80,100,0xFF6420);  
       arc(200,100,135,225,60,60,0xFF6420);
       arc(200,100,135,225,40,30,0xFF6420);
       arc(200,100,135,225,20,10,0xFF6420);

       arc(200,300,0,225,60,10,0x64FF20);

       GD.swap();
   }


void arc(int x, int y, int la, int ra, int s, int t,int c)
{  GD.Begin(POINTS);
  GD.PointSize(t);
  GD.ColorRGB(c);                // select the color
       
  for(int i=la;i<ra;i+=1)
   {
     int xi,yi;
     GD.polar(xi,yi,s,i*180);          // calculates xy co-ordinates of arc point.
     GD.Vertex2f((x+xi)*16,(y+yi)*16);      
   }
}
       
         
     
Reply
#4
0
hello,nice code
Reply
#5
1
The arc function is good but it is too heavy on the FT8xx internal command buffer. As it sends a lot of instructions and it is so easy to fill up FT811 command buffer before it sends out swap() command. Resulting in rebooting the screen with exceptions happens with famous Red color Spanish warning. :).
Future tech must look into it and come up with some macro command as they made for lines, points and rects for example.
Rauf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)