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