Ligne 127 : |
Ligne 127 : |
| Pour créer des rectangles avec un bord contrasté (contrasted outline), utiliser d'abord fillRect() suivit de drawRect() (par dessus avec une couleur différente). | | Pour créer des rectangles avec un bord contrasté (contrasted outline), utiliser d'abord fillRect() suivit de drawRect() (par dessus avec une couleur différente). |
| | | |
− | === Dessiner des cercles === | + | === Cercles === |
| + | Likewise, for circles, you can draw and fill. Each function accepts an X, Y pair for the center point, a radius in pixels, and a color: |
| + | |
| + | void drawCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color); |
| + | void fillCircle(uint16_t x0, uint16_t y0, uint16_t r, uint16_t color); |
| + | |
| + | [[Fichier:GLX-DrawCircle1.jpg]] |
| + | |
| + | [[Fichier:GLX-DrawCircle2.jpg]] |
| + | |
| + | === Rectangles Arrondis === |
| + | For rectangles with rounded corners, both draw and fill functions are again available. Each begins with an X, Y, width and height (just like normal rectangles), then there’s a corner radius (in pixels) and finally the color value: |
| + | |
| + | void drawRoundRect(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t radius, uint16_t color); |
| + | void fillRoundRect(uint16_t x0, uint16_t y0, uint16_t w, uint16_t h, uint16_t radius, uint16_t color); |
| + | |
| + | [[Fichier:GLX-DrawRoundedRect1.jpg]] |
| + | |
| + | Here’s an added bonus trick: because the circle functions are always drawn relative to a center pixel, the resulting circle diameter will always be an odd number of pixels. If an even-sized circle is required (which would place the center point between pixels), this can be achieved using one of the rounded rectangle functions: pass an identical width and height that are even values, and a corner radius that’s exactly half this value. |
| + | |
| + | === Triangles === |
| | | |
| == Références == | | == Références == |