You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.4 KiB

2 years ago
#ifndef __BMP_CONVERT_H__
#define __BMP_CONVERT_H__
typedef unsigned char u8;
typedef char s8;
typedef unsigned short u16;
typedef short s16;
typedef unsigned int u32;
typedef int s32;
#define LWORD(buf,pos) *((u16*)&buf[pos])
#define LDWORD(buf,pos) *((u32*)&buf[pos])
#define NULL ((void *)0)
#define __INT_MAX 2147483647
#define RGB565(r,g,b) ((u16)(((u16)(r)<<8)&0xF800) | (((u16)(g)<<3) & 0x07E0) | ((u16)(b)>>3))
#define REPEAT_THRESHOLD 3
/*
*
* inbuf : bmp图像raw数据( BGRA...BGRA, inbuf大小为inWidth*inHeight*4)
* inWidth : bmp图像的宽度
* inHeight : bmp图像的高度
*
* outbuf : NULL时计算需要的缓存大小
* outsize :
*
*
*/
int br23_bmp_to_res(u8 *inbuf, u32 inWidth, u32 inHeight, u8 *outbuf, u32 outsize);
/*
*
* infile : bmp图像raw数据的文件路径( BGRA...BGRA, width*height*4)
* width : bmp图像宽度
* height : bmp图像高度
*
* outfile : ()
*
* 0 : (width, height与infile文件的大小不匹配)
* 1 :
*/
int br23_btm_to_res_path(char *infile, int width, int height, char *outfile);
/*
*
* inbuf : bmp图像raw数据( BGRA...BGRA, A分量忽略, inbuf大小为inWidth*inHeight*4)
* inWidth : bmp图像的宽度
* inHeight : bmp图像的高度
*
* outbuf : NULL时计算需要的缓存大小(RGB565格式)
* outsize :
*
*
*/
int br28_bmp_to_res(u8 *inbuf, u32 inWidth, u32 inHeight, u8 *outbuf, u32 outsize);
/*
*
* infile : bmp图像raw数据的文件路径( BGRA...BGRA, A分量忽略, width*height*4)
* width : bmp图像宽度
* height : bmp图像高度
*
* outfile : ()(RGB565格式)
*
* 0 : (width, height与infile文件的大小不匹配)
* 1 :
*/
int br28_btm_to_res_path(char *infile, int width, int height, char *outfile);
/*
*
* inbuf : bmp图像raw数据( BGRA...BGRA, A分量保留, inbuf大小为inWidth*inHeight*4)
* inWidth : bmp图像的宽度
* inHeight : bmp图像的高度
*
* outbuf : NULL时计算需要的缓存大小(ARGB8565格式)
* outsize :
*
*
*/
int br28_alpha_bmp_to_res(u8 *inbuf, u32 inWidth, u32 inHeight, u8 *outbuf, u32 outsize);
/*
*
* infile : bmp图像raw数据的文件路径( BGRA...BGRA, A分量保留,width*height*4)
* width : bmp图像宽度
* height : bmp图像高度
*
* outfile : ()(ARGB8565格式)
*
* 0 : (width, height与infile文件的大小不匹配)
* 1 :
*/
int br28_btm_to_res_path_with_alpha(char *infile, int width, int height, char *outfile);
#endif