Rename internal h10_5gb.ums name and add some comments.
[maemo-rb.git] / apps / screen_access.h
blob271321981131752bca4f493a9f0db79cf1c6d6b4
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _SCREEN_ACCESS_H_
23 #define _SCREEN_ACCESS_H_
25 #include "lcd.h"
26 #include "buttonbar.h"
27 #include "backdrop.h"
29 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
30 #define NB_SCREENS 2
31 void screen_helper_remote_setfont(int font);
32 #else
33 #define NB_SCREENS 1
34 #endif
35 void screen_helper_setfont(int font);
37 #define FOR_NB_SCREENS(i) for(int i = 0; i < NB_SCREENS; i++)
39 #ifdef HAVE_LCD_CHARCELLS
40 #define MAX_LINES_ON_SCREEN 2
41 #endif
43 typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
44 int stride, int x, int y, int width, int height);
45 typedef void screen_bitmap_func(const void *src, int x, int y, int width,
46 int height);
48 /* if this struct is changed the plugin api may break so bump the api
49 versions in plugin.h */
50 struct screen
52 enum screen_type screen_type;
53 int lcdwidth, lcdheight;
54 int depth;
55 int (*getnblines)(void);
56 #ifdef HAVE_LCD_BITMAP
57 int pixel_format;
58 #endif
59 int (*getcharwidth)(void);
60 int (*getcharheight)(void);
61 bool is_color;
62 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
63 bool has_disk_led;
64 #endif
65 #ifdef HAVE_BUTTONBAR
66 bool has_buttonbar;
67 #endif
68 void (*set_viewport)(struct viewport* vp);
69 int (*getwidth)(void);
70 int (*getheight)(void);
71 int (*getstringsize)(const unsigned char *str, int *w, int *h);
72 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
73 void (*setfont)(int newfont);
74 int (*getfont)(void);
76 void (*scroll_step)(int pixels);
77 void (*puts_style_offset)(int x, int y, const unsigned char *str,
78 int style, int x_offset);
79 void (*puts_style_xyoffset)(int x, int y, const unsigned char *str,
80 int style, int x_offset, int y_offset);
81 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
82 int style);
83 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
84 int style, int x_offset);
85 void (*puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
86 int style, int x_offset, int y_offset);
87 void (*mono_bitmap)(const unsigned char *src,
88 int x, int y, int width, int height);
89 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
90 int stride, int x, int y, int width, int height);
91 void (*bitmap)(const void *src,
92 int x, int y, int width, int height);
93 void (*bitmap_part)(const void *src, int src_x, int src_y,
94 int stride, int x, int y, int width, int height);
95 void (*transparent_bitmap)(const void *src,
96 int x, int y, int width, int height);
97 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
98 int stride, int x, int y, int width, int height);
99 void (*set_drawmode)(int mode);
100 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
101 unsigned (*color_to_native)(unsigned color);
102 #endif
103 #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
104 unsigned (*get_background)(void);
105 unsigned (*get_foreground)(void);
106 void (*set_background)(unsigned background);
107 void (*set_foreground)(unsigned foreground);
108 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
109 #if defined(HAVE_LCD_COLOR)
110 void (*set_selector_start)(unsigned selector);
111 void (*set_selector_end)(unsigned selector);
112 void (*set_selector_text)(unsigned selector_text);
113 #endif
114 void (*update_rect)(int x, int y, int width, int height);
115 void (*update_viewport_rect)(int x, int y, int width, int height);
116 void (*fillrect)(int x, int y, int width, int height);
117 void (*drawrect)(int x, int y, int width, int height);
118 void (*fill_viewport)(void);
119 void (*draw_border_viewport)(void);
120 void (*drawpixel)(int x, int y);
121 void (*drawline)(int x1, int y1, int x2, int y2);
122 void (*vline)(int x, int y1, int y2);
123 void (*hline)(int x1, int x2, int y);
124 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
126 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
127 void (*double_height)(bool on);
128 /* name it putchar, not putc because putc is a c library function */
129 void (*putchar)(int x, int y, unsigned long ucs);
130 void (*icon)(int icon, bool enable);
131 unsigned long (*get_locked_pattern)(void);
132 void (*define_pattern)(unsigned long ucs, const char *pattern);
133 void (*unlock_pattern)(unsigned long ucs);
134 #endif
135 void (*putsxy)(int x, int y, const unsigned char *str);
136 void (*puts)(int x, int y, const unsigned char *str);
137 void (*putsf)(int x, int y, const unsigned char *str, ...);
138 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
139 void (*puts_scroll)(int x, int y, const unsigned char *string);
140 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
141 int x_offset);
142 void (*scroll_speed)(int speed);
143 void (*scroll_delay)(int ms);
144 void (*stop_scroll)(void);
145 void (*clear_display)(void);
146 void (*clear_viewport)(void);
147 void (*scroll_stop)(const struct viewport* vp);
148 void (*scroll_stop_line)(const struct viewport* vp, int y);
149 void (*update)(void);
150 void (*update_viewport)(void);
151 void (*backlight_on)(void);
152 void (*backlight_off)(void);
153 bool (*is_backlight_on)(bool ignore_always_off);
154 void (*backlight_set_timeout)(int index);
155 #if LCD_DEPTH > 1
156 bool (*backdrop_load)(const char *filename, char* backdrop_buffer);
157 void (*backdrop_show)(char* backdrop_buffer);
158 #endif
161 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
163 * Clear only a given area of the screen
164 * - screen : the screen structure
165 * - xstart, ystart : where the area starts
166 * - width, height : size of the area
168 void screen_clear_area(struct screen * display, int xstart, int ystart,
169 int width, int height);
170 #endif
173 * exported screens array that should be used
174 * by each app that wants to write to access display
176 extern struct screen screens[NB_SCREENS];
178 #endif /*_SCREEN_ACCESS_H_*/