use It8951 files
This commit is contained in:
425
inkycal/display/drivers/parallel_drivers/lib/GUI/GUI_BMPfile.c
Normal file
425
inkycal/display/drivers/parallel_drivers/lib/GUI/GUI_BMPfile.c
Normal file
@@ -0,0 +1,425 @@
|
||||
/*****************************************************************************
|
||||
* | File : GUI_BMPfile.c
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
* Used to shield the underlying layers of each master
|
||||
* and enhance portability
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-11-12
|
||||
* | Info :
|
||||
* 1.Change file name: GUI_BMP.c -> GUI_BMPfile.c
|
||||
* 2.fix: GUI_ReadBmp()
|
||||
* Now Xstart and Xstart can control the position of the picture normally,
|
||||
* and support the display of images of any size. If it is larger than
|
||||
* the actual display range, it will not be displayed.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
|
||||
#include "GUI_BMPfile.h"
|
||||
#include "GUI_Paint.h"
|
||||
#include "../Config/Debug.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>//exit()
|
||||
#include <string.h>//memset()
|
||||
#include <math.h>//memset()
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
//global variables related to BMP picture display
|
||||
UBYTE *bmp_dst_buf = NULL;
|
||||
UBYTE *bmp_src_buf = NULL;
|
||||
UDOUBLE bmp_width, bmp_height;
|
||||
UBYTE bmp_BitCount;
|
||||
UDOUBLE bytesPerLine;
|
||||
UDOUBLE imageSize;
|
||||
UDOUBLE skip;
|
||||
BMPRGBQUAD palette[256];
|
||||
extern UBYTE isColor;
|
||||
|
||||
static void Bitmap_format_Matrix(UBYTE *dst,UBYTE *src)
|
||||
{
|
||||
UDOUBLE i,j,k;
|
||||
UBYTE *psrc = src;
|
||||
UBYTE *pdst = dst;
|
||||
UBYTE *p = psrc;
|
||||
UBYTE temp;
|
||||
UDOUBLE count;
|
||||
|
||||
//Since the bmp storage is from the back to the front, it needs to be converted in reverse order.
|
||||
switch(bmp_BitCount)
|
||||
{
|
||||
case 1:
|
||||
pdst += (bmp_width * bmp_height);
|
||||
|
||||
for(i=0;i<bmp_height;i++)
|
||||
{
|
||||
pdst -= bmp_width;
|
||||
count = 0;
|
||||
for (j=0;j<(bmp_width+7)/8;j++)
|
||||
{
|
||||
temp = p[j];
|
||||
|
||||
for (k=0;k<8;k++)
|
||||
{
|
||||
pdst[0]= ((temp & (0x80>>k)) >> (7-k));
|
||||
count++;
|
||||
pdst++;
|
||||
if (count == bmp_width)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pdst -= bmp_width;
|
||||
p += bytesPerLine;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
pdst += (bmp_width * bmp_height);
|
||||
|
||||
for(i=0;i<bmp_height;i++)
|
||||
{
|
||||
pdst -= bmp_width;
|
||||
count = 0;
|
||||
for (j=0;j<(bmp_width+1)/2;j++)
|
||||
{
|
||||
temp = p[j];
|
||||
pdst[0]= ((temp & 0xf0) >> 4);
|
||||
count++;
|
||||
pdst++;
|
||||
if (count == bmp_width)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pdst[0] = temp & 0x0f;
|
||||
count++;
|
||||
pdst++;
|
||||
if (count == bmp_width)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
pdst -= bmp_width;
|
||||
p += bytesPerLine;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
pdst += (bmp_width*bmp_height);
|
||||
for(i=0;i<bmp_height;i++)
|
||||
{
|
||||
p = psrc+(i+1)*bytesPerLine;
|
||||
p -= skip;
|
||||
for(j=0;j<bmp_width;j++)
|
||||
{
|
||||
pdst -= 1;
|
||||
p -= 1;
|
||||
pdst[0] = p[0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
pdst += (bmp_width*bmp_height*2);
|
||||
for(i=0;i<bmp_height;i++)
|
||||
{
|
||||
p = psrc+(i+1)*bytesPerLine;
|
||||
p -= skip;
|
||||
for(j=0;j<bmp_width;j++)
|
||||
{
|
||||
pdst -= 2;
|
||||
p -= 2;
|
||||
pdst[0] = p[1];
|
||||
pdst[1] = p[0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
pdst += (bmp_width*bmp_height*3);
|
||||
for(i=0;i<bmp_height;i++)
|
||||
{
|
||||
p = psrc+(i+1)*bytesPerLine;
|
||||
p -= skip;
|
||||
for(j=0;j<bmp_width;j++)
|
||||
{
|
||||
pdst -= 3;
|
||||
p -= 3;
|
||||
pdst[0] = p[2];
|
||||
pdst[1] = p[1];
|
||||
pdst[2] = p[0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 32:
|
||||
pdst += (bmp_width*bmp_height*4);
|
||||
for(i=0;i<bmp_height;i++)
|
||||
{
|
||||
p = psrc+(i+1)*bmp_width*4;
|
||||
for(j=0;j<bmp_width;j++)
|
||||
{
|
||||
pdst -= 4;
|
||||
p -= 4;
|
||||
pdst[0] = p[2];
|
||||
pdst[1] = p[1];
|
||||
pdst[2] = p[0];
|
||||
pdst[3] = p[3];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawMatrix(UWORD Xpos, UWORD Ypos,UWORD Width, UWORD High,const UBYTE* Matrix)
|
||||
{
|
||||
UWORD i,j,x,y;
|
||||
UBYTE R,G,B;
|
||||
UBYTE temp1,temp2;
|
||||
double Gray;
|
||||
|
||||
for (y=0,j=Ypos;y<High;y++,j++)
|
||||
{
|
||||
for (x=0,i=Xpos;x<Width;x++,i++)
|
||||
{
|
||||
switch(bmp_BitCount)
|
||||
{
|
||||
case 1:
|
||||
case 4:
|
||||
case 8:
|
||||
R = palette[Matrix[(y*Width+x)]].rgbRed;
|
||||
G = palette[Matrix[(y*Width+x)]].rgbGreen;
|
||||
B = palette[Matrix[(y*Width+x)]].rgbBlue;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
temp1 = Matrix[(y*Width+x)*2];
|
||||
temp2 = Matrix[(y*Width+x)*2+1];
|
||||
R = (temp1 & 0x7c)<<1;
|
||||
G = (((temp1 & 0x03) << 3 ) | ((temp2&0xe0) >> 5))<<3;
|
||||
B = (temp2 & 0x1f)<<3;
|
||||
break;
|
||||
|
||||
case 24:
|
||||
R = Matrix[(y*Width+x)*3];
|
||||
G = Matrix[(y*Width+x)*3+1];
|
||||
B = Matrix[(y*Width+x)*3+2];
|
||||
break;
|
||||
|
||||
case 32:
|
||||
R = Matrix[(y*Width+x)*4];
|
||||
G = Matrix[(y*Width+x)*4+1];
|
||||
B = Matrix[(y*Width+x)*4+2];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Gray = (R*299 + G*587 + B*114 + 500) / 1000;
|
||||
if(isColor && i%3==2)
|
||||
Paint_SetPixel(i, j, Gray/2);
|
||||
else
|
||||
Paint_SetPixel(i, j, Gray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UBYTE GUI_ReadBmp(const char *path, UWORD x, UWORD y)
|
||||
{
|
||||
//bmp file pointer
|
||||
FILE *fp;
|
||||
BMPFILEHEADER FileHead;
|
||||
BMPINFOHEADER InfoHead;
|
||||
UDOUBLE total_length;
|
||||
UBYTE *buf = NULL;
|
||||
UDOUBLE ret = -1;
|
||||
|
||||
fp = fopen(path,"rb");
|
||||
if (fp == NULL)
|
||||
{
|
||||
return(-1);
|
||||
}
|
||||
|
||||
ret = fread(&FileHead, sizeof(BMPFILEHEADER),1, fp);
|
||||
if (ret != 1)
|
||||
{
|
||||
Debug("Read header error!\n");
|
||||
fclose(fp);
|
||||
return(-2);
|
||||
}
|
||||
|
||||
//Detect if it is a bmp image, since BMP file type is "BM"(0x4D42)
|
||||
if (FileHead.bType != 0x4D42)
|
||||
{
|
||||
Debug("It's not a BMP file\n");
|
||||
fclose(fp);
|
||||
return(-3);
|
||||
}
|
||||
|
||||
Debug("*****************************************\n");
|
||||
Debug("BMP_bSize:%d \n", FileHead.bSize);
|
||||
Debug("BMP_bOffset:%d \n", FileHead.bOffset);
|
||||
|
||||
ret = fread((char *)&InfoHead, sizeof(BMPINFOHEADER),1, fp);
|
||||
if (ret != 1)
|
||||
{
|
||||
Debug("Read infoheader error!\n");
|
||||
fclose(fp);
|
||||
return(-4);
|
||||
}
|
||||
|
||||
Debug("BMP_biInfoSize:%d \n", InfoHead.biInfoSize);
|
||||
Debug("BMP_biWidth:%d \n", InfoHead.biWidth);
|
||||
Debug("BMP_biHeight:%d \n", InfoHead.biHeight);
|
||||
Debug("BMP_biPlanes:%d \n", InfoHead.biPlanes);
|
||||
Debug("BMP_biBitCount:%d \n", InfoHead.biBitCount);
|
||||
Debug("BMP_biCompression:%d \n", InfoHead.biCompression);
|
||||
Debug("BMP_bimpImageSize:%d \n", InfoHead.bimpImageSize);
|
||||
Debug("BMP_biXPelsPerMeter:%d \n", InfoHead.biXPelsPerMeter);
|
||||
Debug("BMP_biYPelsPerMeter:%d \n", InfoHead.biYPelsPerMeter);
|
||||
Debug("BMP_biClrUsed:%d \n", InfoHead.biClrUsed);
|
||||
Debug("BMP_biClrImportant:%d \n", InfoHead.biClrImportant);
|
||||
|
||||
total_length = FileHead.bSize-FileHead.bOffset;
|
||||
bytesPerLine=((InfoHead.biWidth*InfoHead.biBitCount+31)>>5)<<2;
|
||||
imageSize=bytesPerLine*InfoHead.biHeight;
|
||||
skip=(4-((InfoHead.biWidth*InfoHead.biBitCount)>>3))&3;
|
||||
|
||||
Debug("bimpImageSize:%d\n", InfoHead.bimpImageSize);
|
||||
Debug("total_length:%d\n", total_length);
|
||||
Debug("bytesPerLine = %d\n", bytesPerLine);
|
||||
Debug("imageSize = %d\n", imageSize);
|
||||
Debug("skip = %d\n", skip);
|
||||
Debug("*****************************************\n");
|
||||
|
||||
bmp_width = InfoHead.biWidth;
|
||||
bmp_height = InfoHead.biHeight;
|
||||
bmp_BitCount = InfoHead.biBitCount;
|
||||
|
||||
//This is old code, but allocate imageSize byte memory is more reasonable
|
||||
bmp_src_buf = (UBYTE*)calloc(1,total_length);
|
||||
//bmp_src_buf = (UBYTE*)calloc(1,imageSize);
|
||||
if(bmp_src_buf == NULL){
|
||||
Debug("Load > malloc bmp out of memory!\n");
|
||||
return -1;
|
||||
}
|
||||
//This is old code, but allocate imageSize byte memory is more reasonable
|
||||
bmp_dst_buf = (UBYTE*)calloc(1,total_length);
|
||||
//bmp_dst_buf = (UBYTE*)calloc(1,imageSize);
|
||||
if(bmp_dst_buf == NULL){
|
||||
Debug("Load > malloc bmp out of memory!\n");
|
||||
return -2;
|
||||
}
|
||||
|
||||
//Jump to data area
|
||||
fseek(fp, FileHead.bOffset, SEEK_SET);
|
||||
|
||||
//Bytes per line
|
||||
buf = bmp_src_buf;
|
||||
while ((ret = fread(buf,1,total_length,fp)) >= 0)
|
||||
{
|
||||
if (ret == 0)
|
||||
{
|
||||
DEV_Delay_us(100);
|
||||
continue;
|
||||
}
|
||||
buf = ((UBYTE*)buf) + ret;
|
||||
total_length = total_length - ret;
|
||||
if(total_length == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
//Jump to color pattern board
|
||||
switch(bmp_BitCount)
|
||||
{
|
||||
case 1:
|
||||
fseek(fp, 54, SEEK_SET);
|
||||
ret = fread(palette,1,4*2,fp);
|
||||
if (ret != 8)
|
||||
{
|
||||
Debug("Error: fread != 8\n");
|
||||
return -5;
|
||||
}
|
||||
|
||||
//this is old code, will likely result in memory leak if use 1bp source bmp image
|
||||
|
||||
bmp_dst_buf = (UBYTE*)calloc(1,InfoHead.biWidth * InfoHead.biHeight);
|
||||
if(bmp_dst_buf == NULL)
|
||||
{
|
||||
Debug("Load > malloc bmp out of memory!\n");
|
||||
return -5;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
fseek(fp, 54, SEEK_SET);
|
||||
ret = fread(palette,1,4*16,fp);
|
||||
if (ret != 64)
|
||||
{
|
||||
Debug("Error: fread != 64\n");
|
||||
return -5;
|
||||
}
|
||||
//this is old code, will likely result in memory leak if use 4bp source bmp image
|
||||
|
||||
bmp_dst_buf = (UBYTE*)calloc(1,InfoHead.biWidth * InfoHead.biHeight);
|
||||
if(bmp_dst_buf == NULL)
|
||||
{
|
||||
Debug("Load > malloc bmp out of memory!\n");
|
||||
return -5;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 8:
|
||||
fseek(fp, 54, SEEK_SET);
|
||||
|
||||
ret = fread(palette,1,4*256,fp);
|
||||
|
||||
if (ret != 1024)
|
||||
{
|
||||
Debug("Error: fread != 1024\n");
|
||||
return -5;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Bitmap_format_Matrix(bmp_dst_buf,bmp_src_buf);
|
||||
DrawMatrix(x, y,InfoHead.biWidth, InfoHead.biHeight, bmp_dst_buf);
|
||||
|
||||
free(bmp_src_buf);
|
||||
free(bmp_dst_buf);
|
||||
|
||||
bmp_src_buf = NULL;
|
||||
bmp_dst_buf = NULL;
|
||||
|
||||
fclose(fp);
|
||||
return(0);
|
||||
}
|
@@ -0,0 +1,87 @@
|
||||
/*****************************************************************************
|
||||
* | File : GUI_BMPfile.h
|
||||
* | Author : Waveshare team
|
||||
* | Function : Hardware underlying interface
|
||||
* | Info :
|
||||
* Used to shield the underlying layers of each master
|
||||
* and enhance portability
|
||||
*----------------
|
||||
* | This version: V2.0
|
||||
* | Date : 2018-11-12
|
||||
* | Info :
|
||||
* 1.Change file name: GUI_BMP.h -> GUI_BMPfile.h
|
||||
* 2.fix: GUI_ReadBmp()
|
||||
* Now Xstart and Xstart can control the position of the picture normally,
|
||||
* and support the display of images of any size. If it is larger than
|
||||
* the actual display range, it will not be displayed.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documnetation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
#
|
||||
******************************************************************************/
|
||||
#ifndef __GUI_BMPFILE_H
|
||||
#define __GUI_BMPFILE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../Config/DEV_Config.h"
|
||||
|
||||
extern UBYTE *bmp_dst_buf;
|
||||
extern UBYTE *bmp_src_buf;
|
||||
|
||||
/*Bitmap file header 14bit*/
|
||||
typedef struct
|
||||
{
|
||||
UWORD bType; //File identifier, as for bmp is:0x4D42
|
||||
UDOUBLE bSize; //The size of the file
|
||||
UWORD brgbReversed1; //rgbReversed value, must be set to 0
|
||||
UWORD brgbReversed2; //rgbReversed value, must be set to 0
|
||||
UDOUBLE bOffset; //The offset from the beginning of the file header to the beginning of the image data bit
|
||||
}__attribute__((packed)) BMPFILEHEADER; //Tell the compiler to cancel optimal alignment of the structure during compilation
|
||||
|
||||
|
||||
/*Bitmap information header 40bit*/
|
||||
typedef struct
|
||||
{
|
||||
UDOUBLE biInfoSize; //The size of the header: 40
|
||||
UDOUBLE biWidth; //The width of the image
|
||||
UDOUBLE biHeight; //The height of the image
|
||||
UWORD biPlanes; //The number of target planes in the image
|
||||
UWORD biBitCount; //The number of bits per pixel
|
||||
UDOUBLE biCompression; //Compression type
|
||||
UDOUBLE bimpImageSize; //The size of the image in bytes. The data must be a multiple of 4.
|
||||
UDOUBLE biXPelsPerMeter; //Number of horizontal pixel of the target device per meter
|
||||
UDOUBLE biYPelsPerMeter; //Number of vertical pixel of the target device per meter
|
||||
UDOUBLE biClrUsed; //Number of colors for bitmap used in color palette
|
||||
UDOUBLE biClrImportant; //Specifies the number of important colors. When the value of this field is equal to the number of colors (or equal to 0), it means that all colors are equally important.
|
||||
}__attribute__((packed)) BMPINFOHEADER;//Tell the compiler to cancel optimal alignment of the structure during compilation
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UBYTE rgbBlue; //rgbBlue intensity
|
||||
UBYTE rgbGreen; //rgbGreen intensity
|
||||
UBYTE rgbRed; //rgbRed intensity
|
||||
UBYTE rgbReversed; //rgbReversed value
|
||||
}__attribute__((packed)) BMPRGBQUAD;//Tell the compiler to cancel optimal alignment of the structure during compilation
|
||||
|
||||
UBYTE GUI_ReadBmp(const char *path, UWORD x, UWORD y);
|
||||
|
||||
#endif
|
776
inkycal/display/drivers/parallel_drivers/lib/GUI/GUI_Paint.c
Normal file
776
inkycal/display/drivers/parallel_drivers/lib/GUI/GUI_Paint.c
Normal file
@@ -0,0 +1,776 @@
|
||||
/******************************************************************************
|
||||
* | File : GUI_Paint.c
|
||||
* | Author : Waveshare electronics
|
||||
* | Function : Achieve drawing: draw points, lines, boxes, circles and
|
||||
* their size, solid dotted line, solid rectangle hollow
|
||||
* rectangle, solid circle hollow circle.
|
||||
* | Info :
|
||||
* Achieve display characters: Display a single character, string, number
|
||||
* Achieve time display: adaptive size display time minutes and seconds
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-04-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-04-18):
|
||||
* 1.Change:
|
||||
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
|
||||
* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
|
||||
* Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
|
||||
* Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
* Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-15):
|
||||
* 1.add: Paint_NewImage()
|
||||
* Create an image's properties
|
||||
* 2.add: Paint_SelectImage()
|
||||
* Select the picture to be drawn
|
||||
* 3.add: Paint_SetRotate()
|
||||
* Set the direction of the cache
|
||||
* 4.add: Paint_RotateImage()
|
||||
* Can flip the picture, Support 0-360 degrees,
|
||||
* but only 90.180.270 rotation is better
|
||||
* 4.add: Paint_SetMirroring()
|
||||
* Can Mirroring the picture, horizontal, vertical, origin
|
||||
* 5.add: Paint_DrawString_CN()
|
||||
* Can display Chinese(GB1312)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V1.0(2018-07-17):
|
||||
* Create library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documnetation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#include "GUI_Paint.h"
|
||||
#include "../Config/Debug.h"
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> //memset()
|
||||
#include <math.h>
|
||||
|
||||
PAINT Paint;
|
||||
UBYTE isColor = 0;
|
||||
/******************************************************************************
|
||||
function: Create Image
|
||||
parameter:
|
||||
image : Pointer to the image cache
|
||||
width : The width of the picture
|
||||
Height : The height of the picture
|
||||
Color : Whether the picture is inverted
|
||||
******************************************************************************/
|
||||
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color)
|
||||
{
|
||||
Paint.Image = NULL;
|
||||
Paint.Image = image;
|
||||
|
||||
Paint.WidthMemory = Width;
|
||||
Paint.HeightMemory = Height;
|
||||
Paint.Color = Color;
|
||||
Paint.BitsPerPixel = 8;
|
||||
Paint.GrayScale = pow(2, Paint.BitsPerPixel);
|
||||
Paint.WidthByte = Width;
|
||||
Paint.HeightByte = Height;
|
||||
|
||||
Paint.Rotate = Rotate;
|
||||
Paint.Mirror = MIRROR_NONE;
|
||||
|
||||
if(Rotate == ROTATE_0 || Rotate == ROTATE_180) {
|
||||
Paint.Width = Width;
|
||||
Paint.Height = Height;
|
||||
} else {
|
||||
Paint.Width = Height;
|
||||
Paint.Height = Width;
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Select Image
|
||||
parameter:
|
||||
image : Pointer to the image cache
|
||||
******************************************************************************/
|
||||
void Paint_SelectImage(UBYTE *image)
|
||||
{
|
||||
Paint.Image = image;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Select Image Rotate
|
||||
parameter:
|
||||
Rotate : 0,90,180,270
|
||||
******************************************************************************/
|
||||
void Paint_SetRotate(UWORD Rotate)
|
||||
{
|
||||
if(Rotate == ROTATE_0 || Rotate == ROTATE_90 || Rotate == ROTATE_180 || Rotate == ROTATE_270) {
|
||||
Debug("Set image Rotate %d\r\n", Rotate);
|
||||
Paint.Rotate = Rotate;
|
||||
} else {
|
||||
Debug("rotate = 0, 90, 180, 270\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Select Image mirror
|
||||
parameter:
|
||||
mirror :Not mirror,Horizontal mirror,Vertical mirror,Origin mirror
|
||||
******************************************************************************/
|
||||
void Paint_SetMirroring(UBYTE mirror)
|
||||
{
|
||||
if(mirror == MIRROR_NONE || mirror == MIRROR_HORIZONTAL ||
|
||||
mirror == MIRROR_VERTICAL || mirror == MIRROR_ORIGIN) {
|
||||
Debug("mirror image x:%s, y:%s\r\n",(mirror & 0x01)? "mirror":"none", ((mirror >> 1) & 0x01)? "mirror":"none");
|
||||
Paint.Mirror = mirror;
|
||||
} else {
|
||||
Debug("mirror should be MIRROR_NONE, MIRROR_HORIZONTAL, \
|
||||
MIRROR_VERTICAL or MIRROR_ORIGIN\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Set BitsPerPixel
|
||||
parameter:
|
||||
Xpoint : At point X
|
||||
Ypoint : At point Y
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_SetBitsPerPixel(UBYTE bpp)
|
||||
{
|
||||
if(bpp == 8 || bpp == 4 || bpp == 2 || bpp == 1){
|
||||
Paint.BitsPerPixel = bpp;
|
||||
Paint.GrayScale = pow(2, Paint.BitsPerPixel);
|
||||
Paint.WidthByte = (Paint.WidthMemory * bpp % 8 == 0)? (Paint.WidthMemory * bpp / 8 ) : (Paint.WidthMemory * bpp / 8 + 1);
|
||||
}
|
||||
else{
|
||||
Debug("Set BitsPerPixel Input parameter error\r\n");
|
||||
Debug("BitsPerPixel Only support: 1 2 4 8 \r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw Pixels
|
||||
parameter:
|
||||
Xpoint : At point X
|
||||
Ypoint : At point Y
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color)
|
||||
{
|
||||
if(Xpoint > Paint.Width || Ypoint > Paint.Height){
|
||||
//Debug("Exceeding display boundaries\r\n");
|
||||
return;
|
||||
}
|
||||
UWORD X, Y;
|
||||
|
||||
switch(Paint.Rotate) {
|
||||
case 0:
|
||||
X = Xpoint;
|
||||
Y = Ypoint;
|
||||
break;
|
||||
case 90:
|
||||
X = Paint.WidthMemory - Ypoint - 1;
|
||||
Y = Xpoint;
|
||||
break;
|
||||
case 180:
|
||||
X = Paint.WidthMemory - Xpoint - 1;
|
||||
Y = Paint.HeightMemory - Ypoint - 1;
|
||||
break;
|
||||
case 270:
|
||||
X = Ypoint;
|
||||
Y = Paint.HeightMemory - Xpoint - 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
switch(Paint.Mirror) {
|
||||
case MIRROR_NONE:
|
||||
break;
|
||||
case MIRROR_HORIZONTAL:
|
||||
X = Paint.WidthMemory - X - 1;
|
||||
break;
|
||||
case MIRROR_VERTICAL:
|
||||
Y = Paint.HeightMemory - Y - 1;
|
||||
break;
|
||||
case MIRROR_ORIGIN:
|
||||
X = Paint.WidthMemory - X - 1;
|
||||
Y = Paint.HeightMemory - Y - 1;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(X > Paint.WidthMemory || Y > Paint.HeightMemory){
|
||||
Debug("Exceeding display boundaries\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
UDOUBLE Addr = X * (Paint.BitsPerPixel) / 8 + Y * Paint.WidthByte;
|
||||
|
||||
switch( Paint.BitsPerPixel ){
|
||||
case 8:{
|
||||
Paint.Image[Addr] = Color & 0xF0;
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
Paint.Image[Addr] &= ~( (0xF0) >> (7 - (X*4+3)%8 ) );
|
||||
Paint.Image[Addr] |= (Color & 0xF0) >> (7 - (X*4+3)%8 );
|
||||
break;
|
||||
}
|
||||
case 2:{
|
||||
Paint.Image[Addr] &= ~( (0xC0) >> (7 - (X*2+1)%8 ) );
|
||||
Paint.Image[Addr] |= (Color & 0xC0) >> (7 - (X*2+1)%8 );
|
||||
break;
|
||||
}
|
||||
case 1:{
|
||||
Paint.Image[Addr] &= ~( (0x80) >> (7 - X%8) );
|
||||
Paint.Image[Addr] |= (Color & 0x80) >> (7 - X%8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Paint_SetColor(UWORD x, UWORD y, UWORD color)
|
||||
{
|
||||
UWORD arr_XY[2] = {x, y};
|
||||
UBYTE arr_color[9];
|
||||
UBYTE offset = x/3%3;
|
||||
|
||||
if(x%3 != 1)
|
||||
(x%3==0) ? (arr_XY[0]++) : (arr_XY[0]--);
|
||||
if((y+2)%3 != 1)
|
||||
((y+2)%3==0) ? (arr_XY[1]++) : (arr_XY[1]--);
|
||||
arr_XY[1] -= offset;
|
||||
|
||||
Paint_GetColor(color, arr_color);
|
||||
for(UBYTE i=0; i<3; i++) {
|
||||
for(UBYTE j=0; j<3; j++) {
|
||||
Paint_SetPixel(arr_XY[0]-1+j, arr_XY[1]-1+i, arr_color[i*3+j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Paint_GetColor(UWORD color, UBYTE* arr_color)
|
||||
{
|
||||
UBYTE* p_color = arr_color;
|
||||
UWORD R, G, B;
|
||||
|
||||
B = (color>>4) & 0xf0;
|
||||
G = color & 0xf0;
|
||||
R = (color<<4) & 0xf0;
|
||||
UBYTE temp[9] = {G, G, G/2, B, B, B/2, R, R, R/2};
|
||||
|
||||
for(UBYTE t=0; t<9; t++) {
|
||||
p_color[t] = temp[t];
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Clear the color of the picture
|
||||
parameter:
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_Clear(UWORD Color)
|
||||
{
|
||||
UDOUBLE ImageSize = Paint.WidthByte * Paint.HeightByte;
|
||||
memset(Paint.Image, Color, ImageSize);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Clear the color of a window
|
||||
parameter:
|
||||
Xstart : x starting point
|
||||
Ystart : Y starting point
|
||||
Xend : x end point
|
||||
Yend : y end point
|
||||
Color : Painted colors
|
||||
******************************************************************************/
|
||||
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color)
|
||||
{
|
||||
for (UWORD Y = Ystart; Y < Yend; Y++) {
|
||||
for (UWORD X = Xstart; X < Xend; X++) {
|
||||
Paint_SetPixel(X, Y, Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw Point(Xpoint, Ypoint) Fill the color
|
||||
parameter:
|
||||
Xpoint : The Xpoint coordinate of the point
|
||||
Ypoint : The Ypoint coordinate of the point
|
||||
Color : Painted color
|
||||
Dot_Pixel : point size
|
||||
Dot_Style : point Style
|
||||
******************************************************************************/
|
||||
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color,
|
||||
DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_Style)
|
||||
{
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DrawPoint Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int16_t XDir_Num , YDir_Num;
|
||||
if (Dot_Style == DOT_FILL_AROUND) {
|
||||
for (XDir_Num = 0; XDir_Num < 2 * Dot_Pixel - 1; XDir_Num++) {
|
||||
for (YDir_Num = 0; YDir_Num < 2 * Dot_Pixel - 1; YDir_Num++) {
|
||||
if(Xpoint + XDir_Num - Dot_Pixel < 0 || Ypoint + YDir_Num - Dot_Pixel < 0)
|
||||
break;
|
||||
// Debug("x = %d, y = %d\r\n", Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel);
|
||||
if(isColor)
|
||||
Paint_SetColor(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
|
||||
else
|
||||
Paint_SetPixel(Xpoint + XDir_Num - Dot_Pixel, Ypoint + YDir_Num - Dot_Pixel, Color);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (XDir_Num = 0; XDir_Num < Dot_Pixel; XDir_Num++) {
|
||||
for (YDir_Num = 0; YDir_Num < Dot_Pixel; YDir_Num++) {
|
||||
if(isColor)
|
||||
Paint_SetColor(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
|
||||
else
|
||||
Paint_SetPixel(Xpoint + XDir_Num - 1, Ypoint + YDir_Num - 1, Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw a line of arbitrary slope
|
||||
parameter:
|
||||
Xstart :Starting Xpoint point coordinates
|
||||
Ystart :Starting Xpoint point coordinates
|
||||
Xend :End point Xpoint coordinate
|
||||
Yend :End point Ypoint coordinate
|
||||
Color :The color of the line segment
|
||||
Line_width : Line width
|
||||
Line_Style: Solid and dotted lines
|
||||
******************************************************************************/
|
||||
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
|
||||
UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style)
|
||||
{
|
||||
if (Xstart > Paint.Width || Ystart > Paint.Height ||
|
||||
Xend > Paint.Width || Yend > Paint.Height) {
|
||||
Debug("Paint_DrawLine Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
UWORD Xpoint = Xstart;
|
||||
UWORD Ypoint = Ystart;
|
||||
int dx = (int)Xend - (int)Xstart >= 0 ? Xend - Xstart : Xstart - Xend;
|
||||
int dy = (int)Yend - (int)Ystart <= 0 ? Yend - Ystart : Ystart - Yend;
|
||||
|
||||
// Increment direction, 1 is positive, -1 is counter;
|
||||
int XAddway = Xstart < Xend ? 1 : -1;
|
||||
int YAddway = Ystart < Yend ? 1 : -1;
|
||||
|
||||
//Cumulative error
|
||||
int Esp = dx + dy;
|
||||
char Dotted_Len = 0;
|
||||
|
||||
for (;;) {
|
||||
Dotted_Len++;
|
||||
//Painted dotted line, 2 point is really virtual
|
||||
if (Line_Style == LINE_STYLE_DOTTED && Dotted_Len % 3 == 0) {
|
||||
//Debug("LINE_DOTTED\r\n");
|
||||
Paint_DrawPoint(Xpoint, Ypoint, IMAGE_BACKGROUND, Line_width, DOT_STYLE_DFT);
|
||||
Dotted_Len = 0;
|
||||
} else {
|
||||
Paint_DrawPoint(Xpoint, Ypoint, Color, Line_width, DOT_STYLE_DFT);
|
||||
}
|
||||
if (2 * Esp >= dy) {
|
||||
if (Xpoint == Xend)
|
||||
break;
|
||||
Esp += dy;
|
||||
Xpoint += XAddway;
|
||||
}
|
||||
if (2 * Esp <= dx) {
|
||||
if (Ypoint == Yend)
|
||||
break;
|
||||
Esp += dx;
|
||||
Ypoint += YAddway;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Draw a rectangle
|
||||
parameter:
|
||||
Xstart :Rectangular Starting Xpoint point coordinates
|
||||
Ystart :Rectangular Starting Xpoint point coordinates
|
||||
Xend :Rectangular End point Xpoint coordinate
|
||||
Yend :Rectangular End point Ypoint coordinate
|
||||
Color :The color of the Rectangular segment
|
||||
Line_width: Line width
|
||||
Draw_Fill : Whether to fill the inside of the rectangle
|
||||
******************************************************************************/
|
||||
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend,
|
||||
UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
{
|
||||
if (Xstart > Paint.Width || Ystart > Paint.Height ||
|
||||
Xend > Paint.Width || Yend > Paint.Height) {
|
||||
Debug("Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (Draw_Fill) {
|
||||
UWORD Ypoint;
|
||||
for(Ypoint = Ystart; Ypoint < Yend; Ypoint++) {
|
||||
Paint_DrawLine(Xstart, Ypoint, Xend, Ypoint, Color , Line_width, LINE_STYLE_SOLID);
|
||||
}
|
||||
} else {
|
||||
Paint_DrawLine(Xstart, Ystart, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(Xstart, Ystart, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(Xend, Yend, Xend, Ystart, Color, Line_width, LINE_STYLE_SOLID);
|
||||
Paint_DrawLine(Xend, Yend, Xstart, Yend, Color, Line_width, LINE_STYLE_SOLID);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Use the 8-point method to draw a circle of the
|
||||
specified size at the specified position->
|
||||
parameter:
|
||||
X_Center :Center X coordinate
|
||||
Y_Center :Center Y coordinate
|
||||
Radius :circle Radius
|
||||
Color :The color of the :circle segment
|
||||
Line_width: Line width
|
||||
Draw_Fill : Whether to fill the inside of the Circle
|
||||
******************************************************************************/
|
||||
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius,
|
||||
UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
{
|
||||
if (X_Center > Paint.Width || Y_Center >= Paint.Height) {
|
||||
Debug("Paint_DrawCircle Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//Draw a circle from(0, R) as a starting point
|
||||
int16_t XCurrent, YCurrent;
|
||||
XCurrent = 0;
|
||||
YCurrent = Radius;
|
||||
|
||||
//Cumulative error,judge the next point of the logo
|
||||
int16_t Esp = 3 - (Radius << 1 );
|
||||
|
||||
int16_t sCountY;
|
||||
if (Draw_Fill == DRAW_FILL_FULL) {
|
||||
while (XCurrent <= YCurrent ) { //Realistic circles
|
||||
for (sCountY = XCurrent; sCountY <= YCurrent; sCountY ++ ) {
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//1
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center + sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//2
|
||||
Paint_DrawPoint(X_Center - sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//3
|
||||
Paint_DrawPoint(X_Center - sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//4
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//5
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center - sCountY, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//6
|
||||
Paint_DrawPoint(X_Center + sCountY, Y_Center - XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);//7
|
||||
Paint_DrawPoint(X_Center + sCountY, Y_Center + XCurrent, Color, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
if (Esp < 0 )
|
||||
Esp += 4 * XCurrent + 6;
|
||||
else {
|
||||
Esp += 10 + 4 * (XCurrent - YCurrent );
|
||||
YCurrent --;
|
||||
}
|
||||
XCurrent ++;
|
||||
}
|
||||
} else { //Draw a hollow circle
|
||||
while (XCurrent <= YCurrent ) {
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//1
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center + YCurrent, Color, Line_width, DOT_STYLE_DFT);//2
|
||||
Paint_DrawPoint(X_Center - YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//3
|
||||
Paint_DrawPoint(X_Center - YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//4
|
||||
Paint_DrawPoint(X_Center - XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//5
|
||||
Paint_DrawPoint(X_Center + XCurrent, Y_Center - YCurrent, Color, Line_width, DOT_STYLE_DFT);//6
|
||||
Paint_DrawPoint(X_Center + YCurrent, Y_Center - XCurrent, Color, Line_width, DOT_STYLE_DFT);//7
|
||||
Paint_DrawPoint(X_Center + YCurrent, Y_Center + XCurrent, Color, Line_width, DOT_STYLE_DFT);//0
|
||||
|
||||
if (Esp < 0 )
|
||||
Esp += 4 * XCurrent + 6;
|
||||
else {
|
||||
Esp += 10 + 4 * (XCurrent - YCurrent );
|
||||
YCurrent --;
|
||||
}
|
||||
XCurrent ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Show English characters
|
||||
parameter:
|
||||
Xpoint :X coordinate
|
||||
Ypoint :Y coordinate
|
||||
Acsii_Char :To display the English characters
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawChar(UWORD Xpoint, UWORD Ypoint, const char Acsii_Char,
|
||||
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
UWORD Page, Column;
|
||||
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DrawChar Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t Char_Offset = (Acsii_Char - ' ') * Font->Height * (Font->Width / 8 + (Font->Width % 8 ? 1 : 0));
|
||||
const unsigned char *ptr = &Font->table[Char_Offset];
|
||||
|
||||
for (Page = 0; Page < Font->Height; Page ++ ) {
|
||||
for (Column = 0; Column < Font->Width; Column ++ ) {
|
||||
|
||||
//To determine whether the font background color and screen background color is consistent
|
||||
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
|
||||
if (*ptr & (0x80 >> (Column % 8)))
|
||||
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Foreground);
|
||||
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
if (*ptr & (0x80 >> (Column % 8))) {
|
||||
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Foreground);
|
||||
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
Paint_SetPixel(Xpoint + Column, Ypoint + Page, Color_Background);
|
||||
// Paint_DrawPoint(Xpoint + Column, Ypoint + Page, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
}
|
||||
//One pixel is 8 bits
|
||||
if (Column % 8 == 7)
|
||||
ptr++;
|
||||
}// Write a line
|
||||
if (Font->Width % 8 != 0)
|
||||
ptr++;
|
||||
}// Write all
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display the string
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart :Y coordinate
|
||||
pString :The first address of the English string to be displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString,
|
||||
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
UWORD Xpoint = Xstart;
|
||||
UWORD Ypoint = Ystart;
|
||||
|
||||
if (Xstart > Paint.Width || Ystart > Paint.Height) {
|
||||
Debug("Paint_DrawString_EN Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
while (* pString != '\0') {
|
||||
//if X direction filled , reposition to(Xstart,Ypoint),Ypoint is Y direction plus the Height of the character
|
||||
if ((Xpoint + Font->Width ) > Paint.Width ) {
|
||||
Xpoint = Xstart;
|
||||
Ypoint += Font->Height;
|
||||
}
|
||||
|
||||
// If the Y direction is full, reposition to(Xstart, Ystart)
|
||||
if ((Ypoint + Font->Height ) > Paint.Height ) {
|
||||
Xpoint = Xstart;
|
||||
Ypoint = Ystart;
|
||||
}
|
||||
Paint_DrawChar(Xpoint, Ypoint, * pString, Font, Color_Foreground, Color_Background);
|
||||
|
||||
//The next character of the address
|
||||
pString ++;
|
||||
|
||||
//The next word of the abscissa increases the font of the broadband
|
||||
Xpoint += Font->Width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
function: Display the string
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart :Y coordinate
|
||||
pString :The first address of the Chinese string and English
|
||||
string to be displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font,
|
||||
UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
const char* p_text = pString;
|
||||
int x = Xstart, y = Ystart;
|
||||
int i, j,Num;
|
||||
|
||||
/* Send the string character by character on EPD */
|
||||
while (*p_text != 0) {
|
||||
if(*p_text <= 0x7F) { //ASCII < 126
|
||||
for(Num = 0; Num < font->size; Num++) {
|
||||
if(*p_text== font->table[Num].index[0]) {
|
||||
const char* ptr = &font->table[Num].matrix[0];
|
||||
|
||||
for (j = 0; j < font->Height; j++) {
|
||||
for (i = 0; i < font->Width; i++) {
|
||||
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
} else {
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
Paint_SetPixel(x + i, y + j, Color_Background);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
}
|
||||
if (i % 8 == 7) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
if (font->Width % 8 != 0) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Point on the next character */
|
||||
p_text += 1;
|
||||
/* Decrement the column position by 16 */
|
||||
x += font->ASCII_Width;
|
||||
} else { //Chinese
|
||||
for(Num = 0; Num < font->size; Num++) {
|
||||
if((*p_text== font->table[Num].index[0]) && (*(p_text+1) == font->table[Num].index[1])) {
|
||||
const char* ptr = &font->table[Num].matrix[0];
|
||||
|
||||
for (j = 0; j < font->Height; j++) {
|
||||
for (i = 0; i < font->Width; i++) {
|
||||
if (FONT_BACKGROUND == Color_Background) { //this process is to speed up the scan
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
} else {
|
||||
if (*ptr & (0x80 >> (i % 8))) {
|
||||
Paint_SetPixel(x + i, y + j, Color_Foreground);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Foreground, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
} else {
|
||||
Paint_SetPixel(x + i, y + j, Color_Background);
|
||||
// Paint_DrawPoint(x + i, y + j, Color_Background, DOT_PIXEL_DFT, DOT_STYLE_DFT);
|
||||
}
|
||||
}
|
||||
if (i % 8 == 7) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
if (font->Width % 8 != 0) {
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* Point on the next character */
|
||||
p_text += 2;
|
||||
/* Decrement the column position by 16 */
|
||||
x += font->Width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display nummber
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart : Y coordinate
|
||||
Nummber : The number displayed
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
#define ARRAY_LEN 255
|
||||
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber,
|
||||
sFONT* Font, UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
|
||||
int16_t Num_Bit = 0, Str_Bit = 0;
|
||||
uint8_t Str_Array[ARRAY_LEN] = {0}, Num_Array[ARRAY_LEN] = {0};
|
||||
uint8_t *pStr = Str_Array;
|
||||
|
||||
if (Xpoint > Paint.Width || Ypoint > Paint.Height) {
|
||||
Debug("Paint_DisNum Input exceeds the normal display range\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
//Converts a number to a string
|
||||
while (Nummber) {
|
||||
Num_Array[Num_Bit] = Nummber % 10 + '0';
|
||||
Num_Bit++;
|
||||
Nummber /= 10;
|
||||
}
|
||||
|
||||
//The string is inverted
|
||||
while (Num_Bit > 0) {
|
||||
Str_Array[Str_Bit] = Num_Array[Num_Bit - 1];
|
||||
Str_Bit ++;
|
||||
Num_Bit --;
|
||||
}
|
||||
|
||||
//show
|
||||
Paint_DrawString_EN(Xpoint, Ypoint, (const char*)pStr, Font, Color_Foreground, Color_Background);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
function: Display time
|
||||
parameter:
|
||||
Xstart :X coordinate
|
||||
Ystart : Y coordinate
|
||||
pTime : Time-related structures
|
||||
Font :A structure pointer that displays a character size
|
||||
Color_Foreground : Select the foreground color
|
||||
Color_Background : Select the background color
|
||||
******************************************************************************/
|
||||
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font,
|
||||
UWORD Color_Foreground, UWORD Color_Background)
|
||||
{
|
||||
uint8_t value[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
|
||||
|
||||
UWORD Dx = Font->Width;
|
||||
|
||||
//Write data into the cache
|
||||
Paint_DrawChar(Xstart , Ystart, value[pTime->Hour / 10], Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx , Ystart, value[pTime->Hour % 10], Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx + Dx / 4 + Dx / 2 , Ystart, ':' , Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx * 2 + Dx / 2 , Ystart, value[pTime->Min / 10] , Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx * 3 + Dx / 2 , Ystart, value[pTime->Min % 10] , Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx * 4 + Dx / 2 - Dx / 4, Ystart, ':' , Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx * 5 , Ystart, value[pTime->Sec / 10] , Font, Color_Foreground, Color_Background);
|
||||
Paint_DrawChar(Xstart + Dx * 6 , Ystart, value[pTime->Sec % 10] , Font, Color_Foreground, Color_Background);
|
||||
}
|
224
inkycal/display/drivers/parallel_drivers/lib/GUI/GUI_Paint.h
Normal file
224
inkycal/display/drivers/parallel_drivers/lib/GUI/GUI_Paint.h
Normal file
@@ -0,0 +1,224 @@
|
||||
/******************************************************************************
|
||||
* | File : GUI_Paint.h
|
||||
* | Author : Waveshare electronics
|
||||
* | Function : Achieve drawing: draw points, lines, boxes, circles and
|
||||
* their size, solid dotted line, solid rectangle hollow
|
||||
* rectangle, solid circle hollow circle.
|
||||
* | Info :
|
||||
* Achieve display characters: Display a single character, string, number
|
||||
* Achieve time display: adaptive size display time minutes and seconds
|
||||
*----------------
|
||||
* | This version: V3.0
|
||||
* | Date : 2019-04-18
|
||||
* | Info :
|
||||
* -----------------------------------------------------------------------------
|
||||
* V3.0(2019-04-18):
|
||||
* 1.Change:
|
||||
* Paint_DrawPoint(..., DOT_STYLE DOT_STYLE)
|
||||
* => Paint_DrawPoint(..., DOT_STYLE Dot_Style)
|
||||
* Paint_DrawLine(..., LINE_STYLE Line_Style, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawLine(..., DOT_PIXEL Line_width, LINE_STYLE Line_Style)
|
||||
* Paint_DrawRectangle(..., DRAW_FILL Filled, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawRectangle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Fill)
|
||||
* Paint_DrawCircle(..., DRAW_FILL Draw_Fill, DOT_PIXEL Dot_Pixel)
|
||||
* => Paint_DrawCircle(..., DOT_PIXEL Line_width, DRAW_FILL Draw_Filll)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V2.0(2018-11-15):
|
||||
* 1.add: Paint_NewImage()
|
||||
* Create an image's properties
|
||||
* 2.add: Paint_SelectImage()
|
||||
* Select the picture to be drawn
|
||||
* 3.add: Paint_SetRotate()
|
||||
* Set the direction of the cache
|
||||
* 4.add: Paint_RotateImage()
|
||||
* Can flip the picture, Support 0-360 degrees,
|
||||
* but only 90.180.270 rotation is better
|
||||
* 4.add: Paint_SetMirroring()
|
||||
* Can Mirroring the picture, horizontal, vertical, origin
|
||||
* 5.add: Paint_DrawString_CN()
|
||||
* Can display Chinese(GB1312)
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
* V1.0(2018-07-17):
|
||||
* Create library
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documnetation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS OR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*
|
||||
******************************************************************************/
|
||||
#ifndef __GUI_PAINT_H
|
||||
#define __GUI_PAINT_H
|
||||
|
||||
#include "../Config/DEV_Config.h"
|
||||
#include "../Fonts/fonts.h"
|
||||
|
||||
/**
|
||||
* Image attributes
|
||||
**/
|
||||
typedef struct {
|
||||
UBYTE *Image;
|
||||
UWORD Width;
|
||||
UWORD Height;
|
||||
UWORD WidthMemory;
|
||||
UWORD HeightMemory;
|
||||
UWORD Color;
|
||||
UWORD Rotate;
|
||||
UWORD Mirror;
|
||||
UWORD WidthByte;
|
||||
UWORD HeightByte;
|
||||
UWORD BitsPerPixel;
|
||||
UWORD GrayScale;
|
||||
} PAINT;
|
||||
extern PAINT Paint;
|
||||
|
||||
/**
|
||||
* Display rotate
|
||||
**/
|
||||
#define ROTATE_0 0
|
||||
#define ROTATE_90 90
|
||||
#define ROTATE_180 180
|
||||
#define ROTATE_270 270
|
||||
|
||||
/**
|
||||
* Display Flip
|
||||
**/
|
||||
typedef enum {
|
||||
MIRROR_NONE = 0x00,
|
||||
MIRROR_HORIZONTAL = 0x01,
|
||||
MIRROR_VERTICAL = 0x02,
|
||||
MIRROR_ORIGIN = 0x03,
|
||||
} MIRROR_IMAGE;
|
||||
#define MIRROR_IMAGE_DFT MIRROR_NONE
|
||||
|
||||
/**
|
||||
* image color
|
||||
**/
|
||||
#define WHITE 0xFF
|
||||
#define BLACK 0x00
|
||||
|
||||
#define IMAGE_BACKGROUND WHITE
|
||||
#define FONT_FOREGROUND BLACK
|
||||
#define FONT_BACKGROUND WHITE
|
||||
|
||||
/*
|
||||
For color definition of all BitsPerPixel, you can refer to this:
|
||||
|
||||
8bpp: 0x00-0xF0, as for 8bp will automatically reduce to 4bp, the detail value of 8bp is:
|
||||
0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xA0 0xB0 0xC0 0xE0 0xF0 16 grayscale in total
|
||||
which only occupy upper 4 bits of a byte
|
||||
|
||||
4bpp: 0x00-0xF0
|
||||
0x00 0x10 0x20 0x30 0x40 0x50 0x60 0x70 0x80 0x90 0xA0 0xB0 0xC0 0xE0 0xF0 16 grayscale in total
|
||||
which only occupy upper 4 bits of a byte
|
||||
|
||||
2bpp: 0x00-0xC0
|
||||
0x00 0x40 0x80 0xC0 4 grayscale in total
|
||||
which only occupy upper 2 bits of a byte
|
||||
|
||||
1bpp: 0x00-0x80
|
||||
0x00 0x80 2 grayscale in total
|
||||
which only occupy upper 1 bits of a byte
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The size of the point
|
||||
**/
|
||||
typedef enum {
|
||||
DOT_PIXEL_1X1 = 1, // 1 x 1
|
||||
DOT_PIXEL_2X2 , // 2 X 2
|
||||
DOT_PIXEL_3X3 , // 3 X 3
|
||||
DOT_PIXEL_4X4 , // 4 X 4
|
||||
DOT_PIXEL_5X5 , // 5 X 5
|
||||
DOT_PIXEL_6X6 , // 6 X 6
|
||||
DOT_PIXEL_7X7 , // 7 X 7
|
||||
DOT_PIXEL_8X8 , // 8 X 8
|
||||
} DOT_PIXEL;
|
||||
#define DOT_PIXEL_DFT DOT_PIXEL_1X1 //Default dot pilex
|
||||
|
||||
/**
|
||||
* Point size fill style
|
||||
**/
|
||||
typedef enum {
|
||||
DOT_FILL_AROUND = 1, // dot pixel 1 x 1
|
||||
DOT_FILL_RIGHTUP , // dot pixel 2 X 2
|
||||
} DOT_STYLE;
|
||||
#define DOT_STYLE_DFT DOT_FILL_AROUND //Default dot pilex
|
||||
|
||||
/**
|
||||
* Line style, solid or dashed
|
||||
**/
|
||||
typedef enum {
|
||||
LINE_STYLE_SOLID = 0,
|
||||
LINE_STYLE_DOTTED,
|
||||
} LINE_STYLE;
|
||||
|
||||
/**
|
||||
* Whether the graphic is filled
|
||||
**/
|
||||
typedef enum {
|
||||
DRAW_FILL_EMPTY = 0,
|
||||
DRAW_FILL_FULL,
|
||||
} DRAW_FILL;
|
||||
|
||||
/**
|
||||
* Custom structure of a time attribute
|
||||
**/
|
||||
typedef struct {
|
||||
UWORD Year; //0000
|
||||
UBYTE Month; //1 - 12
|
||||
UBYTE Day; //1 - 30
|
||||
UBYTE Hour; //0 - 23
|
||||
UBYTE Min; //0 - 59
|
||||
UBYTE Sec; //0 - 59
|
||||
} PAINT_TIME;
|
||||
extern PAINT_TIME sPaint_time;
|
||||
|
||||
//init and Clear
|
||||
void Paint_NewImage(UBYTE *image, UWORD Width, UWORD Height, UWORD Rotate, UWORD Color);
|
||||
void Paint_SelectImage(UBYTE *image);
|
||||
void Paint_SetRotate(UWORD Rotate);
|
||||
void Paint_SetMirroring(UBYTE mirror);
|
||||
void Paint_SetBitsPerPixel(UBYTE bpp);
|
||||
void Paint_SetPixel(UWORD Xpoint, UWORD Ypoint, UWORD Color);
|
||||
|
||||
void Paint_Clear(UWORD Color);
|
||||
void Paint_ClearWindows(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color);
|
||||
|
||||
//Drawing
|
||||
void Paint_DrawPoint(UWORD Xpoint, UWORD Ypoint, UWORD Color, DOT_PIXEL Dot_Pixel, DOT_STYLE Dot_FillWay);
|
||||
void Paint_DrawLine(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, LINE_STYLE Line_Style);
|
||||
void Paint_DrawRectangle(UWORD Xstart, UWORD Ystart, UWORD Xend, UWORD Yend, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
|
||||
void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius, UWORD Color, DOT_PIXEL Line_width, DRAW_FILL Draw_Fill);
|
||||
|
||||
//Display string
|
||||
void Paint_DrawChar(UWORD Xstart, UWORD Ystart, const char Acsii_Char, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawString_EN(UWORD Xstart, UWORD Ystart, const char * pString, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawString_CN(UWORD Xstart, UWORD Ystart, const char * pString, cFONT* font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawNum(UWORD Xpoint, UWORD Ypoint, int32_t Nummber, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
void Paint_DrawTime(UWORD Xstart, UWORD Ystart, PAINT_TIME *pTime, sFONT* Font, UWORD Color_Foreground, UWORD Color_Background);
|
||||
|
||||
void Paint_SetColor(UWORD x, UWORD y, UWORD color);
|
||||
void Paint_GetColor(UWORD color, UBYTE* arr_color);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user