sdk-hwV1.3/external/eyesee-mpp/system/public/rgb_ctrl/rgb_ctrl.h

241 lines
7.3 KiB
C
Raw Permalink Normal View History

2024-05-07 10:09:20 +00:00
/************************************************************************************************/
/* Copyright (C), 2001-2016, Allwinner Tech. Co., Ltd. */
/************************************************************************************************/
/**
* @file aw_osd.h
* @brief
* @author id: guixing
* @version v0.1
* @date 2016-08-28
*/
#ifndef _RGB_CTRL_H_
#define _RGB_CTRL_H_
/************************************************************************************************/
/* Include Files */
/************************************************************************************************/
#include <errno.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <log/log_wrapper.h>
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
/************************************************************************************************/
/* Macros & Typedefs */
/************************************************************************************************/
#define MAX_COLOR_SIZE 8
#define RGB_DB
#ifdef RGB_DB
#define RGB_DB_PRT(fmt, args...) \
do { \
LOGD(fmt, ##args); \
} while (0)
#endif
#define RGB_ERR
#ifdef RGB_ERR
#define RGB_ERR_PRT(fmt, args...) \
do { \
LOGE(fmt, ##args); \
} while (0)
#endif
typedef enum tag_OSD_RGB_TYPE {
OSD_RGB_555 = 0,
OSD_RGB_565,
OSD_RGB_24,
OSD_RGB_32,
OSD_RGB_BUTT,
} OSD_RGB_TYPE;
typedef enum tag_FONT_SIZE_TYPE {
FONT_SIZE_16 = 0,
FONT_SIZE_20,
FONT_SIZE_24,
FONT_SIZE_32,
FONT_SIZE_40,
FONT_SIZE_48,
FONT_SIZE_56,
FONT_SIZE_64,
FONT_SIZE_BUTT,
} FONT_SIZE_TYPE;
typedef enum tag_CHAR_CODE_TYPE {
CHAR_CODE_ASCII = 0,
CHAR_CODE_GB2312,
CHAR_CODE_UTF8,
CHAR_CODE_USC2_LIT, /* unicode 2 little endian */
CHAR_CODE_USC2_BIG, /* unicode 2 big endian */
CHAR_CODE_BUTT,
} CHAR_CODE_TYPE;
/************************************************************************************************/
/* Structure Declarations */
/************************************************************************************************/
typedef struct tag_RGB_PIC_S {
unsigned int wide;
unsigned int high;
OSD_RGB_TYPE rgb_type;
int enable_mosaic;
int mosaic_size;
unsigned char background[MAX_COLOR_SIZE]; /* support rgb555, rgb565, rgb24, rgb32 */
unsigned char mosaic_color[MAX_COLOR_SIZE];
char *pic_addr;
int pic_size;
} RGB_PIC_S;
typedef struct tag_PIC_REGION_S {
int x;
int y;
int w;
int h;
OSD_RGB_TYPE rgb_type;
} PIC_REGION_S;
typedef struct tag_FONT_RGBPIC_S {
FONT_SIZE_TYPE font_type;
OSD_RGB_TYPE rgb_type;
int enable_bg;
unsigned char foreground[MAX_COLOR_SIZE];
unsigned char background[MAX_COLOR_SIZE];
} FONT_RGBPIC_S;
/************************************************************************************************/
/* Global Variables */
/************************************************************************************************/
/* None */
/************************************************************************************************/
/* Function Declarations */
/************************************************************************************************/
/**
* @brief
* @param font_type
* @return
* - 0
* - -1
*/
int load_font_file(FONT_SIZE_TYPE font_type);
/**
* @brief
* @param
* @return
* - 0
* - -1
*/
int unload_gb2312_font(void);
/**
* @brief rgb_pic规格创建RGB矩形框
* @param rgb_pic
* - wide input
* - high input
* - rgb_type input rgb的像素格式如rgb555 rgb888 rgb8888等
* - enable_mosaic input 使
* - mosaic_size input
* - background input RGB图片的底色
* - mosaic_color input
* - pic_addr output NULL使
* - pic_size output
* @return
* - 0
* - -1
*/
int create_rectangle_rgb(RGB_PIC_S *rgb_pic);
/**
* @brief rgb_pic规格创建RGB矩形框
* @param font_pic
* - font_type input
* - rgb_type input RGB格式
* - enable_bg input 使
* - foreground input
* - background input
* @param rgb_pic
* - enable_mosaic input 使
* - mosaic_size input
* - mosaic_color input
* - background output RGB图片的底色font_pic中的background格式一样值
* - rgb_type output rgb的像素格式font_pic中的rgb格式一样值
* - pic_addr output NULL使
* - pic_size output
* - wide output
* - high output
* @return
* - 0
* - -1
*/
int create_font_rectangle(const char *code, const FONT_RGBPIC_S *font_pic, RGB_PIC_S *rgb_pic);
/**
* @brief rgb_pic图片
* @param rgb_pic rgb图片
* @return
* - 0
* - -1
*/
int release_rgb_picture(RGB_PIC_S *rgb_pic);
/**
* @brief color填充满该图片
* @param rgb_pic RGB图片
* @param color 4
* @return
* - 0
* - -1
*/
int fill_rectangle_rgb(RGB_PIC_S *rgb_pic, const unsigned char *color);
/**
* @brief src_pic图片dst_pic图片中
* @param src_pic RGB图片
* @param dst_pic RGB图片
* @param top
* @param left
* @return
* - 0
* - -1
*/
int draw_pic_in_pic(const RGB_PIC_S *src_pic, const RGB_PIC_S *dst_pic, int top, int left);
/**
* @brief dst_pic图片中
* @param code
* @param font_pic RGB格式
* @param dst_pic RGB图片
* @param top
* @param left
* @return
* - 0
* - -1
*/
int draw_font_in_pic(const char *code, const FONT_RGBPIC_S *font_pic, const RGB_PIC_S *dst_pic, int top, int left);
/**
*
* @param font_type
* @return
* - 0
* - -1
*/
int unload_font_file(FONT_SIZE_TYPE font_type);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif /* _RGB_CTRL_H_ */