|
|
@@ -497,265 +497,6 @@ void Paint_DrawCircle(UWORD X_Center, UWORD Y_Center, UWORD Radius,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/******************************************************************************
|
|
|
-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_Background, Color_Foreground);
|
|
|
-
|
|
|
- //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_Background, Color_Foreground);
|
|
|
-}
|
|
|
-
|
|
|
-/******************************************************************************
|
|
|
-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_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx , Ystart, value[pTime->Hour % 10], Font, Color_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx + Dx / 4 + Dx / 2 , Ystart, ':' , Font, Color_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx * 2 + Dx / 2 , Ystart, value[pTime->Min / 10] , Font, Color_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx * 3 + Dx / 2 , Ystart, value[pTime->Min % 10] , Font, Color_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx * 4 + Dx / 2 - Dx / 4, Ystart, ':' , Font, Color_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx * 5 , Ystart, value[pTime->Sec / 10] , Font, Color_Background, Color_Foreground);
|
|
|
- Paint_DrawChar(Xstart + Dx * 6 , Ystart, value[pTime->Sec % 10] , Font, Color_Background, Color_Foreground);
|
|
|
-}
|
|
|
-
|
|
|
/******************************************************************************
|
|
|
function: Display monochrome bitmap
|
|
|
parameter:
|