Patch #1352575 - Shorten codec from the ffmpeg project. Rockbox implementation by...
[Rockbox.git] / apps / screen_access.h
blobc167708fbf4316d3ee3d2c9378b5155c3eee2d85
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef _SCREEN_ACCESS_H_
21 #define _SCREEN_ACCESS_H_
23 #include "lcd.h"
24 #include "buttonbar.h"
26 enum screen_type {
27 SCREEN_MAIN
28 #ifdef HAVE_REMOTE_LCD
29 ,SCREEN_REMOTE
30 #endif
33 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
34 #define NB_SCREENS 2
35 #else
36 #define NB_SCREENS 1
37 #endif
39 #if NB_SCREENS == 1
40 #define FOR_NB_SCREENS(i) i = 0;
41 #else
42 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
43 #endif
45 #ifdef HAVE_LCD_CHARCELLS
46 #define MAX_LINES_ON_SCREEN 2
47 #endif
49 struct screen
51 int width, height;
52 int nb_lines;
53 enum screen_type screen_type;
54 bool is_color;
55 int depth;
56 int char_width;
57 int char_height;
58 #ifdef HAS_BUTTONBAR
59 bool has_buttonbar;
60 #endif
62 #ifdef HAVE_LCD_BITMAP
64 void (*setmargins)(int x, int y);
65 int (*getxmargin)(void);
66 int (*getymargin)(void);
68 void (*setfont)(int newfont);
69 int (*getstringsize)(const unsigned char *str, int *w, int *h);
70 void (*putsxy)(int x, int y, const unsigned char *str);
72 void (*scroll_step)(int pixels);
73 void (*puts_scroll_style)(int x, int y,
74 const unsigned char *string, int style);
75 void (*mono_bitmap)(const unsigned char *src,
76 int x, int y, int width, int height);
77 void (*set_drawmode)(int mode);
78 #if LCD_DEPTH > 1
79 #if HAVE_LCD_COLOR
80 void (*set_background)(struct rgb color);
81 #else
82 void (*set_background)(int brightness);
83 #endif
84 #endif /* LCD_DEPTH > 1 */
85 void (*update_rect)(int x, int y, int width, int height);
86 void (*fillrect)(int x, int y, int width, int height);
87 void (*drawrect)(int x, int y, int width, int height);
88 void (*drawpixel)(int x, int y);
89 void (*drawline)(int x1, int y1, int x2, int y2);
90 void (*vline)(int x, int y1, int y2);
91 void (*hline)(int x1, int x2, int y);
92 void (*invertscroll) (int x, int y);
93 #endif /* HAVE_LCD_BITMAP */
95 #ifdef HAVE_LCD_CHARCELLS
96 void (*double_height)(bool on);
97 void (*putc)(int x, int y, unsigned short ch);
98 void (*icon)(int icon, bool enable);
99 #endif
100 void (*init)(void);
101 void (*puts_scroll)(int x, int y, const unsigned char *string);
102 void (*scroll_speed)(int speed);
103 void (*scroll_delay)(int ms);
104 void (*stop_scroll)(void);
105 void (*clear_display)(void);
106 #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
107 void (*update)(void);
108 #endif
110 void (*puts)(int x, int y, const unsigned char *str);
114 * Initializes the given screen structure for a given display
115 * - screen : the screen structure
116 * - display_type : currently 2 possibles values : MAIN or REMOTE
118 extern void screen_init(struct screen * screen, enum screen_type screen_type);
120 #ifdef HAS_BUTTONBAR
122 * Sets if the given screen has a buttonbar or not
123 * - screen : the screen structure
124 * - has : a boolean telling wether the current screen will have a buttonbar or not
126 #define screen_has_buttonbar(screen, has_btnb) \
127 (screen)->has_buttonbar=has_btnb;
128 #endif
131 * Sets the x margin in pixels for the given screen
132 * - screen : the screen structure
133 * - xmargin : the number of pixels to the left of the screen
135 #define screen_set_xmargin(screen, xmargin) \
136 (screen)->setmargins(xmargin, (screen)->getymargin());
139 * Sets the y margin in pixels for the given screen
140 * - screen : the screen structure
141 * - xmargin : the number of pixels to the top of the screen
143 #define screen_set_ymargin(screen, ymargin) \
144 (screen)->setmargins((screen)->getxmargin(), ymargin);
146 #ifdef HAVE_LCD_BITMAP
148 * Clear only a given area of the screen
149 * - screen : the screen structure
150 * - xstart, ystart : where the area starts
151 * - width, height : size of the area
153 void screen_clear_area(struct screen * display, int xstart, int ystart,
154 int width, int height);
155 #endif
158 * Initializes the whole screen_access api
160 extern void screen_access_init(void);
163 * exported screens array that should be used
164 * by each app that wants to write to access display
166 extern struct screen screens[NB_SCREENS];
168 #endif /*_SCREEN_ACCESS_H_*/