1 | /* ---------------------------------------------------------------------------- */ |
---|
2 | /* Atmel Microcontroller Software Support */ |
---|
3 | /* SAM Software Package License */ |
---|
4 | /* ---------------------------------------------------------------------------- */ |
---|
5 | /* Copyright (c) 2015, Atmel Corporation */ |
---|
6 | /* */ |
---|
7 | /* All rights reserved. */ |
---|
8 | /* */ |
---|
9 | /* Redistribution and use in source and binary forms, with or without */ |
---|
10 | /* modification, are permitted provided that the following condition is met: */ |
---|
11 | /* */ |
---|
12 | /* - Redistributions of source code must retain the above copyright notice, */ |
---|
13 | /* this list of conditions and the disclaimer below. */ |
---|
14 | /* */ |
---|
15 | /* Atmel's name may not be used to endorse or promote products derived from */ |
---|
16 | /* this software without specific prior written permission. */ |
---|
17 | /* */ |
---|
18 | /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ |
---|
19 | /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ |
---|
20 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ |
---|
21 | /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ |
---|
22 | /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ |
---|
23 | /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ |
---|
24 | /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ |
---|
25 | /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ |
---|
26 | /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ |
---|
27 | /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
---|
28 | /* ---------------------------------------------------------------------------- */ |
---|
29 | |
---|
30 | /** |
---|
31 | * \file |
---|
32 | * |
---|
33 | * Interface for draw function on LCD. |
---|
34 | * |
---|
35 | */ |
---|
36 | |
---|
37 | #ifndef DRAW_H |
---|
38 | #define DRAW_H |
---|
39 | |
---|
40 | /*---------------------------------------------------------------------------- |
---|
41 | * Headers |
---|
42 | *----------------------------------------------------------------------------*/ |
---|
43 | #include "board.h" |
---|
44 | #include <stdint.h> |
---|
45 | #include "lcd_gimp_image.h" |
---|
46 | |
---|
47 | /*---------------------------------------------------------------------------- |
---|
48 | * Definitions |
---|
49 | *----------------------------------------------------------------------------*/ |
---|
50 | |
---|
51 | /** Horizontal direction line definition */ |
---|
52 | #define DIRECTION_HLINE 0 |
---|
53 | /** Vertical direction line definition */ |
---|
54 | #define DIRECTION_VLINE 1 |
---|
55 | |
---|
56 | typedef struct _rect { |
---|
57 | uint32_t x; |
---|
58 | uint32_t y; |
---|
59 | uint32_t width; |
---|
60 | uint32_t height; |
---|
61 | } rect; |
---|
62 | |
---|
63 | COMPILER_PACK_SET(1) |
---|
64 | typedef struct _rgb { |
---|
65 | uint8_t b; |
---|
66 | uint8_t g; |
---|
67 | uint8_t r; |
---|
68 | } sBGR; |
---|
69 | COMPILER_PACK_RESET() |
---|
70 | |
---|
71 | /*---------------------------------------------------------------------------- |
---|
72 | * Exported functions |
---|
73 | *----------------------------------------------------------------------------*/ |
---|
74 | extern void LCDD_SetUpdateWindowSize(rect rc); |
---|
75 | |
---|
76 | extern void LCDD_UpdateWindow(void); |
---|
77 | |
---|
78 | extern void LCDD_UpdatePartialWindow(uint8_t *pbuf, uint32_t size); |
---|
79 | |
---|
80 | extern void LCDD_DrawRectangleWithFill( |
---|
81 | uint16_t *pbuf, |
---|
82 | uint32_t dwX, |
---|
83 | uint32_t dwY, |
---|
84 | uint32_t dwWidth, |
---|
85 | uint32_t dwHeight, |
---|
86 | uint32_t dwColor); |
---|
87 | |
---|
88 | extern uint32_t LCDD_DrawCircle( |
---|
89 | uint16_t *pbuf, |
---|
90 | uint32_t x, |
---|
91 | uint32_t y, |
---|
92 | uint32_t r, |
---|
93 | uint32_t color); |
---|
94 | |
---|
95 | extern uint32_t LCD_DrawFilledCircle( |
---|
96 | uint16_t *pbuf, |
---|
97 | uint32_t dwX, |
---|
98 | uint32_t dwY, |
---|
99 | uint32_t dwRadius, |
---|
100 | uint32_t color); |
---|
101 | |
---|
102 | extern void LCDD_DrawString( |
---|
103 | uint16_t *pbuf, |
---|
104 | uint32_t x, |
---|
105 | uint32_t y, |
---|
106 | const uint8_t *pString, |
---|
107 | uint32_t color); |
---|
108 | |
---|
109 | extern void LCDD_GetStringSize( |
---|
110 | const uint8_t *pString, |
---|
111 | uint32_t *pWidth, |
---|
112 | uint32_t *pHeight); |
---|
113 | |
---|
114 | extern void LCDD_BitBlt( |
---|
115 | uint16_t *pbuf, |
---|
116 | uint32_t dst_x, |
---|
117 | uint32_t dst_y, |
---|
118 | uint32_t dst_w, |
---|
119 | uint32_t dst_h, |
---|
120 | const LcdColor_t *src, |
---|
121 | uint32_t src_x, |
---|
122 | uint32_t src_y, |
---|
123 | uint32_t src_w, |
---|
124 | uint32_t src_h); |
---|
125 | |
---|
126 | extern void LCDD_BitBltAlphaBlend(uint16_t *pbuf, |
---|
127 | uint32_t dst_x, |
---|
128 | uint32_t dst_y, |
---|
129 | uint32_t dst_w, |
---|
130 | uint32_t dst_h, |
---|
131 | const LcdColor_t *src, |
---|
132 | uint32_t src_x, |
---|
133 | uint32_t src_y, |
---|
134 | uint32_t src_w, |
---|
135 | uint32_t src_h, |
---|
136 | uint32_t alpha); |
---|
137 | extern void LCDD_DrawImage( |
---|
138 | uint16_t *pbuf, |
---|
139 | uint32_t dwX, |
---|
140 | uint32_t dwY, |
---|
141 | const LcdColor_t *pImage, |
---|
142 | uint32_t dwWidth, |
---|
143 | uint32_t dwHeight); |
---|
144 | |
---|
145 | extern void LCDD_DrawPixel( |
---|
146 | uint16_t *pbuf, |
---|
147 | uint32_t x, |
---|
148 | uint32_t y, |
---|
149 | uint32_t color); |
---|
150 | |
---|
151 | extern void LCDD_DrawLine( |
---|
152 | uint16_t *pbuf, |
---|
153 | uint32_t dwX1, |
---|
154 | uint32_t dwY1, |
---|
155 | uint32_t dwX2, |
---|
156 | uint32_t dwY2, |
---|
157 | uint32_t color); |
---|
158 | |
---|
159 | extern uint32_t LCDD_DrawLineBresenham( |
---|
160 | uint16_t *pbuf, |
---|
161 | uint32_t dwX1, |
---|
162 | uint32_t dwY1, |
---|
163 | uint32_t dwX2, |
---|
164 | uint32_t dwY2, |
---|
165 | uint32_t color); |
---|
166 | |
---|
167 | extern void LCDD_DrawRectangle( |
---|
168 | uint16_t *pbuf, |
---|
169 | uint32_t x, |
---|
170 | uint32_t y, |
---|
171 | uint32_t width, |
---|
172 | uint32_t height, |
---|
173 | uint32_t color); |
---|
174 | |
---|
175 | extern void LCDD_SetCavasBuffer( |
---|
176 | void *pBuffer, |
---|
177 | uint32_t wBufferSize); |
---|
178 | |
---|
179 | extern void LCDD_DrawStraightLine( |
---|
180 | uint16_t *pbuf, |
---|
181 | uint32_t dwX1, |
---|
182 | uint32_t dwY1, |
---|
183 | uint32_t dwX2, |
---|
184 | uint32_t dwY2 , |
---|
185 | uint32_t color); |
---|
186 | #endif /* #ifndef DRAW_H */ |
---|