Added the function of pasting image data to buffer (STM32)
This commit is contained in:
parent
0895fc1e5a
commit
7a1e6ae4cc
11 changed files with 1387 additions and 833 deletions
|
|
@ -58,7 +58,7 @@ int EPD_2in66_test(void)
|
|||
Paint_SelectImage(BlackImage);
|
||||
Paint_Clear(WHITE);
|
||||
Paint_DrawBitMap(gImage_2in66);
|
||||
|
||||
Paint_DrawBitMap_Paste(gImage_100X50, 10, 10, 100, 50, TRUE);
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
DEV_Delay_ms(2000);
|
||||
#endif
|
||||
|
|
@ -92,8 +92,8 @@ int EPD_2in66_test(void)
|
|||
Paint_DrawNum(10, 33, 123456789, &Font12, BLACK, WHITE);
|
||||
Paint_DrawNum(10, 50, 987654321, &Font16, WHITE, BLACK);
|
||||
|
||||
Paint_DrawString_CN(130, 0,"ÄãºÃabc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "΢ѩµç×Ó", &Font24CN, WHITE, BLACK);
|
||||
Paint_DrawString_CN(130, 0,"<EFBFBD><EFBFBD><EFBFBD>abc", &Font12CN, BLACK, WHITE);
|
||||
Paint_DrawString_CN(130, 20, "ѩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", &Font24CN, WHITE, BLACK);
|
||||
|
||||
EPD_2IN66_Display(BlackImage);
|
||||
DEV_Delay_ms(4000);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,52 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "ImageData.h"
|
||||
|
||||
const unsigned char gImage_100X50[656] = { /*0X00,0X01,0X64,0X00,0X32,0X00,*/
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XC7,0X00,0X66,0X00,0X0E,0X66,0X00,
|
||||
0X03,0X03,0X00,0X00,0X00,0X00,0XC7,0X00,0X66,0X00,0X0E,0XE6,0X00,0X03,0X03,0X00,
|
||||
0X00,0X00,0X00,0XC7,0X00,0X66,0X00,0X06,0XFE,0X00,0X03,0X1F,0X00,0X00,0X00,0X00,
|
||||
0XC7,0X3F,0X66,0X7E,0X07,0XFE,0X7E,0X7B,0X3F,0X00,0X00,0X00,0X00,0XFF,0X33,0X66,
|
||||
0X66,0X07,0XFC,0X66,0X63,0X73,0X00,0X00,0X00,0X00,0XC7,0X7F,0X66,0XE6,0X07,0XFC,
|
||||
0XE6,0X63,0X73,0X00,0X00,0X00,0X00,0XC7,0X70,0X66,0XE6,0X03,0XBC,0XE6,0X63,0X73,
|
||||
0X00,0X00,0X00,0X00,0XC7,0X3F,0X66,0X7E,0X03,0X9C,0X7E,0X63,0X3F,0X00,0X00,0X00,
|
||||
0X00,0XC7,0X1E,0X66,0X3C,0X03,0X98,0X3C,0X63,0X1F,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,};
|
||||
|
||||
|
||||
|
||||
const unsigned char gImage_1in02d[2560] = { /* 0X00,0X02,0X80,0X00,0X50,0X00, */
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X0C,0X00,0X00,0X00,0X00,0X00,
|
||||
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
|
||||
|
|
|
|||
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
#ifndef _IMAGEDATA_H_
|
||||
#define _IMAGEDATA_H_
|
||||
|
||||
extern const unsigned char gImage_100X50[];
|
||||
|
||||
extern const unsigned char gImage_1in02d[];
|
||||
|
||||
extern const unsigned char gImage_1in54[];
|
||||
|
|
|
|||
|
|
@ -777,6 +777,36 @@ void Paint_DrawBitMap(const unsigned char* image_buffer)
|
|||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: paste monochrome bitmap to a frame buff
|
||||
parameter:
|
||||
image_buffer :A picture data converted to a bitmap
|
||||
xStart: The starting x coordinate
|
||||
yStart: The starting y coordinate
|
||||
imageWidth: Original image width
|
||||
imageHeight: Original image height
|
||||
flipColor: Whether the color is reversed
|
||||
info:
|
||||
Use this function to paste image data into a buffer
|
||||
******************************************************************************/
|
||||
void Paint_DrawBitMap_Paste(const unsigned char* image_buffer, UWORD xStart, UWORD yStart, UWORD imageWidth, UWORD imageHeight, UBYTE flipColor)
|
||||
{
|
||||
UBYTE color, srcImage;
|
||||
UWORD x, y;
|
||||
UWORD width = (imageWidth%8==0 ? imageWidth/8 : imageWidth/8+1);
|
||||
|
||||
for (y = 0; y < imageHeight; y++) {
|
||||
for (x = 0; x < imageWidth; x++) {
|
||||
srcImage = image_buffer[y*width + x/8];
|
||||
if(flipColor)
|
||||
color = (((srcImage<<(x%8) & 0x80) == 0) ? 1 : 0);
|
||||
else
|
||||
color = (((srcImage<<(x%8) & 0x80) == 0) ? 0 : 1);
|
||||
Paint_SetPixel(x+xStart, y+yStart, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///******************************************************************************
|
||||
//function: SDisplay half of monochrome bitmap
|
||||
//parameter:
|
||||
|
|
|
|||
|
|
@ -116,6 +116,9 @@ typedef enum {
|
|||
#define FONT_FOREGROUND BLACK
|
||||
#define FONT_BACKGROUND WHITE
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
//4 Gray level
|
||||
#define GRAY1 0x03 //Blackest
|
||||
#define GRAY2 0x02
|
||||
|
|
@ -200,6 +203,7 @@ void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
|
|||
|
||||
//pic
|
||||
void Paint_DrawBitMap(const unsigned char* image_buffer);
|
||||
void Paint_DrawBitMap_Paste(const unsigned char* image_buffer, UWORD Xstart, UWORD Ystart, UWORD imageWidth, UWORD imageHeight, UBYTE flipColor);
|
||||
//void Paint_DrawBitMap_Half(const unsigned char* image_buffer, UBYTE Region);
|
||||
//void Paint_DrawBitMap_OneQuarter(const unsigned char* image_buffer, UBYTE Region);
|
||||
//void Paint_DrawBitMap_OneEighth(const unsigned char* image_buffer, UBYTE Region);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue