Update readme.md

This commit is contained in:
javalang 2018-11-15 18:22:02 +01:00 committed by GitHub
parent 864181d399
commit ebdeee049f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -2,7 +2,14 @@
TFTShape is an extension to draw shape-based objects on screen. The target of this extension is to abstract low level primitives but with full use of the TFT_eSPI core functions (no setPixel operations). Shapes are graphical objects with the most common 2D functionality such as draw, fill, scale and rotate. Shapes consists of vertices which will be interpteted by the TFTShape class to form points, lines, polygons etc. Vertices can be user defined or they can be generated by various TFTShape builder functions. To give you an overview, here is a short example to see how to use this extension:
##Building an analog clock
### clock-face
To draw a clock face, only three lines of code will be needed. The basic idea is to define a 12-sided grid and draw a small dot on the corners of the grid. Fortunately TFTShape has the functionality not only to draw the shape itself but it can take also an argument to draw another shape (at all vertices positions). So the code is very simple: create a shape used for the 5 minutes dots, create a shape for an invisible grid and finally draw this grid with a Shape as an argument:
```javascript
TFTShape dot=TFTShape::buildNgon(8,6);
TFTShape grid5minutes=TFTShape::buildNgon(12,100);
grid5minutes.fill(&tft2,120,160,dot,TFT_GREY);
```
And this is the result:
![clock-face](images/screenshot_4571.png)