Fix FS#10486 - "fuze screen not drawn correctly on backlight turn-on if playlist...
[kugel-rb/myfork.git] / apps / screen_access.h
blobf0fed0172249412c548fd7e03b11fdebd5a4b79e
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 enum screen_type {
30 SCREEN_MAIN
31 #ifdef HAVE_REMOTE_LCD
32 ,SCREEN_REMOTE
33 #endif
36 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
37 #define NB_SCREENS 2
38 #else
39 #define NB_SCREENS 1
40 #endif
42 #if NB_SCREENS == 1
43 #define FOR_NB_SCREENS(i) i = 0;
44 #else
45 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
46 #endif
48 #ifdef HAVE_LCD_CHARCELLS
49 #define MAX_LINES_ON_SCREEN 2
50 #endif
52 typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
53 int stride, int x, int y, int width, int height);
54 typedef void screen_bitmap_func(const void *src, int x, int y, int width,
55 int height);
57 /* if this struct is changed the plugin api may break so bump the api
58 versions in plugin.h */
59 struct screen
61 enum screen_type screen_type;
62 int lcdwidth, lcdheight;
63 int depth;
64 int (*getnblines)(void);
65 #ifdef HAVE_LCD_BITMAP
66 int pixel_format;
67 #endif
68 int (*getcharwidth)(void);
69 int (*getcharheight)(void);
70 bool is_color;
71 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
72 bool has_disk_led;
73 #endif
74 #ifdef HAVE_BUTTONBAR
75 bool has_buttonbar;
76 #endif
77 void (*set_viewport)(struct viewport* vp);
78 int (*getwidth)(void);
79 int (*getheight)(void);
80 int (*getstringsize)(const unsigned char *str, int *w, int *h);
81 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
82 void (*setfont)(int newfont);
83 int (*getfont)(void);
85 void (*scroll_step)(int pixels);
86 void (*puts_style_offset)(int x, int y, const unsigned char *str,
87 int style, int offset);
88 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
89 int style);
90 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
91 int style, int offset);
92 void (*mono_bitmap)(const unsigned char *src,
93 int x, int y, int width, int height);
94 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
95 int stride, int x, int y, int width, int height);
96 void (*bitmap)(const void *src,
97 int x, int y, int width, int height);
98 void (*bitmap_part)(const void *src, int src_x, int src_y,
99 int stride, int x, int y, int width, int height);
100 void (*transparent_bitmap)(const void *src,
101 int x, int y, int width, int height);
102 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
103 int stride, int x, int y, int width, int height);
104 void (*set_drawmode)(int mode);
105 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
106 unsigned (*color_to_native)(unsigned color);
107 #endif
108 #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
109 unsigned (*get_background)(void);
110 unsigned (*get_foreground)(void);
111 void (*set_background)(unsigned background);
112 void (*set_foreground)(unsigned foreground);
113 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
114 #if defined(HAVE_LCD_COLOR)
115 void (*set_selector_start)(unsigned selector);
116 void (*set_selector_end)(unsigned selector);
117 void (*set_selector_text)(unsigned selector_text);
118 #endif
119 void (*update_rect)(int x, int y, int width, int height);
120 void (*update_viewport_rect)(int x, int y, int width, int height);
121 void (*fillrect)(int x, int y, int width, int height);
122 void (*drawrect)(int x, int y, int width, int height);
123 void (*drawpixel)(int x, int y);
124 void (*drawline)(int x1, int y1, int x2, int y2);
125 void (*vline)(int x, int y1, int y2);
126 void (*hline)(int x1, int x2, int y);
127 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
129 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
130 void (*double_height)(bool on);
131 void (*putc)(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 (*puts_offset)(int x, int y, const unsigned char *str, int offset);
140 void (*puts_scroll)(int x, int y, const unsigned char *string);
141 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
142 int offset);
143 void (*scroll_speed)(int speed);
144 void (*scroll_delay)(int ms);
145 void (*stop_scroll)(void);
146 void (*clear_display)(void);
147 void (*clear_viewport)(void);
148 void (*scroll_stop)(struct viewport* vp);
149 void (*scroll_stop_line)(struct viewport* vp, int y);
150 void (*update)(void);
151 void (*update_viewport)(void);
152 void (*backlight_on)(void);
153 void (*backlight_off)(void);
154 bool (*is_backlight_on)(bool ignore_always_off);
155 void (*backlight_set_timeout)(int index);
156 bool (*backdrop_load)(enum backdrop_type bdrop, const char* filename);
157 void (*backdrop_unload)(enum backdrop_type bdrop);
158 void (*backdrop_show)(enum backdrop_type bdrop);
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_*/