Files
TX/source/Graphics/graphicsLibrary.h

227 lines
5.2 KiB
C

/*
* graphicsLibrary.h
*
* Created on: Feb 12, 2022
* Author: Brian.Bailey
*/
#include <stdint.h>
#include <stddef.h>
#ifndef GRAPHICS_GRAPHICSLIBRARY_H_
#define GRAPHICS_GRAPHICSLIBRARY_H_
//include all bitmap headers
#include "testIconsMono.h"
/**
* Draw a line
*
* Output will be clipped to the current clip window.
*
* @param x0
* @param y0
* @param x1
* @param y1
* @param color
*/
void GL_DrawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t thickness, LCD_DRAWMODE_t drawMode);
/**
* Draw a rectangle
*
* Output will be clipped to the current clip window.
*
* @param x0
* @param y0
* @param x1
* @param y1
* @param thickness
* @param color
*/
void GL_DrawRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t thickness, LCD_DRAWMODE_t drawMode);
/**
* Draw a filled rectangle
*
* Output will be clipped to the current clip window.
*
* @param x0
* @param y0
* @param x1
* @param y1
* @param color
*/
void GL_DrawFilledRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, LCD_DRAWMODE_t drawMode);
/**
* Draw a circle
*
* Output will be clipped to the current clip window.
*
* @param x0 center X
* @param y0 center Y
* @param r radius
* @param color
*/
void GL_DrawCircle(int16_t x0, int16_t y0, int16_t r, LCD_DRAWMODE_t drawMode);
void GL_DrawCircle2(int16_t xc, int16_t yc, int16_t rInner, int16_t rOuter, LCD_DRAWMODE_t drawMode);
/**
* Draw a filled circle
*
* Output will be clipped to the current clip window.
*
* @param x0 center X
* @param y0 center Y
* @param r radius
* @param color
*/
void GL_DrawFilledCircle(int16_t x0, int16_t y0, int16_t r, LCD_DRAWMODE_t drawMode);
/**
* Draw an ellipse
*
* Output will be clipped to the current clip window.
*
* @param x0 center X
* @param y0 center Y
* @param a vertical radius
* @param b horizontal radius
* @param color
*/
void GL_DrawEllipse(int16_t x0, int16_t y0, int16_t a, int16_t b, LCD_DRAWMODE_t drawMode);
/**
* Draw a filled ellipse
*
* Output will be clipped to the current clip window.
*
* @param x0 center X
* @param y0 center Y
* @param a vertical radius
* @param b horizontal radius
* @param color
*/
void GL_DrawFilledEllipse(int16_t x0, int16_t y0, int16_t a, int16_t b, LCD_DRAWMODE_t drawMode);
/**
* Draw a polygon
*
* Output will be clipped to the current clip window. Polygon does
* not need to be convex. They can also be concave or complex.
*
* COLOR_t color = hagl_color(0, 255, 0);
* int16_t vertices[10] = {x0, y0, x1, y1, x2, y2, x3, y3, x4, y4};
* hagl_draw_polygon(5, vertices, color);
*
* @param numVertices number of vertices
* @param vertices pointer to (an array) of vertices
* @param thickness thickness in pixels
* @param color
*/
void GL_DrawPolygon(int16_t numVertices, int16_t *vertices, int16_t thickness, LCD_DRAWMODE_t drawMode);
/**
* Draw a filled polygon
*
* Output will be clipped to the current clip window. Polygon does
* not need to be convex. They can also be concave or complex.
*
* COLOR_t color = hagl_color(0, 255, 0);
* int16_t vertices[10] = {x0, y0, x1, y1, x2, y2, x3, y3, x4, y4};
* hagl_draw_polygon(5, vertices, color);
*
* @param numVertices number of vertices
* @param vertices pointer to (an array) of vertices
* @param thickness thickness in pixels
* @param color
*/
void GL_DrawFilledPolygon(int16_t numVertices, int16_t *vertices, LCD_DRAWMODE_t drawMode);
/**
* Draw a triangle
*
* Output will be clipped to the current clip window. Internally
* uses hagl_draw_polygon() to draw the triangle.
*
* @param x0
* @param y0
* @param x1
* @param y1
* @param x2
* @param y3
* @param thickness
* @param color
*/
void GL_DrawTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t thickness, LCD_DRAWMODE_t drawMode);
/**
* Draw a filled triangle
*
* Output will be clipped to the current clip window. Internally
* uses hagl_fill_polygon() to draw the triangle.
*
* @param x0
* @param y0
* @param x1
* @param y1
* @param x2
* @param y3
* @param color
*/
void GL_DrawFilledTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, LCD_DRAWMODE_t drawMode);
/**
* Draw a rounded rectangle
*
* Output will be clipped to the current clip window.
*
* @param x0
* @param y0
* @param x0
* @param y0
* @param r corner radius
* @param color
*/
void GL_DrawRoundedRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t r, LCD_DRAWMODE_t drawMode);
/**
* Draw a filled rounded rectangle
*
* Output will be clipped to the current clip window.
*
* @param x0
* @param y0
* @param x1
* @param y1
* @param r corner radius
* @param color
*/
void GL_DrawFilledRoundedRectangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t r, LCD_DRAWMODE_t drawMode);
uint16_t GL_GetColorBitmapWidth(const uint16_t *bitmap);
uint16_t GL_GetColorBitmapHeight(const uint16_t *bitmap);
void GL_DrawColorBitmap(const uint16_t *bitmap, uint16_t x0, uint16_t y0);
uint32_t GL_GetMonoBitmapWidth(const uint32_t *bitmap);
uint32_t GL_GetMonoBitmapHeight(const uint32_t *bitmap);
void GL_DrawMonoBitmap(const uint32_t *bitmap, uint16_t x0, uint16_t y0, LCD_DRAWMODE_t drawMode);
void GL_DrawMonoBitmapCentered(const uint32_t *bitmap, LCD_DRAWMODE_t drawMode);
#endif /* GRAPHICS_GRAPHICSLIBRARY_H_ */