-/**************************************************************************/
-/*!
- @brief Draws a progress bar with rounded corners
-
- @param[in] x
- Starting x location
- @param[in] y
- Starting y location
- @param[in] width
- Total width of the progress bar in pixels
- @param[in] height
- Total height of the progress bar in pixels
- @param[in] borderCorners
- The type of rounded corners to render with the progress bar border
- @param[in] progressCorners
- The type of rounded corners to render with the inner progress bar
- @param[in] borderColor
- 16-bit color for the outer border
- @param[in] borderFillColor
- 16-bit color for the interior of the outer border
- @param[in] progressBorderColor
- 16-bit color for the progress bar's border
- @param[in] progressFillColor
- 16-bit color for the inner bar's fill
- @param[in] progress
- Progress percentage (between 0 and 100)
-
- @section Example
-
- @code
- #include "drivers/displays/tft/drawing.h"
-
- // Draw a the progress bar (150x15 pixels large, starting at X:10, Y:195
- // with rounded corners on the top and showing 72% progress)
- drawProgressBar(10, 195, 150, 15, DRAW_ROUNDEDCORNERS_TOP, DRAW_ROUNDEDCORNERS_TOP, COLOR_DARKERGRAY, COLOR_DARKGRAY, COLOR_LIMEGREENDIM, COLOR_LIMEGREEN, 72 );
-
- @endcode
-*/
-/**************************************************************************/
-void drawProgressBar ( uint16_t x, uint16_t y, uint16_t width, uint16_t height, drawRoundedCorners_t borderCorners, drawRoundedCorners_t progressCorners, uint16_t borderColor, uint16_t borderFillColor, uint16_t progressBorderColor, uint16_t progressFillColor, uint8_t progress )
-{
- // Draw border with rounded corners
- drawRectangleRounded(x, y, x + width, y + height, borderColor, 5, borderCorners);
- drawRectangleRounded(x+1, y+1, x + width - 1, y + height - 1, borderFillColor, 5, borderCorners);
-
- // Progress bar
- if (progress > 0 && progress <= 100)
- {
- // Calculate bar size
- uint16_t bw;
- bw = (width - 6); // bar at 100%
- if (progress != 100)
- {
- bw = (bw * progress) / 100;
- }
- drawRectangleRounded(x + 3, y + 3, bw + x + 3, y + height - 3, progressBorderColor, 5, progressCorners);
- drawRectangleRounded(x + 4, y + 4, bw + x + 3 - 1, y + height - 4, progressFillColor, 5, progressCorners);
- }
-}
-
-/**************************************************************************/
-/*!
- @brief Draws a simple button
-
- @param[in] x
- Starting x location
- @param[in] y
- Starting y location
- @param[in] width
- Total width of the button in pixels
- @param[in] height
- Total height of the button in pixels
- @param[in] fontInfo
- Pointer to the FONT_INFO used to render the button text
- @param[in] borderclr
- The rgb565 border color
- @param[in] fillclr
- The rgb565 background color
- @param[in] fontclr
- The rgb565 font color
- @param[in] text
- The text to render on the button
-
- @section Example
-
- @code
-
- #include "drivers/displays/tft/drawing.h"
- #include "drivers/displays/tft/fonts/dejavusans9.h"
-
- // Draw two buttons using DejaVu Sans 9
- drawButton(20, 195, 200, 35, &dejaVuSans9ptFontInfo, COLOR_GRAY_80, COLOR_GRAY_80, COLOR_WHITE, "System Settings");
- drawButton(20, 235, 200, 35, &dejaVuSans9ptFontInfo, COLOR_THEME_LIMEGREEN_DARKER, COLOR_THEME_LIMEGREEN_BASE, COLOR_BLACK, "System Settings");
-
- @endcode
-*/
-/**************************************************************************/
-void drawButton(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const FONT_INFO *fontInfo, uint16_t borderclr, uint16_t fillclr, uint16_t fontclr, char* text)
-{
- // Border
- drawRectangleRounded(x, y, x + width, y + height, borderclr, 5, DRAW_ROUNDEDCORNERS_ALL);
- // Fill
- drawRectangleRounded(x+2, y+2, x+width-2, y+height-2, fillclr, 5, DRAW_ROUNDEDCORNERS_ALL);
-
- // Render text
- if (text != NULL)
- {
- uint16_t textWidth = fontsGetStringWidth(&*fontInfo, text);
- uint16_t xStart = x + (width / 2) - (textWidth / 2);
- uint16_t yStart = y + (height / 2) - (fontInfo->height / 2) + 1;
- fontsDrawString(xStart, yStart, fontclr, &*fontInfo, text);
- }
-}
-