2002-03-28 15:09:10 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Alan Korr
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2002-03-28 15:09:10 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __LCD_H__
|
|
|
|
#define __LCD_H__
|
|
|
|
|
2002-05-13 12:29:34 +00:00
|
|
|
#include <stdbool.h>
|
2020-10-07 06:01:35 +00:00
|
|
|
#include <stddef.h>
|
2004-10-26 05:40:24 +00:00
|
|
|
#include "cpu.h"
|
2002-04-18 17:42:42 +00:00
|
|
|
#include "config.h"
|
2009-10-20 21:54:59 +00:00
|
|
|
#include "events.h"
|
2002-03-28 15:09:10 +00:00
|
|
|
|
2008-01-07 20:34:11 +00:00
|
|
|
|
2009-09-04 01:28:50 +00:00
|
|
|
/* Frame buffer stride
|
|
|
|
*
|
|
|
|
* Stride describes the amount that you need to increment to get to the next
|
|
|
|
* line. For screens that have the pixels in contiguous horizontal strips
|
|
|
|
* stride should be equal to the image width.
|
2020-10-26 16:38:22 +00:00
|
|
|
*
|
2009-09-04 01:28:50 +00:00
|
|
|
* For example, if the screen pixels are layed out as follows:
|
|
|
|
*
|
|
|
|
* width0 width1 width2 widthX-1
|
|
|
|
* ------ ------ ------ ------------------ --------
|
|
|
|
* height0 | pixel0 pixel1 pixel2 ----------------> pixelX-1
|
|
|
|
* height1 | pixelX
|
|
|
|
*
|
|
|
|
* then you need to add X pixels to get to the next line. (the next line
|
|
|
|
* in this case is height1).
|
|
|
|
*
|
2009-09-04 22:00:30 +00:00
|
|
|
* Similarly, if the screen has the pixels in contiguous vertical strips
|
2009-09-04 01:28:50 +00:00
|
|
|
* the stride would be equal to the image height.
|
|
|
|
*
|
|
|
|
* For example if the screen pixels are layed out as follows:
|
|
|
|
*
|
|
|
|
* width0 width1
|
|
|
|
* ------ ------
|
|
|
|
* height0 | pixel0 pixelY
|
|
|
|
* height1 | pixel1
|
|
|
|
* height2 | pixel2
|
|
|
|
* | | |
|
|
|
|
* \|/ | \|/
|
2020-10-26 16:38:22 +00:00
|
|
|
* heightY-1 | pixelY-1
|
2009-09-04 01:28:50 +00:00
|
|
|
*
|
2020-10-26 16:38:22 +00:00
|
|
|
* then you would need to add Y pixels to get to the next line (the next
|
2009-09-04 01:28:50 +00:00
|
|
|
* line in this case is from width0 to width1).
|
|
|
|
*
|
|
|
|
* The remote might have a different stride than the main screen so the screen
|
|
|
|
* number needs to be passed to the STRIDE macro so that the appropriate height
|
|
|
|
* or width can be passed to the lcd_bitmap, or lcd_remote_bitmap calls.
|
|
|
|
*
|
2009-09-04 22:00:30 +00:00
|
|
|
* STRIDE_REMOTE and STRIDE_MAIN should never be used when it is not clear whether
|
2009-09-04 01:28:50 +00:00
|
|
|
* lcd_remote_bitmap calls or lcd_bitmap calls are being made (for example the
|
|
|
|
* screens api).
|
|
|
|
*
|
|
|
|
* Screen should always use the screen_type enum that is at the top of this
|
|
|
|
* header.
|
|
|
|
*/
|
|
|
|
enum screen_type {
|
|
|
|
SCREEN_MAIN
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
,SCREEN_REMOTE
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2013-12-20 22:34:28 +00:00
|
|
|
struct scrollinfo;
|
|
|
|
|
2022-09-30 09:25:28 +00:00
|
|
|
#if LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
2009-09-04 01:28:50 +00:00
|
|
|
#define STRIDE_MAIN(w, h) (h)
|
|
|
|
#else
|
|
|
|
#define STRIDE_MAIN(w, h) (w)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define STRIDE_REMOTE(w, h) (w)
|
|
|
|
|
|
|
|
#define STRIDE(screen, w, h) (screen==SCREEN_MAIN?STRIDE_MAIN((w), \
|
|
|
|
(h)):STRIDE_REMOTE((w),(h)))
|
|
|
|
|
2005-11-14 20:43:49 +00:00
|
|
|
#if LCD_DEPTH <=8
|
2008-03-12 20:35:42 +00:00
|
|
|
#if (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) \
|
|
|
|
|| (LCD_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
|
2020-10-07 06:01:35 +00:00
|
|
|
typedef unsigned short fb_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_DATA_SZ 2
|
2008-03-12 20:35:42 +00:00
|
|
|
#else
|
2020-10-07 06:01:35 +00:00
|
|
|
typedef unsigned char fb_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_DATA_SZ 1
|
2008-03-12 20:35:42 +00:00
|
|
|
#endif
|
2005-11-14 20:43:49 +00:00
|
|
|
#elif LCD_DEPTH <= 16
|
2020-10-07 06:01:35 +00:00
|
|
|
typedef unsigned short fb_data;
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_DATA_SZ 2
|
2014-06-18 05:15:00 +00:00
|
|
|
#elif LCD_DEPTH <= 24
|
2020-10-07 06:01:35 +00:00
|
|
|
struct _fb_pixel {
|
|
|
|
unsigned char b, g, r;
|
|
|
|
};
|
|
|
|
typedef struct _fb_pixel fb_data;
|
2014-06-18 05:15:00 +00:00
|
|
|
#define FB_DATA_SZ 3
|
|
|
|
#else /* LCD_DEPTH > 24 */
|
2018-06-12 11:25:12 +00:00
|
|
|
#if (LCD_PIXELFORMAT == XRGB8888)
|
2020-10-07 06:01:35 +00:00
|
|
|
struct _fb_pixel {
|
|
|
|
unsigned char b, g, r, x;
|
|
|
|
};
|
|
|
|
typedef struct _fb_pixel fb_data;
|
2018-06-12 11:25:12 +00:00
|
|
|
#else
|
2020-10-07 06:01:35 +00:00
|
|
|
typedef unsigned long fb_data;
|
2018-06-12 11:25:12 +00:00
|
|
|
#endif
|
2008-12-26 07:03:22 +00:00
|
|
|
#define FB_DATA_SZ 4
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* LCD_DEPTH */
|
2008-03-12 21:01:23 +00:00
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
#if LCD_REMOTE_DEPTH <= 8
|
|
|
|
#if (LCD_REMOTE_PIXELFORMAT == VERTICAL_INTERLEAVED) \
|
|
|
|
|| (LCD_REMOTE_PIXELFORMAT == HORIZONTAL_INTERLEAVED)
|
|
|
|
typedef unsigned short fb_remote_data;
|
|
|
|
#define FB_RDATA_SZ 2
|
|
|
|
#else
|
|
|
|
typedef unsigned char fb_remote_data;
|
|
|
|
#define FB_RDATA_SZ 1
|
|
|
|
#endif
|
|
|
|
#elif LCD_DEPTH <= 16
|
|
|
|
typedef unsigned short fb_remote_data;
|
|
|
|
#define FB_RDATA_SZ 2
|
|
|
|
#else
|
|
|
|
typedef unsigned long fb_remote_data;
|
|
|
|
#define FB_RDATA_SZ 4
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2009-04-01 05:17:20 +00:00
|
|
|
#if defined(HAVE_LCD_MODES)
|
2020-10-07 06:01:35 +00:00
|
|
|
void lcd_set_mode(int mode);
|
2009-04-01 05:17:20 +00:00
|
|
|
#define LCD_MODE_RGB565 0x00000001
|
2022-10-13 15:03:53 +00:00
|
|
|
#define LCD_MODE_YUV 0x00000002
|
2010-01-03 10:27:43 +00:00
|
|
|
#define LCD_MODE_PAL256 0x00000004
|
2009-04-09 04:22:14 +00:00
|
|
|
|
|
|
|
#if HAVE_LCD_MODES & LCD_MODE_PAL256
|
2020-10-07 06:01:35 +00:00
|
|
|
void lcd_blit_pal256(unsigned char *src, int src_x, int src_y, int x, int y,
|
2010-01-03 10:27:43 +00:00
|
|
|
int width, int height);
|
2020-10-07 06:01:35 +00:00
|
|
|
void lcd_pal256_update_pal(fb_data *palette);
|
2009-04-09 04:22:14 +00:00
|
|
|
#endif
|
2009-04-01 05:17:20 +00:00
|
|
|
#endif
|
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
struct frame_buffer_t {
|
|
|
|
union
|
|
|
|
{
|
|
|
|
void *data;
|
|
|
|
char *ch_ptr;
|
|
|
|
fb_data *fb_ptr;
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
fb_remote_data *fb_remote_ptr;
|
|
|
|
#endif
|
|
|
|
};
|
2021-03-25 06:33:17 +00:00
|
|
|
void *(*get_address_fn)(int x, int y);
|
2020-10-07 06:01:35 +00:00
|
|
|
ptrdiff_t stride;
|
|
|
|
size_t elems;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define VP_FLAG_ALIGN_RIGHT 0x01
|
|
|
|
#define VP_FLAG_ALIGN_CENTER 0x02
|
|
|
|
|
|
|
|
#define VP_FLAG_ALIGNMENT_MASK \
|
|
|
|
(VP_FLAG_ALIGN_RIGHT|VP_FLAG_ALIGN_CENTER)
|
|
|
|
|
|
|
|
#define VP_IS_RTL(vp) (((vp)->flags & VP_FLAG_ALIGNMENT_MASK) == VP_FLAG_ALIGN_RIGHT)
|
|
|
|
|
2022-04-15 05:54:42 +00:00
|
|
|
#define VP_FLAG_OWNER_UPDATE 0x2000 /* block update_vp functions */
|
|
|
|
#define VP_FLAG_VP_DIRTY 0x4000
|
|
|
|
#define VP_FLAG_CLEAR_FLAG 0x8000
|
2020-10-07 06:01:35 +00:00
|
|
|
#define VP_FLAG_VP_SET_CLEAN (VP_FLAG_CLEAR_FLAG | VP_FLAG_VP_DIRTY)
|
2022-04-17 14:36:33 +00:00
|
|
|
/* flags set by viewport_set_defaults() */
|
|
|
|
#define VP_DEFAULT_FLAGS (VP_FLAG_VP_DIRTY)
|
2020-10-07 06:01:35 +00:00
|
|
|
|
|
|
|
struct viewport {
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
int flags;
|
|
|
|
int font;
|
|
|
|
int drawmode;
|
|
|
|
struct frame_buffer_t *buffer;
|
|
|
|
/* needed for even for mono displays to support greylib */
|
|
|
|
unsigned fg_pattern;
|
|
|
|
unsigned bg_pattern;
|
|
|
|
};
|
2009-04-09 04:22:14 +00:00
|
|
|
|
2002-04-25 15:09:03 +00:00
|
|
|
/* common functions */
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_write_command(int byte);
|
2007-03-18 17:58:49 +00:00
|
|
|
extern void lcd_write_command_e(int cmd, int data);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_write_command_ex(int cmd, int data1, int data2);
|
2005-11-14 20:43:49 +00:00
|
|
|
extern void lcd_write_data(const fb_data* p_bytes, int count);
|
2010-03-03 23:20:32 +00:00
|
|
|
extern void lcd_init(void) INIT_ATTR;
|
|
|
|
extern void lcd_init_device(void) INIT_ATTR;
|
2007-07-31 12:43:06 +00:00
|
|
|
|
2002-04-25 15:09:03 +00:00
|
|
|
extern void lcd_backlight(bool on);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern int lcd_default_contrast(void);
|
|
|
|
extern void lcd_set_contrast(int val);
|
2008-01-07 20:34:11 +00:00
|
|
|
extern int lcd_getwidth(void);
|
|
|
|
extern int lcd_getheight(void);
|
2007-03-26 07:52:13 +00:00
|
|
|
extern int lcd_getstringsize(const unsigned char *str, int *w, int *h);
|
2005-06-23 16:53:54 +00:00
|
|
|
|
2020-10-07 06:01:35 +00:00
|
|
|
extern struct viewport* lcd_init_viewport(struct viewport* vp);
|
|
|
|
extern struct viewport* lcd_set_viewport(struct viewport* vp);
|
|
|
|
extern struct viewport* lcd_set_viewport_ex(struct viewport* vp, int flags);
|
|
|
|
|
2007-03-31 09:58:49 +00:00
|
|
|
extern void lcd_update(void);
|
2008-01-07 20:34:11 +00:00
|
|
|
extern void lcd_update_viewport(void);
|
2013-12-14 23:38:48 +00:00
|
|
|
extern void lcd_update_viewport_rect(int x, int y, int width, int height);
|
2008-01-07 20:34:11 +00:00
|
|
|
extern void lcd_clear_viewport(void);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_clear_display(void);
|
2007-03-26 07:52:13 +00:00
|
|
|
extern void lcd_putsxy(int x, int y, const unsigned char *string);
|
2010-08-28 21:46:18 +00:00
|
|
|
extern void lcd_putsxyf(int x, int y, const unsigned char *fmt, ...);
|
2010-10-06 12:46:42 +00:00
|
|
|
extern void lcd_putsxy_style_offset(int x, int y, const unsigned char *str,
|
|
|
|
int style, int offset);
|
2004-08-01 21:50:57 +00:00
|
|
|
extern void lcd_puts(int x, int y, const unsigned char *string);
|
2009-10-17 18:02:48 +00:00
|
|
|
extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...);
|
2007-03-26 07:52:13 +00:00
|
|
|
extern void lcd_putc(int x, int y, unsigned long ucs);
|
2014-01-12 00:30:26 +00:00
|
|
|
extern bool lcd_puts_scroll(int x, int y, const unsigned char* string);
|
|
|
|
extern bool lcd_putsxy_scroll_func(int x, int y, const unsigned char *string,
|
2013-12-20 22:34:28 +00:00
|
|
|
void (*scroll_func)(struct scrollinfo *),
|
|
|
|
void *data, int x_offset);
|
2002-05-21 08:50:46 +00:00
|
|
|
|
2008-03-24 00:35:53 +00:00
|
|
|
/* performance function */
|
2022-10-13 15:03:53 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR)
|
|
|
|
#if MEMORYSIZE > 2
|
|
|
|
#define LCD_YUV_DITHER 0x1
|
|
|
|
extern void lcd_yuv_set_options(unsigned options);
|
|
|
|
extern void lcd_blit_yuv(unsigned char * const src[3],
|
|
|
|
int src_x, int src_y, int stride,
|
|
|
|
int x, int y, int width, int height);
|
|
|
|
#endif /* MEMORYSIZE > 2 */
|
|
|
|
#else
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
|
2008-03-24 00:35:53 +00:00
|
|
|
int bheight, int stride);
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
|
2008-01-09 23:48:26 +00:00
|
|
|
int bx, int by, int bwidth, int bheight,
|
|
|
|
int stride);
|
2006-08-07 22:11:07 +00:00
|
|
|
#endif
|
|
|
|
|
2002-08-09 12:20:54 +00:00
|
|
|
|
|
|
|
/* update a fraction of the screen */
|
|
|
|
extern void lcd_update_rect(int x, int y, int width, int height);
|
2005-05-23 16:23:25 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_remote_update(void);
|
|
|
|
/* update a fraction of the screen */
|
|
|
|
extern void lcd_remote_update_rect(int x, int y, int width, int height);
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* HAVE_REMOTE_LCD */
|
2002-04-25 15:09:03 +00:00
|
|
|
|
2014-01-07 22:39:37 +00:00
|
|
|
/* Bitmap formats */
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FORMAT_MONO,
|
|
|
|
FORMAT_NATIVE,
|
|
|
|
FORMAT_ANY /* For passing to read_bmp_file() */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2005-06-30 18:42:24 +00:00
|
|
|
/* Draw modes */
|
2005-06-24 22:33:21 +00:00
|
|
|
#define DRMODE_COMPLEMENT 0
|
|
|
|
#define DRMODE_BG 1
|
|
|
|
#define DRMODE_FG 2
|
|
|
|
#define DRMODE_SOLID 3
|
|
|
|
#define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */
|
2013-02-08 22:33:54 +00:00
|
|
|
/* Internal drawmode modifiers. DO NOT use with set_drawmode() */
|
2013-12-28 13:27:18 +00:00
|
|
|
#define DRMODE_INT_BD 8
|
|
|
|
#define DRMODE_INT_IMG 16
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2005-06-30 18:42:24 +00:00
|
|
|
/* Low-level drawing function types */
|
2005-07-06 22:58:02 +00:00
|
|
|
typedef void lcd_pixelfunc_type(int x, int y);
|
2006-07-28 07:17:00 +00:00
|
|
|
typedef void lcd_blockfunc_type(fb_data *address, unsigned mask, unsigned bits);
|
2005-11-28 10:05:45 +00:00
|
|
|
#if LCD_DEPTH >= 8
|
2020-10-07 06:01:35 +00:00
|
|
|
typedef void lcd_fastpixelfunc_type(fb_data *address);
|
2005-11-28 10:05:45 +00:00
|
|
|
#endif
|
2005-06-30 18:42:24 +00:00
|
|
|
|
2007-02-17 21:15:06 +00:00
|
|
|
#if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && \
|
|
|
|
LCD_REMOTE_DEPTH > 1
|
2006-10-14 01:32:58 +00:00
|
|
|
/* Just return color for screens use */
|
2020-10-07 06:01:35 +00:00
|
|
|
static inline unsigned lcd_color_to_native(unsigned color)
|
2006-10-14 01:32:58 +00:00
|
|
|
{ return color; }
|
|
|
|
#define SCREEN_COLOR_TO_NATIVE(screen, color) (screen)->color_to_native(color)
|
|
|
|
#else
|
|
|
|
#define SCREEN_COLOR_TO_NATIVE(screen, color) (color)
|
|
|
|
#endif
|
|
|
|
|
2005-07-19 09:24:29 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2006-10-15 17:51:00 +00:00
|
|
|
#if LCD_PIXELFORMAT == RGB565 || LCD_PIXELFORMAT == RGB565SWAPPED
|
2005-11-16 21:09:23 +00:00
|
|
|
#define LCD_MAX_RED 31
|
|
|
|
#define LCD_MAX_GREEN 63
|
|
|
|
#define LCD_MAX_BLUE 31
|
2006-10-15 17:51:00 +00:00
|
|
|
#define LCD_RED_BITS 5
|
|
|
|
#define LCD_GREEN_BITS 6
|
|
|
|
#define LCD_BLUE_BITS 5
|
|
|
|
|
|
|
|
/* pack/unpack native RGB values */
|
|
|
|
#define _RGBPACK_LCD(r, g, b) ( ((r) << 11) | ((g) << 5) | (b) )
|
|
|
|
#define _RGB_UNPACK_RED_LCD(x) ( (((x) >> 11) ) )
|
|
|
|
#define _RGB_UNPACK_GREEN_LCD(x) ( (((x) >> 5) & 0x3f) )
|
|
|
|
#define _RGB_UNPACK_BLUE_LCD(x) ( (((x) ) & 0x1f) )
|
|
|
|
|
|
|
|
/* pack/unpack 24-bit RGB values */
|
|
|
|
#define _RGBPACK(r, g, b) _RGBPACK_LCD((r) >> 3, (g) >> 2, (b) >> 3)
|
2007-11-11 21:31:38 +00:00
|
|
|
#define _RGB_UNPACK_RED(x) ( (((x) >> 8) & 0xf8) | (((x) >> 13) & 0x07) )
|
|
|
|
#define _RGB_UNPACK_GREEN(x) ( (((x) >> 3) & 0xfc) | (((x) >> 9) & 0x03) )
|
|
|
|
#define _RGB_UNPACK_BLUE(x) ( (((x) << 3) & 0xf8) | (((x) >> 2) & 0x07) )
|
2006-10-15 17:51:00 +00:00
|
|
|
|
2005-11-19 02:06:46 +00:00
|
|
|
#if (LCD_PIXELFORMAT == RGB565SWAPPED)
|
2006-10-15 17:51:00 +00:00
|
|
|
/* RGB3553 */
|
|
|
|
#define _LCD_UNSWAP_COLOR(x) swap16(x)
|
|
|
|
#define LCD_RGBPACK_LCD(r, g, b) ( (((r) << 3) ) | \
|
|
|
|
(((g) >> 3) ) | \
|
|
|
|
(((g) & 0x07) << 13) | \
|
|
|
|
(((b) << 8) ) )
|
|
|
|
#define LCD_RGBPACK(r, g, b) ( (((r) >> 3) << 3) | \
|
|
|
|
(((g) >> 5) ) | \
|
|
|
|
(((g) & 0x1c) << 11) | \
|
|
|
|
(((b) >> 3) << 8) )
|
|
|
|
/* swap color once - not currenly used in static inits */
|
|
|
|
#define _SWAPUNPACK(x, _unp_) \
|
2020-10-07 06:01:35 +00:00
|
|
|
({ typeof (x) _x_ = swap16(x); _unp_(_x_); })
|
2006-10-15 17:51:00 +00:00
|
|
|
#define RGB_UNPACK_RED(x) _SWAPUNPACK((x), _RGB_UNPACK_RED)
|
|
|
|
#define RGB_UNPACK_GREEN(x) _SWAPUNPACK((x), _RGB_UNPACK_GREEN)
|
|
|
|
#define RGB_UNPACK_BLUE(x) _SWAPUNPACK((x), _RGB_UNPACK_BLUE)
|
|
|
|
#define RGB_UNPACK_RED_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_RED_LCD)
|
|
|
|
#define RGB_UNPACK_GREEN_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_GREEN_LCD)
|
|
|
|
#define RGB_UNPACK_BLUE_LCD(x) _SWAPUNPACK((x), _RGB_UNPACK_BLUE_LCD)
|
2007-07-31 12:43:06 +00:00
|
|
|
#else /* LCD_PIXELFORMAT == RGB565 */
|
2006-10-15 17:51:00 +00:00
|
|
|
/* RGB565 */
|
|
|
|
#define _LCD_UNSWAP_COLOR(x) (x)
|
|
|
|
#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b))
|
|
|
|
#define LCD_RGBPACK_LCD(r, g, b) _RGBPACK_LCD((r), (g), (b))
|
|
|
|
#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x)
|
|
|
|
#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x)
|
|
|
|
#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x)
|
2007-03-21 09:47:13 +00:00
|
|
|
#define RGB_UNPACK_RED_LCD(x) _RGB_UNPACK_RED_LCD(x)
|
|
|
|
#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN_LCD(x)
|
|
|
|
#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE_LCD(x)
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* RGB565* */
|
2014-06-18 05:15:00 +00:00
|
|
|
|
2018-06-12 11:25:12 +00:00
|
|
|
#elif (LCD_PIXELFORMAT == RGB888) || (LCD_PIXELFORMAT == XRGB8888)
|
2014-06-18 05:15:00 +00:00
|
|
|
#define LCD_MAX_RED 255
|
|
|
|
#define LCD_MAX_GREEN 255
|
|
|
|
#define LCD_MAX_BLUE 255
|
|
|
|
#define LCD_RED_BITS 8
|
|
|
|
#define LCD_GREEN_BITS 8
|
|
|
|
#define LCD_BLUE_BITS 8
|
|
|
|
|
|
|
|
/* pack/unpack native RGB values */
|
|
|
|
#define _RGBPACK(r, g, b) ( r << 16 | g << 8 | b )
|
|
|
|
#define _RGB_UNPACK_RED(x) ((x >> 16) & 0xff)
|
|
|
|
#define _RGB_UNPACK_GREEN(x) ((x >> 8) & 0xff)
|
|
|
|
#define _RGB_UNPACK_BLUE(x) ((x >> 0) & 0xff)
|
|
|
|
|
|
|
|
#define _LCD_UNSWAP_COLOR(x) (x)
|
|
|
|
#define LCD_RGBPACK(r, g, b) _RGBPACK((r), (g), (b))
|
|
|
|
#define LCD_RGBPACK_LCD(r, g, b) _RGBPACK((r), (g), (b))
|
|
|
|
#define RGB_UNPACK_RED(x) _RGB_UNPACK_RED(x)
|
|
|
|
#define RGB_UNPACK_GREEN(x) _RGB_UNPACK_GREEN(x)
|
|
|
|
#define RGB_UNPACK_BLUE(x) _RGB_UNPACK_BLUE(x)
|
|
|
|
#define RGB_UNPACK_RED_LCD(x) _RGB_UNPACK_RED(x)
|
|
|
|
#define RGB_UNPACK_GREEN_LCD(x) _RGB_UNPACK_GREEN(x)
|
|
|
|
#define RGB_UNPACK_BLUE_LCD(x) _RGB_UNPACK_BLUE(x)
|
|
|
|
|
2005-11-16 21:09:23 +00:00
|
|
|
#else
|
|
|
|
/* other colour depths */
|
2006-10-14 01:32:58 +00:00
|
|
|
#endif
|
2005-11-16 21:09:23 +00:00
|
|
|
|
|
|
|
#define LCD_BLACK LCD_RGBPACK(0, 0, 0)
|
|
|
|
#define LCD_DARKGRAY LCD_RGBPACK(85, 85, 85)
|
|
|
|
#define LCD_LIGHTGRAY LCD_RGBPACK(170, 170, 170)
|
|
|
|
#define LCD_WHITE LCD_RGBPACK(255, 255, 255)
|
2008-05-05 13:11:38 +00:00
|
|
|
#define LCD_DEFAULT_FG LCD_WHITE
|
|
|
|
#define LCD_DEFAULT_BG LCD_BLACK
|
2007-09-27 15:42:55 +00:00
|
|
|
#define LCD_DEFAULT_LS LCD_WHITE
|
2005-11-16 21:09:23 +00:00
|
|
|
|
|
|
|
#elif LCD_DEPTH > 1 /* greyscale */
|
2007-07-31 12:43:06 +00:00
|
|
|
|
2005-07-19 09:24:29 +00:00
|
|
|
#define LCD_MAX_LEVEL ((1 << LCD_DEPTH) - 1)
|
2005-11-16 21:09:23 +00:00
|
|
|
#define LCD_BRIGHTNESS(y) (((y) * LCD_MAX_LEVEL + 127) / 255)
|
|
|
|
|
|
|
|
#define LCD_BLACK LCD_BRIGHTNESS(0)
|
|
|
|
#define LCD_DARKGRAY LCD_BRIGHTNESS(85)
|
|
|
|
#define LCD_LIGHTGRAY LCD_BRIGHTNESS(170)
|
|
|
|
#define LCD_WHITE LCD_BRIGHTNESS(255)
|
|
|
|
#define LCD_DEFAULT_FG LCD_BLACK
|
|
|
|
#define LCD_DEFAULT_BG LCD_WHITE
|
2007-07-31 12:43:06 +00:00
|
|
|
|
|
|
|
#endif /* HAVE_LCD_COLOR */
|
2005-06-30 18:42:24 +00:00
|
|
|
|
2014-06-18 05:15:00 +00:00
|
|
|
/* Framebuffer conversion macros: Convert from and to the native display data
|
|
|
|
* format (fb_data).
|
|
|
|
*
|
|
|
|
* FB_RGBPACK: Convert the three r,g,b values to fb_data. r,g,b are
|
|
|
|
* assumed to in 8-bit format.
|
|
|
|
* FB_RGBPACK_LCD Like FB_RGBPACK, except r,g,b shall be in display-native
|
|
|
|
* bit format (e.g. 5-bit r for RGB565)
|
|
|
|
* FB_UNPACK_RED Extract the red component of fb_data into 8-bit red value.
|
|
|
|
* FB_UNPACK_GREEN Like FB_UNPACK_RED, just for the green component.
|
|
|
|
* FB_UNPACK_BLIE Like FB_UNPACK_RED, just for the green component.
|
|
|
|
* FB_SCALARPACK Similar to FB_RGBPACK, except that the channels are already
|
|
|
|
* combined into a single scalar value. Again, 8-bit per channel.
|
|
|
|
* FB_SCALARPACK_LCD Like FB_SCALARPACK, except the channels shall be in
|
|
|
|
* display-native format (i.e. the scalar is 16bits on RGB565)
|
|
|
|
* FB_UNPACK_SCALAR_LCD Converts an fb_data to a scalar value in display-native
|
|
|
|
* format, so it's the reverse of FB_SCALARPACK_LCD
|
|
|
|
*/
|
|
|
|
#if LCD_DEPTH >= 24
|
2020-10-07 06:01:35 +00:00
|
|
|
static inline fb_data scalar_to_fb(unsigned p)
|
|
|
|
{
|
|
|
|
union { fb_data st; unsigned sc; } convert;
|
|
|
|
convert.sc = p; return convert.st;
|
|
|
|
}
|
|
|
|
static inline unsigned fb_to_scalar(fb_data p)
|
|
|
|
{
|
|
|
|
union { fb_data st; unsigned sc; } convert;
|
|
|
|
convert.st = p; return convert.sc;
|
|
|
|
}
|
2014-06-18 05:15:00 +00:00
|
|
|
#define FB_RGBPACK(r_, g_, b_) ((fb_data){.r = r_, .g = g_, .b = b_})
|
|
|
|
#define FB_RGBPACK_LCD(r_, g_, b_) FB_RGBPACK(r_, g_, b_)
|
|
|
|
#define FB_UNPACK_RED(fb) ((fb).r)
|
|
|
|
#define FB_UNPACK_GREEN(fb) ((fb).g)
|
|
|
|
#define FB_UNPACK_BLUE(fb) ((fb).b)
|
|
|
|
#define FB_SCALARPACK(c) scalar_to_fb(c)
|
|
|
|
#define FB_SCALARPACK_LCD(c) scalar_to_fb(c)
|
|
|
|
#define FB_UNPACK_SCALAR_LCD(fb) fb_to_scalar(fb)
|
|
|
|
#elif defined(HAVE_LCD_COLOR)
|
|
|
|
#define FB_RGBPACK(r_, g_, b_) LCD_RGBPACK(r_, g_, b_)
|
|
|
|
#define FB_RGBPACK_LCD(r_, g_, b_) LCD_RGBPACK_LCD(r_, g_, b_)
|
|
|
|
#define FB_UNPACK_RED(fb) RGB_UNPACK_RED(fb)
|
|
|
|
#define FB_UNPACK_GREEN(fb) RGB_UNPACK_GREEN(fb)
|
|
|
|
#define FB_UNPACK_BLUE(fb) RGB_UNPACK_BLUE(fb)
|
|
|
|
#define FB_SCALARPACK(c) LCD_RGBPACK(RGB_UNPACK_RED(c), RGB_UNPACK_GREEN(c), RGB_UNPACK_BLUE(c))
|
|
|
|
#define FB_SCALARPACK_LCD(c) (c)
|
|
|
|
#define FB_UNPACK_SCALAR_LCD(fb) (fb)
|
|
|
|
#else
|
|
|
|
#define FB_SCALARPACK(c) (c)
|
|
|
|
#define FB_SCALARPACK_LCD(c) (c)
|
|
|
|
#define FB_UNPACK_SCALAR_LCD(fb) (fb)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2007-02-20 19:31:34 +00:00
|
|
|
/* Frame buffer dimensions */
|
2005-07-06 22:58:02 +00:00
|
|
|
#if LCD_DEPTH == 1
|
2007-02-20 19:31:34 +00:00
|
|
|
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
|
2020-10-07 06:01:35 +00:00
|
|
|
#define LCD_FBSTRIDE(w, h) ((w+7)/8)
|
|
|
|
#define LCD_FBWIDTH LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) ((((h-1)*LCD_FBSTRIDE(w, h)) + w) / sizeof(fb_data))
|
2007-02-20 19:31:34 +00:00
|
|
|
#else /* LCD_PIXELFORMAT == VERTICAL_PACKING */
|
2020-10-07 06:01:35 +00:00
|
|
|
#define LCD_FBSTRIDE(w, h) ((h+7)/8)
|
|
|
|
#define LCD_FBHEIGHT LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) ((((w-1)*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* LCD_PIXELFORMAT */
|
2005-07-06 22:58:02 +00:00
|
|
|
#elif LCD_DEPTH == 2
|
2006-02-09 00:48:53 +00:00
|
|
|
#if LCD_PIXELFORMAT == HORIZONTAL_PACKING
|
2020-10-07 06:01:35 +00:00
|
|
|
#define LCD_FBSTRIDE(w, h) ((w+3)>>2)
|
|
|
|
#define LCD_NATIVE_STRIDE(s) LCD_FBSTRIDE(s, s)
|
|
|
|
#define LCD_FBWIDTH LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) ((((h-1)*LCD_FBSTRIDE(w, h)) + w) / sizeof(fb_data))
|
2008-03-12 20:35:42 +00:00
|
|
|
#elif LCD_PIXELFORMAT == VERTICAL_PACKING
|
2020-10-07 06:01:35 +00:00
|
|
|
#define LCD_FBSTRIDE(w, h) ((h+3)/4)
|
|
|
|
#define LCD_FBHEIGHT LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) ((((w-1)*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
2008-03-12 20:35:42 +00:00
|
|
|
#elif LCD_PIXELFORMAT == VERTICAL_INTERLEAVED
|
2020-10-07 06:01:35 +00:00
|
|
|
#define LCD_FBSTRIDE(w, h) ((h+7)/8)
|
|
|
|
#define LCD_FBHEIGHT LCD_FBSTRIDE(LCD_WIDTH, LCD_HEIGHT)
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) ((((w-1)*LCD_FBSTRIDE(w, h)) + h) / sizeof(fb_data))
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* LCD_PIXELFORMAT */
|
2007-02-20 19:31:34 +00:00
|
|
|
#endif /* LCD_DEPTH */
|
|
|
|
/* Set defaults if not defined different yet. The defaults apply to both
|
|
|
|
* dimensions for LCD_DEPTH >= 8 */
|
2006-03-08 01:14:46 +00:00
|
|
|
#ifndef LCD_FBWIDTH
|
|
|
|
#define LCD_FBWIDTH LCD_WIDTH
|
2005-07-06 22:58:02 +00:00
|
|
|
#endif
|
2007-02-20 19:31:34 +00:00
|
|
|
#ifndef LCD_FBHEIGHT
|
|
|
|
#define LCD_FBHEIGHT LCD_HEIGHT
|
|
|
|
#endif
|
2020-10-07 06:01:35 +00:00
|
|
|
|
|
|
|
#ifndef LCD_NATIVE_STRIDE
|
|
|
|
/* 2-bit Horz is the only display that actually defines this */
|
|
|
|
#define LCD_NATIVE_STRIDE(s) (s)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LCD_NBELEMS
|
2022-09-30 09:25:28 +00:00
|
|
|
#if LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) (((w-1)*STRIDE_MAIN(w, h)) + h)
|
2012-02-22 10:18:05 +00:00
|
|
|
#else
|
2020-10-31 04:18:57 +00:00
|
|
|
#define LCD_NBELEMS(w, h) (((h-1)*STRIDE_MAIN(w, h)) + w)
|
2012-02-22 10:18:05 +00:00
|
|
|
#endif
|
2020-10-07 06:01:35 +00:00
|
|
|
#define LCD_FBSTRIDE(w, h) STRIDE_MAIN(w, h)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LCD_STRIDE
|
|
|
|
#define LCD_STRIDE(w, h) STRIDE_MAIN(w, h)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
extern struct viewport* lcd_current_viewport;
|
|
|
|
|
2022-03-21 22:54:52 +00:00
|
|
|
#define FB_CURRENTVP_BUFFER (lcd_current_viewport->buffer)
|
|
|
|
#define FBADDRBUF(buffer,x,y) ((fb_data*) buffer->get_address_fn(x,y))
|
|
|
|
#define FBADDR(x,y) (FBADDRBUF(lcd_current_viewport->buffer,x,y))
|
2020-10-07 06:01:35 +00:00
|
|
|
|
2020-10-06 18:34:04 +00:00
|
|
|
#define FRAMEBUFFER_SIZE (sizeof(fb_data)*LCD_FBWIDTH*LCD_FBHEIGHT)
|
2002-08-01 13:29:30 +00:00
|
|
|
|
2006-08-08 22:03:56 +00:00
|
|
|
/** Port-specific functions. Enable in port config file. **/
|
2008-03-19 00:34:56 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD_AS_MAIN
|
|
|
|
void lcd_on(void);
|
|
|
|
void lcd_off(void);
|
|
|
|
void lcd_poweroff(void);
|
|
|
|
#endif
|
|
|
|
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAVE_LCD_ENABLE
|
|
|
|
/* Enable/disable the main display. */
|
2005-12-20 23:15:27 +00:00
|
|
|
extern void lcd_enable(bool on);
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* HAVE_LCD_ENABLE */
|
2005-12-20 23:15:27 +00:00
|
|
|
|
2006-08-08 22:03:56 +00:00
|
|
|
#ifdef HAVE_LCD_SLEEP
|
|
|
|
/* Put the LCD into a power saving state deeper than lcd_enable(false). */
|
|
|
|
extern void lcd_sleep(void);
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* HAVE_LCD_SLEEP */
|
2009-03-17 02:43:47 +00:00
|
|
|
#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
|
|
|
|
/* Register a hook that is called when the lcd is powered and after the
|
|
|
|
* framebuffer data is synchronized */
|
|
|
|
/* Sansa Clip has these function in it's lcd driver, since it's the only
|
|
|
|
* 1-bit display featuring lcd_active, so far */
|
2009-10-20 21:54:59 +00:00
|
|
|
|
|
|
|
enum {
|
|
|
|
LCD_EVENT_ACTIVATION = (EVENT_CLASS_LCD|1),
|
|
|
|
};
|
|
|
|
|
2009-03-17 02:43:47 +00:00
|
|
|
extern bool lcd_active(void);
|
|
|
|
#endif
|
2006-08-08 22:03:56 +00:00
|
|
|
|
2007-09-29 20:56:07 +00:00
|
|
|
#ifdef HAVE_LCD_SHUTDOWN
|
2009-10-20 21:54:59 +00:00
|
|
|
extern void lcd_shutdown(void);
|
2007-09-29 20:56:07 +00:00
|
|
|
#endif
|
|
|
|
|
2006-01-28 23:12:20 +00:00
|
|
|
#define FORMAT_TRANSPARENT 0x40000000
|
2006-10-11 01:26:09 +00:00
|
|
|
#define FORMAT_DITHER 0x20000000
|
2006-11-20 00:20:09 +00:00
|
|
|
#define FORMAT_REMOTE 0x10000000
|
2008-12-09 23:07:59 +00:00
|
|
|
#define FORMAT_RESIZE 0x08000000
|
|
|
|
#define FORMAT_KEEP_ASPECT 0x04000000
|
2009-05-25 11:12:27 +00:00
|
|
|
#define FORMAT_RETURN_SIZE 0x02000000
|
2006-01-28 23:12:20 +00:00
|
|
|
|
|
|
|
#define TRANSPARENT_COLOR LCD_RGBPACK(255,0,255)
|
2007-07-14 09:19:46 +00:00
|
|
|
#define REPLACEWITHFG_COLOR LCD_RGBPACK(0,255,255)
|
2006-01-28 23:12:20 +00:00
|
|
|
|
2006-01-28 12:12:42 +00:00
|
|
|
struct bitmap {
|
|
|
|
int width;
|
|
|
|
int height;
|
2006-11-20 00:20:09 +00:00
|
|
|
#if (LCD_DEPTH > 1) || defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
|
2006-01-28 12:12:42 +00:00
|
|
|
int format;
|
2006-01-28 23:12:20 +00:00
|
|
|
unsigned char *maskdata;
|
2011-11-08 21:36:49 +00:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_LCD_COLOR
|
|
|
|
int alpha_offset; /* byte-offset of alpha channel in data */
|
2006-01-28 12:12:42 +00:00
|
|
|
#endif
|
|
|
|
unsigned char *data;
|
|
|
|
};
|
|
|
|
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_set_invert_display(bool yesno);
|
2007-07-27 12:10:25 +00:00
|
|
|
#ifdef HAVE_BACKLIGHT_INVERSION
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_set_backlight_inversion(bool yesno);
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* HAVE_BACKLIGHT_INVERSION */
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_set_flip(bool yesno);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
|
|
|
extern void lcd_set_drawmode(int mode);
|
|
|
|
extern int lcd_get_drawmode(void);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_setfont(int font);
|
2008-01-08 01:22:14 +00:00
|
|
|
extern int lcd_getfont(void);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2005-06-29 01:39:50 +00:00
|
|
|
/* low level drawing function pointer arrays */
|
2006-11-13 00:45:21 +00:00
|
|
|
#if LCD_DEPTH >= 8
|
2020-10-07 06:01:35 +00:00
|
|
|
extern lcd_fastpixelfunc_type* const *lcd_fastpixelfuncs;
|
2006-11-13 00:45:21 +00:00
|
|
|
#elif LCD_DEPTH > 1
|
2020-10-07 06:01:35 +00:00
|
|
|
extern lcd_pixelfunc_type* const *lcd_pixelfuncs;
|
|
|
|
extern lcd_blockfunc_type* const *lcd_blockfuncs;
|
2007-07-31 12:43:06 +00:00
|
|
|
#else /* LCD_DEPTH == 1*/
|
2020-10-07 06:01:35 +00:00
|
|
|
extern lcd_pixelfunc_type* const lcd_pixelfuncs[8];
|
|
|
|
extern lcd_blockfunc_type* const lcd_blockfuncs[8];
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* LCD_DEPTH */
|
2005-06-29 01:39:50 +00:00
|
|
|
|
2002-04-25 13:45:23 +00:00
|
|
|
extern void lcd_drawpixel(int x, int y);
|
2005-06-23 16:53:54 +00:00
|
|
|
extern void lcd_drawline(int x1, int y1, int x2, int y2);
|
2005-06-24 22:33:21 +00:00
|
|
|
extern void lcd_hline(int x1, int x2, int y);
|
|
|
|
extern void lcd_vline(int x, int y1, int y2);
|
|
|
|
extern void lcd_drawrect(int x, int y, int width, int height);
|
|
|
|
extern void lcd_fillrect(int x, int y, int width, int height);
|
2012-02-29 12:43:50 +00:00
|
|
|
extern void lcd_gradient_fillrect(int x, int y, int width, int height,
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned start_rgb, unsigned end_rgb);
|
2013-12-20 22:34:28 +00:00
|
|
|
extern void lcd_gradient_fillrect_part(int x, int y, int width, int height,
|
2020-10-07 06:01:35 +00:00
|
|
|
unsigned start_rgb, unsigned end_rgb, int src_height, int row_skip);
|
2010-10-11 01:19:55 +00:00
|
|
|
extern void lcd_draw_border_viewport(void);
|
|
|
|
extern void lcd_fill_viewport(void);
|
2005-11-14 20:43:49 +00:00
|
|
|
extern void lcd_bitmap_part(const fb_data *src, int src_x, int src_y,
|
2005-06-28 23:15:47 +00:00
|
|
|
int stride, int x, int y, int width, int height);
|
2005-11-14 20:43:49 +00:00
|
|
|
extern void lcd_bitmap(const fb_data *src, int x, int y, int width,
|
2005-06-30 18:42:24 +00:00
|
|
|
int height);
|
2005-06-24 22:33:21 +00:00
|
|
|
|
2002-12-12 15:20:37 +00:00
|
|
|
extern void lcd_scroll_step(int pixels);
|
2002-09-20 08:07:51 +00:00
|
|
|
|
2005-07-06 22:58:02 +00:00
|
|
|
#if LCD_DEPTH > 1
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_set_foreground(unsigned foreground);
|
|
|
|
extern unsigned lcd_get_foreground(void);
|
|
|
|
extern void lcd_set_background(unsigned background);
|
|
|
|
extern unsigned lcd_get_background(void);
|
2007-09-27 15:42:55 +00:00
|
|
|
#ifdef HAVE_LCD_COLOR
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_set_selector_start(unsigned selector);
|
|
|
|
extern void lcd_set_selector_end(unsigned selector);
|
|
|
|
extern void lcd_set_selector_text(unsigned selector_text);
|
2007-09-27 15:42:55 +00:00
|
|
|
#endif
|
2020-10-07 06:01:35 +00:00
|
|
|
extern void lcd_set_drawinfo(int mode, unsigned foreground,
|
|
|
|
unsigned background);
|
|
|
|
void lcd_set_backdrop(fb_data* backdrop);
|
|
|
|
|
|
|
|
fb_data* lcd_get_backdrop(void);
|
|
|
|
|
|
|
|
extern void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y,
|
|
|
|
int stride, int x, int y, int width, int height);
|
|
|
|
extern void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width,
|
|
|
|
int height);
|
|
|
|
extern void lcd_bitmap_transparent_part(const fb_data *src,
|
|
|
|
int src_x, int src_y,
|
|
|
|
int stride, int x, int y, int width,
|
|
|
|
int height);
|
|
|
|
extern void lcd_bitmap_transparent(const fb_data *src, int x, int y,
|
|
|
|
int width, int height);
|
2005-07-06 22:58:02 +00:00
|
|
|
#else /* LCD_DEPTH == 1 */
|
|
|
|
#define lcd_mono_bitmap lcd_bitmap
|
|
|
|
#define lcd_mono_bitmap_part lcd_bitmap_part
|
2007-07-31 12:43:06 +00:00
|
|
|
#endif /* LCD_DEPTH */
|
2011-11-08 22:04:43 +00:00
|
|
|
extern void lcd_bmp_part(const struct bitmap* bm, int src_x, int src_y,
|
|
|
|
int x, int y, int width, int height);
|
|
|
|
extern void lcd_bmp(const struct bitmap* bm, int x, int y);
|
2012-12-03 09:43:58 +00:00
|
|
|
extern void lcd_nine_segment_bmp(const struct bitmap* bm, int x, int y,
|
|
|
|
int width, int height);
|
2010-11-10 15:25:15 +00:00
|
|
|
|
2014-01-23 07:23:34 +00:00
|
|
|
/* TODO: Impement this for remote displays if ever needed */
|
2011-10-17 18:28:35 +00:00
|
|
|
#if defined(LCD_DPI) && (LCD_DPI > 0)
|
2020-10-07 06:01:35 +00:00
|
|
|
/* returns the pixel density of the display */
|
|
|
|
static inline int lcd_get_dpi(void) { return LCD_DPI; }
|
2011-10-17 18:28:35 +00:00
|
|
|
#else
|
2020-10-07 06:01:35 +00:00
|
|
|
extern int lcd_get_dpi(void);
|
2011-10-17 18:28:35 +00:00
|
|
|
#endif /* LCD_DPI */
|
2014-01-23 07:23:34 +00:00
|
|
|
|
2002-04-18 17:42:42 +00:00
|
|
|
#endif /* __LCD_H__ */
|