diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-05-19 08:03:43 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-05-19 08:03:43 +0000 |
commit | a9244032d2786997bf72a4b5f3f260579446df04 (patch) | |
tree | 69f2659c1f12d435a76fa854f60d190d0e18f2f4 /apps | |
parent | 8b043aece9597a4b486d13327b2edb74cb9efe98 (diff) | |
download | rockbox-a9244032d2786997bf72a4b5f3f260579446df04.tar.gz rockbox-a9244032d2786997bf72a4b5f3f260579446df04.zip |
grayscale framework header
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4638 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/plugins/lib/grayscale.h | 93 |
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 | |||
31 | typedef 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 | |||
47 | static tGraybuf *graybuf = NULL; | ||
48 | static short gray_random_buffer; | ||
49 | |||
50 | /** prototypes **/ | ||
51 | |||
52 | void gray_timer_isr(void); | ||
53 | void graypixel(int x, int y, unsigned long pattern); | ||
54 | void grayblock(int x, int by, unsigned char* src, int stride); | ||
55 | void grayinvertmasked(int x, int by, unsigned char mask); | ||
56 | int gray_init_buffer(unsigned char *gbuf, int gbuf_size, int width, | ||
57 | int bheight, int depth); | ||
58 | void gray_release_buffer(void); | ||
59 | void gray_position_display(int x, int by); | ||
60 | void gray_show_display(bool enable); | ||
61 | |||
62 | /* functions affecting the whole display */ | ||
63 | void gray_clear_display(void); | ||
64 | void gray_black_display(void); | ||
65 | void gray_deferred_update(void); | ||
66 | |||
67 | /* scrolling functions */ | ||
68 | void gray_scroll_left(int count, bool black_border); | ||
69 | void gray_scroll_right(int count, bool black_border); | ||
70 | void gray_scroll_up8(bool black_border); | ||
71 | void gray_scroll_down8(bool black_border); | ||
72 | void gray_scroll_up(int count, bool black_border); | ||
73 | void gray_scroll_down(int count, bool black_border); | ||
74 | |||
75 | /* pixel functions */ | ||
76 | void gray_drawpixel(int x, int y, int brightness); | ||
77 | void gray_invertpixel(int x, int y); | ||
78 | |||
79 | /* line functions */ | ||
80 | void gray_drawline(int x1, int y1, int x2, int y2, int brightness); | ||
81 | void gray_invertline(int x1, int y1, int x2, int y2); | ||
82 | |||
83 | /* rectangle functions */ | ||
84 | void gray_drawrect(int x1, int y1, int x2, int y2, int brightness); | ||
85 | void gray_fillrect(int x1, int y1, int x2, int y2, int brightness); | ||
86 | void gray_invertrect(int x1, int y1, int x2, int y2); | ||
87 | |||
88 | /* bitmap functions */ | ||
89 | void gray_drawgraymap(unsigned char *src, int x, int y, int nx, int ny, | ||
90 | int stride); | ||
91 | void 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); | ||