Video plugin: Fix OSD for font_height != 8. Don't fiddle with the framebuffer directl...
[kugel-rb.git] / apps / screen_access.h
blobc76d2b1c8617a3ffc33b2e820857763d52d36cc3
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"
28 enum screen_type {
29 SCREEN_MAIN
30 #ifdef HAVE_REMOTE_LCD
31 ,SCREEN_REMOTE
32 #endif
35 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
36 #define NB_SCREENS 2
37 #else
38 #define NB_SCREENS 1
39 #endif
41 #if NB_SCREENS == 1
42 #define FOR_NB_SCREENS(i) i = 0;
43 #else
44 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
45 #endif
47 #ifdef HAVE_LCD_CHARCELLS
48 #define MAX_LINES_ON_SCREEN 2
49 #endif
51 typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
52 int stride, int x, int y, int width, int height);
53 typedef void screen_bitmap_func(const void *src, int x, int y, int width,
54 int height);
56 /* if this struct is changed the plugin api may break so bump the api
57 versions in plugin.h */
58 struct screen
60 enum screen_type screen_type;
61 int lcdwidth, lcdheight;
62 int depth;
63 int (*getnblines)(void);
64 #ifdef HAVE_LCD_BITMAP
65 int pixel_format;
66 #endif
67 int (*getcharwidth)(void);
68 int (*getcharheight)(void);
69 bool is_color;
70 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
71 bool has_disk_led;
72 #endif
73 #ifdef HAVE_BUTTONBAR
74 bool has_buttonbar;
75 #endif
76 void (*set_viewport)(struct viewport* vp);
77 int (*getwidth)(void);
78 int (*getheight)(void);
79 int (*getstringsize)(const unsigned char *str, int *w, int *h);
80 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
81 void (*setfont)(int newfont);
82 int (*getfont)(void);
84 void (*scroll_step)(int pixels);
85 void (*puts_style_offset)(int x, int y, const unsigned char *str,
86 int style, int offset);
87 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
88 int style);
89 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
90 int style, int offset);
91 void (*mono_bitmap)(const unsigned char *src,
92 int x, int y, int width, int height);
93 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
94 int stride, int x, int y, int width, int height);
95 void (*bitmap)(const void *src,
96 int x, int y, int width, int height);
97 void (*bitmap_part)(const void *src, int src_x, int src_y,
98 int stride, int x, int y, int width, int height);
99 void (*transparent_bitmap)(const void *src,
100 int x, int y, int width, int height);
101 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
102 int stride, int x, int y, int width, int height);
103 void (*set_drawmode)(int mode);
104 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
105 unsigned (*color_to_native)(unsigned color);
106 #endif
107 #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
108 unsigned (*get_background)(void);
109 unsigned (*get_foreground)(void);
110 void (*set_background)(unsigned background);
111 void (*set_foreground)(unsigned foreground);
112 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
113 #if defined(HAVE_LCD_COLOR)
114 void (*set_selector_start)(unsigned selector);
115 void (*set_selector_end)(unsigned selector);
116 void (*set_selector_text)(unsigned selector_text);
117 #endif
118 void (*update_rect)(int x, int y, int width, int height);
119 void (*update_viewport_rect)(int x, int y, int width, int height);
120 void (*fillrect)(int x, int y, int width, int height);
121 void (*drawrect)(int x, int y, int width, int height);
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 void (*putc)(int x, int y, unsigned long ucs);
131 void (*icon)(int icon, bool enable);
132 unsigned long (*get_locked_pattern)(void);
133 void (*define_pattern)(unsigned long ucs, const char *pattern);
134 void (*unlock_pattern)(unsigned long ucs);
135 #endif
136 void (*putsxy)(int x, int y, const unsigned char *str);
137 void (*puts)(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 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)(struct viewport* vp);
148 void (*scroll_stop_line)(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);
157 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
159 * Clear only a given area of the screen
160 * - screen : the screen structure
161 * - xstart, ystart : where the area starts
162 * - width, height : size of the area
164 void screen_clear_area(struct screen * display, int xstart, int ystart,
165 int width, int height);
166 #endif
169 * exported screens array that should be used
170 * by each app that wants to write to access display
172 extern struct screen screens[NB_SCREENS];
174 #endif /*_SCREEN_ACCESS_H_*/