1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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_
26 #include "buttonbar.h"
29 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
31 void screen_helper_remote_setfont(int font
);
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
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
,
48 /* if this struct is changed the plugin api may break so bump the api
49 versions in plugin.h */
52 enum screen_type screen_type
;
53 int lcdwidth
, lcdheight
;
55 int (*getnblines
)(void);
56 #ifdef HAVE_LCD_BITMAP
59 int (*getcharwidth
)(void);
60 int (*getcharheight
)(void);
62 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
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 (*getuifont
)(void);
75 void (*setuifont
)(int newfont
);
77 void (*scroll_step
)(int pixels
);
78 void (*puts_style_offset
)(int x
, int y
, const unsigned char *str
,
79 int style
, int x_offset
);
80 void (*puts_style_xyoffset
)(int x
, int y
, const unsigned char *str
,
81 int style
, int x_offset
, int y_offset
);
82 void (*puts_scroll_style
)(int x
, int y
, const unsigned char *string
,
84 void (*puts_scroll_style_offset
)(int x
, int y
, const unsigned char *string
,
85 int style
, int x_offset
);
86 void (*puts_scroll_style_xyoffset
)(int x
, int y
, const unsigned char *string
,
87 int style
, int x_offset
, int y_offset
);
88 void (*mono_bitmap
)(const unsigned char *src
,
89 int x
, int y
, int width
, int height
);
90 void (*mono_bitmap_part
)(const unsigned char *src
, int src_x
, int src_y
,
91 int stride
, int x
, int y
, int width
, int height
);
92 void (*bitmap
)(const void *src
,
93 int x
, int y
, int width
, int height
);
94 void (*bitmap_part
)(const void *src
, int src_x
, int src_y
,
95 int stride
, int x
, int y
, int width
, int height
);
96 void (*transparent_bitmap
)(const void *src
,
97 int x
, int y
, int width
, int height
);
98 void (*transparent_bitmap_part
)(const void *src
, int src_x
, int src_y
,
99 int stride
, int x
, int y
, int width
, int height
);
100 void (*bmp
)(const struct bitmap
*bm
, int x
, int y
);
101 void (*bmp_part
)(const struct bitmap
* bm
, int src_x
, int src_y
,
102 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
);
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
);
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 (*fill_viewport
)(void);
123 void (*draw_border_viewport
)(void);
124 void (*drawpixel
)(int x
, int y
);
125 void (*drawline
)(int x1
, int y1
, int x2
, int y2
);
126 void (*vline
)(int x
, int y1
, int y2
);
127 void (*hline
)(int x1
, int x2
, int y
);
128 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
130 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
131 void (*double_height
)(bool on
);
132 /* name it putchar, not putc because putc is a c library function */
133 void (*putchar
)(int x
, int y
, unsigned long ucs
);
134 void (*icon
)(int icon
, bool enable
);
135 unsigned long (*get_locked_pattern
)(void);
136 void (*define_pattern
)(unsigned long ucs
, const char *pattern
);
137 void (*unlock_pattern
)(unsigned long ucs
);
139 void (*putsxy
)(int x
, int y
, const unsigned char *str
);
140 void (*puts
)(int x
, int y
, const unsigned char *str
);
141 void (*putsf
)(int x
, int y
, const unsigned char *str
, ...);
142 void (*puts_offset
)(int x
, int y
, const unsigned char *str
, int offset
);
143 void (*puts_scroll
)(int x
, int y
, const unsigned char *string
);
144 void (*puts_scroll_offset
)(int x
, int y
, const unsigned char *string
,
146 void (*scroll_speed
)(int speed
);
147 void (*scroll_delay
)(int ms
);
148 void (*stop_scroll
)(void);
149 void (*clear_display
)(void);
150 void (*clear_viewport
)(void);
151 void (*scroll_stop
)(const struct viewport
* vp
);
152 void (*scroll_stop_line
)(const struct viewport
* vp
, int y
);
153 void (*update
)(void);
154 void (*update_viewport
)(void);
155 void (*backlight_on
)(void);
156 void (*backlight_off
)(void);
157 bool (*is_backlight_on
)(bool ignore_always_off
);
158 void (*backlight_set_timeout
)(int index
);
160 bool (*backdrop_load
)(const char *filename
, char* backdrop_buffer
);
161 void (*backdrop_show
)(char* backdrop_buffer
);
163 #if defined(HAVE_LCD_BITMAP)
164 void (*set_framebuffer
)(void *framebuffer
);
165 #if defined(HAVE_LCD_COLOR)
166 void (*gradient_fillrect
)(int x
, int y
, int width
, int height
,
167 unsigned start
, unsigned end
);
172 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
174 * Clear only a given area of the screen
175 * - screen : the screen structure
176 * - xstart, ystart : where the area starts
177 * - width, height : size of the area
179 void screen_clear_area(struct screen
* display
, int xstart
, int ystart
,
180 int width
, int height
);
184 * exported screens array that should be used
185 * by each app that wants to write to access display
187 extern struct screen screens
[NB_SCREENS
];
189 #endif /*_SCREEN_ACCESS_H_*/