A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 161 lines 6.8 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2005 by Kevin Ferrare 11 * 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. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21 22#ifndef _SCREEN_ACCESS_H_ 23#define _SCREEN_ACCESS_H_ 24 25#include "lcd.h" 26#include "scroll_engine.h" 27#include "backdrop.h" 28#include "line.h" 29 30#if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF) 31#define NB_SCREENS 2 32void screen_helper_remote_setfont(int font); 33#else 34#define NB_SCREENS 1 35#endif 36void screen_helper_setfont(int font); 37 38#define FOR_NB_SCREENS(i) for(int i = 0; i < NB_SCREENS; i++) 39 40typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y, 41 int stride, int x, int y, int width, int height); 42typedef void screen_bitmap_func(const void *src, int x, int y, int width, 43 int height); 44 45/* if this struct is changed the plugin api may break so bump the api 46 versions in plugin.h */ 47struct screen 48{ 49 enum screen_type screen_type; 50 int lcdwidth, lcdheight; 51 int depth; 52 int (*getnblines)(void); 53 int pixel_format; 54 int (*getcharwidth)(void); 55 int (*getcharheight)(void); 56 bool is_color; 57#if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD) 58 bool has_disk_led; 59#endif 60 void (*set_drawmode)(int mode); 61 struct viewport* (*init_viewport)(struct viewport* vp); 62 struct viewport* (*set_viewport)(struct viewport* vp); 63 struct viewport* (*set_viewport_ex)(struct viewport* vp, int flags); 64 void (*viewport_set_buffer)(struct viewport *vp, struct frame_buffer_t *buffer); 65 struct viewport** current_viewport; 66 int (*getwidth)(void); 67 int (*getheight)(void); 68 int (*getstringsize)(const unsigned char *str, int *w, int *h); 69 void (*setfont)(int newfont); 70 int (*getuifont)(void); 71 void (*setuifont)(int newfont); 72 73 void (*scroll_step)(int pixels); 74 void (*mono_bitmap)(const unsigned char *src, 75 int x, int y, int width, int height); 76 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y, 77 int stride, int x, int y, int width, int height); 78 void (*bitmap)(const void *src, 79 int x, int y, int width, int height); 80 void (*bitmap_part)(const void *src, int src_x, int src_y, 81 int stride, int x, int y, int width, int height); 82 void (*transparent_bitmap)(const void *src, 83 int x, int y, int width, int height); 84 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y, 85 int stride, int x, int y, int width, int height); 86 void (*bmp)(const struct bitmap *bm, int x, int y); 87 void (*bmp_part)(const struct bitmap* bm, int src_x, int src_y, 88 int x, int y, int width, int height); 89#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1 90 unsigned (*color_to_native)(unsigned color); 91#endif 92#if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1)) 93 unsigned (*get_background)(void); 94 unsigned (*get_foreground)(void); 95 void (*set_background)(unsigned background); 96 void (*set_foreground)(unsigned foreground); 97 void (*set_drawinfo)(int mode, unsigned foreground, unsigned background); 98#endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */ 99 void (*update_rect)(int x, int y, int width, int height); 100 void (*update_viewport_rect)(int x, int y, int width, int height); 101 void (*fillrect)(int x, int y, int width, int height); 102 void (*drawrect)(int x, int y, int width, int height); 103 void (*fill_viewport)(void); 104 void (*draw_border_viewport)(void); 105 void (*drawpixel)(int x, int y); 106 void (*drawline)(int x1, int y1, int x2, int y2); 107 void (*vline)(int x, int y1, int y2); 108 void (*hline)(int x1, int x2, int y); 109 110 void (*putsxy)(int x, int y, const unsigned char *str); 111 void (*puts)(int x, int y, const unsigned char *str); 112 void (*putsf)(int x, int y, const unsigned char *str, ...); 113 void (*putsxyf)(int x, int y, const unsigned char *fmt, ...); 114 bool (*puts_scroll)(int x, int y, const unsigned char *string); 115 bool (*putsxy_scroll_func)(int x, int y, const unsigned char *string, 116 void (*scroll_func)(struct scrollinfo *), 117 void *data, int x_offset); 118 void (*scroll_speed)(int speed); 119 void (*scroll_delay)(int ms); 120 void (*clear_display)(void); 121 void (*clear_viewport)(void); 122 void (*scroll_stop)(void); 123 void (*scroll_stop_viewport)(const struct viewport *vp); 124 void (*scroll_stop_viewport_rect)(const struct viewport* vp, int x, int y, int width, int height); 125 void (*update)(void); 126 void (*update_viewport)(void); 127 void (*backlight_on)(void); 128 void (*backlight_off)(void); 129 bool (*is_backlight_on)(bool ignore_always_off); 130 void (*backlight_set_timeout)(int index); 131#if LCD_DEPTH > 1 132 bool (*backdrop_load)(const char *filename, char* backdrop_buffer); 133 void (*backdrop_show)(char* backdrop_buffer); 134#endif 135#if defined(HAVE_LCD_COLOR) 136 void (*gradient_fillrect)(int x, int y, int width, int height, 137 unsigned start, unsigned end); 138 void (*gradient_fillrect_part)(int x, int y, int width, int height, 139 unsigned start, unsigned end, int src_height, int row_skip); 140#endif 141 void (*nine_segment_bmp)(const struct bitmap* bm, int x, int y, 142 int width, int height); 143 void (*put_line)(int x, int y, struct line_desc *line, const char *fmt, ...); 144}; 145 146/* 147 * Clear only a given area of the screen 148 * - screen : the screen structure 149 * - xstart, ystart : where the area starts 150 * - width, height : size of the area 151 */ 152void screen_clear_area(struct screen * display, int xstart, int ystart, 153 int width, int height); 154 155/* 156 * exported screens array that should be used 157 * by each app that wants to write to access display 158 */ 159extern struct screen screens[NB_SCREENS]; 160 161#endif /*_SCREEN_ACCESS_H_*/