Fixed typos
[hackover2013-badge-firmware.git] / drivers / lcd / tft / drawing.h
1 /**************************************************************************/
2 /*!
3 @file drawing.h
4 @author K. Townsend (microBuilder.eu)
5 @date 22 March 2010
6 @version 0.10
7
8 @section LICENSE
9
10 Software License Agreement (BSD License)
11
12 Copyright (c) 2010, microBuilder SARL
13 All rights reserved.
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions are met:
17 1. Redistributions of source code must retain the above copyright
18 notice, this list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright
20 notice, this list of conditions and the following disclaimer in the
21 documentation and/or other materials provided with the distribution.
22 3. Neither the name of the copyright holders nor the
23 names of its contributors may be used to endorse or promote products
24 derived from this software without specific prior written permission.
25
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
27 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
28 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
29 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
30 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
31 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
33 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 */
37 /**************************************************************************/
38 #ifndef __DRAWING_H__
39 #define __DRAWING_H__
40
41 #include "projectconfig.h"
42 #include "lcd.h"
43 #include "colors.h"
44 #include "drivers/lcd/tft/fonts/bitmapfonts.h"
45
46 #if defined CFG_TFTLCD_INCLUDESMALLFONTS & CFG_TFTLCD_INCLUDESMALLFONTS == 1
47 #include "drivers/lcd/smallfonts.h"
48 #endif
49
50 #ifdef CFG_SDCARD
51 #include "bmp.h"
52 #endif
53
54 typedef struct
55 {
56 uint8_t red;
57 uint8_t green;
58 uint8_t blue;
59 } drawColorRGB24_t;
60
61 typedef enum
62 {
63 DRAW_ROUNDEDCORNERS_NONE = 0,
64 DRAW_ROUNDEDCORNERS_ALL = 1,
65 DRAW_ROUNDEDCORNERS_TOP = 2,
66 DRAW_ROUNDEDCORNERS_BOTTOM = 3,
67 DRAW_ROUNDEDCORNERS_LEFT = 4,
68 DRAW_ROUNDEDCORNERS_RIGHT = 5
69 } drawRoundedCorners_t;
70
71 typedef enum
72 {
73 DRAW_CORNERPOSITION_TOPLEFT = 0,
74 DRAW_CORNERPOSITION_TOPRIGHT = 1,
75 DRAW_CORNERPOSITION_BOTTOMLEFT = 2,
76 DRAW_CORNERPOSITION_BOTTOMRIGHT = 3
77 } drawCornerPosition_t;
78
79 typedef enum
80 {
81 DRAW_DIRECTION_LEFT,
82 DRAW_DIRECTION_RIGHT,
83 DRAW_DIRECTION_UP,
84 DRAW_DIRECTION_DOWN
85 } drawDirection_t;
86
87 void drawTestPattern ( void );
88 void drawPixel ( uint16_t x, uint16_t y, uint16_t color );
89 void drawFill ( uint16_t color );
90 void drawLine ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color );
91 void drawLineDotted ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t space, uint16_t solid, uint16_t color );
92 void drawCircle ( uint16_t xCenter, uint16_t yCenter, uint16_t radius, uint16_t color );
93 void drawCircleFilled ( uint16_t xCenter, uint16_t yCenter, uint16_t radius, uint16_t color );
94 void drawCornerFilled (uint16_t xCenter, uint16_t yCenter, uint16_t radius, drawCornerPosition_t position, uint16_t color);
95 void drawArrow ( uint16_t x, uint16_t y, uint16_t size, drawDirection_t, uint16_t color );
96 void drawRectangle ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color );
97 void drawRectangleFilled ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color );
98 void drawRectangleRounded ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color, uint16_t radius, drawRoundedCorners_t corners );
99 void drawTriangle ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
100 void drawTriangleFilled ( uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, uint16_t color);
101 void drawString ( uint16_t x, uint16_t y, uint16_t color, const FONT_INFO *fontInfo, char *str );
102 uint16_t drawGetStringWidth ( const FONT_INFO *fontInfo, char *str );
103 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 );
104 void drawButton ( uint16_t x, uint16_t y, uint16_t width, uint16_t height, const FONT_INFO *fontInfo, uint16_t fontHeight, uint16_t borderclr, uint16_t fillclr, uint16_t fontclr, char* text );
105 void drawIcon16 ( uint16_t x, uint16_t y, uint16_t color, uint16_t icon[] );
106 uint16_t drawRGB24toRGB565 ( uint8_t r, uint8_t g, uint8_t b );
107 uint32_t drawRGB565toBGRA32 ( uint16_t color );
108 uint16_t drawBGR2RGB ( uint16_t color );
109
110 #if defined CFG_TFTLCD_INCLUDESMALLFONTS & CFG_TFTLCD_INCLUDESMALLFONTS == 1
111 void drawStringSmall ( uint16_t x, uint16_t y, uint16_t color, char* text, struct FONT_DEF font );
112 #endif
113
114 #if defined CFG_SDCARD
115 bmp_error_t drawBitmapImage ( uint16_t x, uint16_t y, char *filename );
116 #endif
117
118 #endif
This page took 0.050405 seconds and 5 git commands to generate.