1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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_
24 #include "buttonbar.h"
28 #ifdef HAVE_REMOTE_LCD
33 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
40 #define FOR_NB_SCREENS(i) i = 0;
42 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
45 #ifdef HAVE_LCD_CHARCELLS
46 #define MAX_LINES_ON_SCREEN 2
49 typedef void screen_bitmap_part_func(const void *src
, int src_x
, int src_y
,
50 int stride
, int x
, int y
, int width
, int height
);
51 typedef void screen_bitmap_func(const void *src
, int x
, int y
, int width
,
54 /* if this struct is changed the plugin api may break so bump the api
55 versions in plugin.h */
58 enum screen_type screen_type
;
62 #ifdef HAVE_LCD_BITMAP
68 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
74 void (*set_viewport
)(struct viewport
* vp
);
75 int (*getwidth
)(void);
76 int (*getheight
)(void);
77 int (*getstringsize
)(const unsigned char *str
, int *w
, int *h
);
78 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
79 void (*setfont
)(int newfont
);
82 void (*scroll_step
)(int pixels
);
83 void (*puts_style_offset
)(int x
, int y
, const unsigned char *str
,
84 int style
, int offset
);
85 void (*puts_scroll_style
)(int x
, int y
, const unsigned char *string
,
87 void (*puts_scroll_style_offset
)(int x
, int y
, const unsigned char *string
,
88 int style
, int 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
);
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
);
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 (*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 void (*putc
)(int x
, int y
, unsigned long ucs
);
129 void (*icon
)(int icon
, bool enable
);
130 unsigned long (*get_locked_pattern
)(void);
131 void (*define_pattern
)(unsigned long ucs
, const char *pattern
);
132 void (*unlock_pattern
)(unsigned long ucs
);
134 void (*putsxy
)(int x
, int y
, const unsigned char *str
);
135 void (*puts
)(int x
, int y
, const unsigned char *str
);
136 void (*puts_offset
)(int x
, int y
, const unsigned char *str
, int offset
);
137 void (*puts_scroll
)(int x
, int y
, const unsigned char *string
);
138 void (*puts_scroll_offset
)(int x
, int y
, const unsigned char *string
,
140 void (*scroll_speed
)(int speed
);
141 void (*scroll_delay
)(int ms
);
142 void (*stop_scroll
)(void);
143 void (*clear_display
)(void);
144 void (*clear_viewport
)(void);
145 void (*scroll_stop
)(struct viewport
* vp
);
146 void (*scroll_stop_line
)(struct viewport
* vp
, int y
);
147 void (*update
)(void);
148 void (*update_viewport
)(void);
149 void (*backlight_on
)(void);
150 void (*backlight_off
)(void);
151 bool (*is_backlight_on
)(bool ignore_always_off
);
152 void (*backlight_set_timeout
)(int index
);
155 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
157 * Clear only a given area of the screen
158 * - screen : the screen structure
159 * - xstart, ystart : where the area starts
160 * - width, height : size of the area
162 void screen_clear_area(struct screen
* display
, int xstart
, int ystart
,
163 int width
, int height
);
167 * Initializes the whole screen_access api
169 extern void screen_access_init(void);
172 * exported screens array that should be used
173 * by each app that wants to write to access display
175 extern struct screen screens
[NB_SCREENS
];
177 #endif /*_SCREEN_ACCESS_H_*/