FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: EVE - How to draw an Arc with a line thickness  (Read 14476 times)

jberkhout

  • Newbie
  • *
  • Posts: 41
    • View Profile
EVE - How to draw an Arc with a line thickness
« on: June 23, 2018, 03:17:48 PM »

Hi,
Using KT813, how can I best draw an arc with a line thickness?
For example for a line, I can use:

Code: [Select]
ft_void_t FT813::Line(ft_int16_t x0, ft_int16_t y0, ft_int16_t x1, ft_int16_t y1, ft_int16_t width)
{
    ft_uint32_t calc;

    StartFunc(FT_CMD_SIZE*5);
    SendCmd(DL_BEGIN | FT8_LINES);
    calc = LINE_WIDTH(width * 16);
    SendCmd(calc);
    calc = VERTEX2F(x0 * 16, y0 * 16);
    SendCmd(calc);
    calc = VERTEX2F(x1 * 16, y1 * 16);
    SendCmd(calc);
    SendCmd(DL_END);
    EndFunc();
}

Kind regards,
Jack.
« Last Edit: July 02, 2018, 08:50:58 AM by jberkhout »
Logged

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 891
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #1 on: June 25, 2018, 10:34:57 AM »

Hello,

Please see section 2.5.4 of the programmers guide:
http://brtchip.com/wp-content/uploads/Support/Documentation/Programming_Guides/ICs/EVE/FT81X_Series_Programmer_Guide.pdf
You can use the VERTEX2F or VERTEX2II commands to draw graphics primitives including lines/arcs.

I notice you have had a lot of queries recently, it may be more productive for you to direct these to support1@ftdichip.com.

Best Regards,
FTDI Community
Logged

Rudolph

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #2 on: June 26, 2018, 09:35:57 AM »

You can use the VERTEX2F or VERTEX2II commands to draw graphics primitives including lines/arcs.

Actually, no, there is no command for drawing arcs or full circles, that is something I am missing in the FT8xx as well.
You can draw a circle by drawing a POINT and then a smaller one with the background color on top of it.
Plus you could draw a RECT to mask out a portion of that circle for an arc.

And you could in theory use a LINESTRIP to draw an arc but that would not only require quite a lot VERTEX2F commands for a decent arc and therefore eating up the available space in the display-list fast, it also is a pain for the controller to calculate since the Y coordinate has to be shifted into that odd bit-position for every VERTEX2F.

The third option would be to use bitmaps, if you can't draw it on the fly, fake it. :-)

Logged

jberkhout

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #3 on: June 27, 2018, 05:46:59 PM »

Thank you Rudolph,
While still new to this display, I'm struggling with just the common graphics primitives, really basics like arcs, (outline) circles, for instance.
Using two points to draw an outline circle seems a bit odd, but then how do I create an arc with perpendicular line ends for any given start and end angles?
I could use a thick arc to draw a Pie Chart, among other indicators.

I searched section 2.5.4 already, but these common graphics primitives seem not listed there:
dl( BEGIN(ARCS) );
dl( BEGIN(CIRCLES) );
Can you please provide an arc example using any random start and end angle, please?
That would really help me and others.
Thank you very much!
Kind regards,
Jack.
Logged

Rudolph

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: EVE - How to draw an Arc with a line thicknesa
« Reply #4 on: June 30, 2018, 12:33:27 PM »

As I wrote, there is no function to draw arcs or circles directly.
The follwing is untested, just a bunch of code put together adhoc from existing code and modified.

Drawing a circle:
   FT8_cmd_dl(DL_BEGIN | FT8_POINTS);
   FT8_cmd_dl(DL_COLOR_RGB | mycolor);
   FT8_cmd_dl(POINT_SIZE((diameter + (2*width))* 16));
   FT8_cmd_dl(VERTEX2F(some_x * 16,some_y * 16));
   FT8_cmd_dl(DL_COLOR_RGB | background);
   FT8_cmd_dl(POINT_SIZE(diameter * 16));
   FT8_cmd_dl(VERTEX2F(some_x * 16, some_y * 16));
   FT8_cmd_dl(DL_END);

Drawing an arc:

       fill_arc_array();

   FT8_cmd_dl(DL_COLOR_RGB | color);
   FT8_cmd_dl(LINE_WIDTH(width * 16));
   FT8_cmd_dl(DL_BEGIN | FT8_LINE_STRIP);

   for(counter=0;counter<31;counter++)
   {
                FT8_cmd_dl(vertex2f_arc_xy[counter]);
   }
   FT8_cmd_dl(DL_END);

So the second assumes that you have a vertex2f_arc_xy[] array with 32 bit values filled like this:
vertex2f_arc_xy[n] = VERTEX2F(some_x * 16,some_y * 16);

This can be pre-calculated data, maybe with the help of a spreadsheet or calculated on the fly between to points
in the plane and probably a radius to go with that.

The result of this can be seen somewhat in this picture:
https://github.com/RudolphRiedel/FT800-FT813/blob/master/example_pics/FT811_HY50HD.jpg
That graph on the right consists of a line-strip with 64 points with fixed values for the sample code.
That sine curve on the far right only has a fraction of that points and still looks decent.

But as I wrote above, this eats the display-list, you have to find a a trade-off between just enough points for the arc and a really smooth one.

For static display elements however using pictures of arcs would be far superior in terms of resources used.
Logged

jberkhout

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: EVE - How to draw an Arc with a line thickness
« Reply #5 on: July 26, 2020, 04:57:56 PM »

So it still is possible, indirectly. This simple demo shows endless possibilities using EVE displays.
In the captured screenshots, there are just two items shown: the text at the top and just below it a rather large
480x320 RGB565 bitmap, which is entirely rendered by the MCU. But multiple smaller bitmaps can be used as well, the MCU can update the one of choice.
For this demo, the display and SD-Card were interfaced in 4-bit mode, and bus masters were used to transfer data, without CPU intervention.
An ARM Cortex-H7 running at 480MHz was used, but an (multi-core) MPU can be used as well. The SD-Card was mainly used to save the screenshots.

This is not a replacement for the EVE graphics, but rather an addition. The EVE should be used as much possible, it's blazing fast, we can't beat that with rendering by using the MCU.
We should use the MCU for rendering only when really needed:
- we need non-static graphics
- it's not possible to render it using EVE commands
- it's eating the display-list
- we don't need to render too much
- on-time only (startup) renderings, like styled buttons

Combining EVE commands and MCU rendering is flexible, it allows custom gauges, graphs and widgets which require dynamic updates.

The Gauge on the top right was rendered in 21mS using 4x-anti-aliasing for 100x100 pixels. Using 2x-anti-aliasing it takes 5mS and without it, it takes less than 750uS. Text is always using anti-aliasing, but is done very efficient, it isn't noticeable slower than non-anti-aliased fonts.
Without AA, the images still look pretty good, useful when there are many of those to update.



For this demo, the MCU wrote images to an EVE bitmap, rotated and scaled. Just nice, if we need it in a custom rendered image. Less artifacts but slower when done by the MCU.



A nice example of pixel-level access: we can zoom in endlessly on the Mandelbrot set, by touching a point of interest, getting new interesting views of it. Each rendering is unique.
You won't even be able to get the same picture ever again if you start it over, using touching.










« Last Edit: November 24, 2020, 06:17:48 PM by jberkhout »
Logged