summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lib/grayscale.h93
1 files changed, 93 insertions, 0 deletions
diff --git a/apps/plugins/lib/grayscale.h b/apps/plugins/lib/grayscale.h
new file mode 100644
index 0000000000..7c4b5715ed
--- /dev/null
+++ b/apps/plugins/lib/grayscale.h
@@ -0,0 +1,93 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Grayscale framework & demo plugin
11*
12* Copyright (C) 2004 Jens Arnold
13*
14* All files in this archive are subject to the GNU General Public License.
15* See the file COPYING in the source tree root for full license agreement.
16*
17* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18* KIND, either express or implied.
19*
20****************************************************************************/
21
22/* You do not want to touch these if you don't know exactly what you're
23 * doing. */
24
25#define GRAY_RUNNING 0x0001 /* grayscale overlay is running */
26#define GRAY_DEFERRED_UPDATE 0x0002 /* lcd_update() requested */
27
28/* unsigned 16 bit multiplication (a single instruction on the SH) */
29#define MULU16(a, b) (((unsigned short) (a)) * ((unsigned short) (b)))
30
31typedef struct
32{
33 int x;
34 int by; /* 8-pixel units */
35 int width;
36 int height;
37 int bheight; /* 8-pixel units */
38 int plane_size;
39 int depth; /* number_of_bitplanes = (number_of_grayscales - 1) */
40 int cur_plane; /* for the timer isr */
41 unsigned long randmask; /* mask for random value in graypixel() */
42 unsigned long flags; /* various flags, see #defines */
43 unsigned char *data; /* pointer to start of bitplane data */
44 unsigned long *bitpattern; /* pointer to start of pattern table */
45} tGraybuf;
46
47static tGraybuf *graybuf = NULL;
48static short gray_random_buffer;
49
50/** prototypes **/
51
52void gray_timer_isr(void);
53void graypixel(int x, int y, unsigned long pattern);
54void grayblock(int x, int by, unsigned char* src, int stride);
55void grayinvertmasked(int x, int by, unsigned char mask);
56int gray_init_buffer(unsigned char *gbuf, int gbuf_size, int width,
57 int bheight, int depth);
58void gray_release_buffer(void);
59void gray_position_display(int x, int by);
60void gray_show_display(bool enable);
61
62/* functions affecting the whole display */
63void gray_clear_display(void);
64void gray_black_display(void);
65void gray_deferred_update(void);
66
67/* scrolling functions */
68void gray_scroll_left(int count, bool black_border);
69void gray_scroll_right(int count, bool black_border);
70void gray_scroll_up8(bool black_border);
71void gray_scroll_down8(bool black_border);
72void gray_scroll_up(int count, bool black_border);
73void gray_scroll_down(int count, bool black_border);
74
75/* pixel functions */
76void gray_drawpixel(int x, int y, int brightness);
77void gray_invertpixel(int x, int y);
78
79/* line functions */
80void gray_drawline(int x1, int y1, int x2, int y2, int brightness);
81void gray_invertline(int x1, int y1, int x2, int y2);
82
83/* rectangle functions */
84void gray_drawrect(int x1, int y1, int x2, int y2, int brightness);
85void gray_fillrect(int x1, int y1, int x2, int y2, int brightness);
86void gray_invertrect(int x1, int y1, int x2, int y2);
87
88/* bitmap functions */
89void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny,
90 int stride);
91void gray_drawbitmap(unsigned char *src, int x, int y, int nx, int ny,
92 int stride, bool draw_bg, int fg_brightness,
93 int bg_brightness);