1 /**
2  * \file
3  *
4  * \brief Generic monochrome LCD graphic primitives
5  *
6  * Copyright (c) 2011-2015 Atmel Corporation. All rights reserved.
7  *
8  * \asf_license_start
9  *
10  * \page License
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions are met:
14  *
15  * 1. Redistributions of source code must retain the above copyright notice,
16  *    this list of conditions and the following disclaimer.
17  *
18  * 2. Redistributions in binary form must reproduce the above copyright notice,
19  *    this list of conditions and the following disclaimer in the documentation
20  *    and/or other materials provided with the distribution.
21  *
22  * 3. The name of Atmel may not be used to endorse or promote products derived
23  *    from this software without specific prior written permission.
24  *
25  * 4. This software may only be redistributed and used in connection with an
26  *    Atmel microcontroller product.
27  *
28  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
29  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
31  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
32  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGE.
39  *
40  * \asf_license_stop
41  *
42  */
43 /*
44  * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
45  */
46 #ifndef GFX_MONO_GENERIC
47 #define GFX_MONO_GENERIC
48 #include "gfx_mono.h"
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /**
55  * \ingroup asfdoc_common2_gfx_mono
56  * \defgroup asfdoc_common2_gfx_mono_generic_group Generic monochrome graphic primitives
57  *
58  * This is a service providing generic implementations of graphic primitives
59  * - Horizontal line
60  * - Vertical line
61  * - Line
62  * - Circle (filled/not filled)
63  * - Rectangle (filled/not filled)
64  *
65  * it also provides functionality to draw a bitmap to the graphic memory.
66  *
67  * These functions are made available if the graphic hardware being used do
68  * not implement the functionality in hardware. This is true in most cases.
69  *
70  * This service is included as a requirement for a
71  * hardware specific component that uses these functions, and provides a
72  * asfdoc_common2_draw_pixel function.
73  *
74  * @{
75  */
76 
77 /**
78  * \brief Storage structure for bitmap pixel data and metadata
79  */
80 struct gfx_mono_bitmap {
81 	/** Width of bitmap */
82 	gfx_coord_t width;
83 	/** Height of bitmap */
84 	gfx_coord_t height;
85 	/** Bitmap type */
86 	enum gfx_mono_bitmap_type type;
87 	union {
88 		/** Pointer to pixels for bitmap stored in RAM */
89 		gfx_mono_color_t *pixmap;
90 		/** Pointer to pixels for bitmap stored in progmem */
91 		gfx_mono_color_t PROGMEM_T *progmem;
92 	}
93 	data;
94 };
95 
96 void gfx_mono_generic_draw_horizontal_line(gfx_coord_t x, gfx_coord_t y,
97 		gfx_coord_t length, enum gfx_mono_color color);
98 
99 void gfx_mono_generic_draw_vertical_line(gfx_coord_t x, gfx_coord_t y,
100 		gfx_coord_t length, enum gfx_mono_color color);
101 
102 void gfx_mono_generic_draw_line(gfx_coord_t x1, gfx_coord_t y1,
103 		gfx_coord_t x2, gfx_coord_t y2,
104 		enum gfx_mono_color color);
105 
106 void gfx_mono_generic_draw_rect(gfx_coord_t x, gfx_coord_t y,
107 		gfx_coord_t width, gfx_coord_t height,
108 		enum gfx_mono_color color);
109 
110 void gfx_mono_generic_draw_filled_rect(gfx_coord_t x, gfx_coord_t y,
111 		gfx_coord_t width, gfx_coord_t height,
112 		enum gfx_mono_color color);
113 
114 void gfx_mono_generic_draw_circle(gfx_coord_t x, gfx_coord_t y,
115 		gfx_coord_t radius, enum gfx_mono_color color,
116 		uint8_t octant_mask);
117 
118 void gfx_mono_generic_draw_filled_circle(gfx_coord_t x, gfx_coord_t y,
119 		gfx_coord_t radius, enum gfx_mono_color color,
120 		uint8_t quadrant_mask);
121 
122 void gfx_mono_generic_put_bitmap(struct gfx_mono_bitmap *bitmap, gfx_coord_t x,
123 		gfx_coord_t y);
124 
125 /** @} */
126 
127 #ifdef __cplusplus
128 }
129 #endif
130 
131 #endif /* GFX_MONO_GENERIC */
132