MPIO manual: screenshots
[maemo-rb.git] / apps / screen_access.h
blobefe232b50ef0d2f57fd2863756b2e86d41c9d41e
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 #else
32 #define NB_SCREENS 1
33 #endif
35 #if NB_SCREENS == 1
36 #define FOR_NB_SCREENS(i) i = 0;
37 #else
38 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
39 #endif
41 #ifdef HAVE_LCD_CHARCELLS
42 #define MAX_LINES_ON_SCREEN 2
43 #endif
45 typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
46 int stride, int x, int y, int width, int height);
47 typedef void screen_bitmap_func(const void *src, int x, int y, int width,
48 int height);
50 /* if this struct is changed the plugin api may break so bump the api
51 versions in plugin.h */
52 struct screen
54 enum screen_type screen_type;
55 int lcdwidth, lcdheight;
56 int depth;
57 int (*getnblines)(void);
58 #ifdef HAVE_LCD_BITMAP
59 int pixel_format;
60 #endif
61 int (*getcharwidth)(void);
62 int (*getcharheight)(void);
63 bool is_color;
64 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
65 bool has_disk_led;
66 #endif
67 #ifdef HAVE_BUTTONBAR
68 bool has_buttonbar;
69 #endif
70 void (*set_viewport)(struct viewport* vp);
71 int (*getwidth)(void);
72 int (*getheight)(void);
73 int (*getstringsize)(const unsigned char *str, int *w, int *h);
74 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
75 void (*setfont)(int newfont);
76 int (*getfont)(void);
78 void (*scroll_step)(int pixels);
79 void (*puts_style_offset)(int x, int y, const unsigned char *str,
80 int style, int x_offset);
81 void (*puts_style_xyoffset)(int x, int y, const unsigned char *str,
82 int style, int x_offset, int y_offset);
83 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
84 int style);
85 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
86 int style, int x_offset);
87 void (*puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
88 int style, int x_offset, int y_offset);
89 void (*mono_bitmap)(const unsigned char *src,
90 int x, int y, int width, int height);
91 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
92 int stride, int x, int y, int width, int height);
93 void (*bitmap)(const void *src,
94 int x, int y, int width, int height);
95 void (*bitmap_part)(const void *src, int src_x, int src_y,
96 int stride, int x, int y, int width, int height);
97 void (*transparent_bitmap)(const void *src,
98 int x, int y, int width, int height);
99 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
100 int stride, int x, int y, int width, int height);
101 void (*set_drawmode)(int mode);
102 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
103 unsigned (*color_to_native)(unsigned color);
104 #endif
105 #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
106 unsigned (*get_background)(void);
107 unsigned (*get_foreground)(void);
108 void (*set_background)(unsigned background);
109 void (*set_foreground)(unsigned foreground);
110 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
111 #if defined(HAVE_LCD_COLOR)
112 void (*set_selector_start)(unsigned selector);
113 void (*set_selector_end)(unsigned selector);
114 void (*set_selector_text)(unsigned selector_text);
115 #endif
116 void (*update_rect)(int x, int y, int width, int height);
117 void (*update_viewport_rect)(int x, int y, int width, int height);
118 void (*fillrect)(int x, int y, int width, int height);
119 void (*drawrect)(int x, int y, int width, int height);
120 void (*fill_viewport)(void);
121 void (*draw_border_viewport)(void);
122 void (*drawpixel)(int x, int y);
123 void (*drawline)(int x1, int y1, int x2, int y2);
124 void (*vline)(int x, int y1, int y2);
125 void (*hline)(int x1, int x2, int y);
126 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
128 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
129 void (*double_height)(bool on);
130 /* name it putchar, not putc because putc is a c library function */
131 void (*putchar)(int x, int y, unsigned long ucs);
132 void (*icon)(int icon, bool enable);
133 unsigned long (*get_locked_pattern)(void);
134 void (*define_pattern)(unsigned long ucs, const char *pattern);
135 void (*unlock_pattern)(unsigned long ucs);
136 #endif
137 void (*putsxy)(int x, int y, const unsigned char *str);
138 void (*puts)(int x, int y, const unsigned char *str);
139 void (*putsf)(int x, int y, const unsigned char *str, ...);
140 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
141 void (*puts_scroll)(int x, int y, const unsigned char *string);
142 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
143 int x_offset);
144 void (*scroll_speed)(int speed);
145 void (*scroll_delay)(int ms);
146 void (*stop_scroll)(void);
147 void (*clear_display)(void);
148 void (*clear_viewport)(void);
149 void (*scroll_stop)(const struct viewport* vp);
150 void (*scroll_stop_line)(const struct viewport* vp, int y);
151 void (*update)(void);
152 void (*update_viewport)(void);
153 void (*backlight_on)(void);
154 void (*backlight_off)(void);
155 bool (*is_backlight_on)(bool ignore_always_off);
156 void (*backlight_set_timeout)(int index);
157 #if LCD_DEPTH > 1
158 bool (*backdrop_load)(const char *filename, char* backdrop_buffer);
159 void (*backdrop_show)(char* backdrop_buffer);
160 #endif
163 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
165 * Clear only a given area of the screen
166 * - screen : the screen structure
167 * - xstart, ystart : where the area starts
168 * - width, height : size of the area
170 void screen_clear_area(struct screen * display, int xstart, int ystart,
171 int width, int height);
172 #endif
175 * exported screens array that should be used
176 * by each app that wants to write to access display
178 extern struct screen screens[NB_SCREENS];
180 #endif /*_SCREEN_ACCESS_H_*/