/******************************************************************** * * _SendToPrinter * * Function description * Shows the contents of a memory device on the display * In "real life", this routine would send the contents of the memory * device to the printer. */ static void _SendToPrinter(GUI_MEMDEV_Handle hMem, int yOff) { int xSize, ySize, x, y, Offset, Bit; U8 * pData; /* Get the size of the memory device */ xSize = GUI_MEMDEV_GetXSize(hMem); ySize = GUI_MEMDEV_GetYSize(hMem); pData = (U8 *)GUI_MEMDEV_GetDataPtr(hMem); /* Get the data pointer of the memory device */ /* Draw the pixels of the memory device on the screen */ for (y = 0; y < ySize; y++) { for (x = 0; x < xSize; x++) { U8 Index; Offset = x >> 3; Bit = 7 - (x & 7); Index = *(pData + Offset); Index &= (1 << Bit); /* The index could be 0 or 1, so use black and white */ if (Index == 0 ) { GUI_SetColor(GUI_BLACK); } else { GUI_SetColor(GUI_WHITE); } /* Draw the pixel. At this point for example a printer output routine can be called */ GUI_DrawPixel(x, y + yOff); } pData += (xSize + 7) / 8; } }
void DispFrame(void) { uint16_t x,y; GUI_SetColor(GUI_WHITE); GUI_DrawRect(13, 19, 265, 221); //这个函数对坐标值有影响 for (x = 0; x < 11; x++) /* 绘制垂直刻度点 */ { for (y = 0; y < 41; y++) { GUI_DrawPixel(14 + (x * 25), 20 + (y * 5)); } } for (y = 0; y < 9; y++) /* 绘制水平刻度点 */ { for (x = 0; x < 51; x++) { GUI_DrawPixel(14 + (x * 5), 20 + (y * 25)); } } for (y = 0; y < 41; y++) /* 绘制垂直中心刻度点 */ { GUI_DrawPixel(13 + (5 * 25), 20 + (y * 5)); GUI_DrawPixel(15 + (5 * 25), 20 + (y * 5)); } for (x = 0; x < 51; x++) /* 绘制水平中心刻度点 */ { GUI_DrawPixel(14 + (x * 5), 19 + (4 * 25)); GUI_DrawPixel(14 + (x * 5), 21 + (4 * 25)); } }
void DisplayBattery(void) { u16 ADC1_value; u32 temp_color; ADC1_value = ADC_GetConversionValue(ADC1); GUI_SetFont(&GUI_Font6x8); GUI_SetColor(GUI_WHITE); GUI_DispStringAt("RFID",3,0); temp_color=GUI_GetColor(); GUI_SetColor(GUI_GREEN); if (ADC1_value > 2500) { GUI_DrawPixel(80,3); GUI_DrawPixel(80,4); GUI_FillRect (81,0,95,7); } else if (ADC1_value > 2350) { GUI_DrawPixel(80,3); GUI_DrawPixel(80,4); GUI_FillRect (81,0,95,7); GUI_ClearRect(82,1,86,6); } else if(ADC1_value > 2300) { GUI_DrawPixel(80,3); GUI_DrawPixel(80,4); GUI_FillRect (81,0,95,7); GUI_ClearRect(82,1,90,6); } else { GUI_SetColor(GUI_RED); GUI_DrawPixel(80,3); GUI_DrawPixel(80,4); GUI_FillRect (81,0,95,7); GUI_ClearRect(82,1,94,6); } GUI_SetColor(temp_color); GUI_SetFont(&GUI_NOW_FONT); }
void HelpBrowser(BYTE line, BYTE *str) { WORD offset, i; if(str==(void *)0) return; /*Nothing to do.*/ else if(str==OldHelpStr) { if(line==0) return; /*The same HELP topic.*/ } else if(str!=OldHelpStr) { HelpDispStartLineNum=0; /*Change to new HELP topic.*/ SearchHelpLineInformation(str); } OldHelpStr=str; if((HelpDispStartLineNum==0)&&(line<0)) return;/*End of message.*/ else if((HelpDispStartLineNum==(HelpMaxLineNum-ShowMaxLine /*-15*/))&&(line>0)) return;/*End of message.*/ else if(((HelpMaxLineNum-ShowMaxLine)<0)&&(line>0)) return;/*End of message.*/ GUI_SetLBorder(HELP_X0); // Setting left start address when be change line GUI_SetBkColor(GW_BLACK); GUI_SetColor(ColorDef.MsgText); //ClearDataBG(GW_BLACK); //ClearChanBG(GW_BLACK); ClearP3KChanAllBG(GW_BLACK); ClearP3KDataAllBG(GW_BLACK); // ClearHelpBG(GW_BLACK); // Draw Wave Fomr Area Line for(i=WaveLineX1;i<=WaveLineX2;i++) { GUI_DrawPixel(i,WaveLineY1); // X Line GUI_DrawPixel(i,WaveLineY2); } for(i=WaveLineY1;i<WaveLineY2;i++) { GUI_DrawPixel(WaveLineX1,i); // Y Line GUI_DrawPixel(WaveLineX2,i); } HelpDispStartLineNum+=line; HelpX=0; HelpY=0; offset=HelpMaxLineNum-ShowMaxLine; //-15; if(HelpDispStartLineNum<=0) HelpDispStartLineNum=0; if(offset>0) { if(HelpDispStartLineNum>offset) HelpDispStartLineNum=offset; HelpStr=(BYTE *)HelpLineNum[HelpDispStartLineNum]; /*Point to the variable knob selected line.*/ } else HelpStr=(BYTE *)HelpLineNum[0]; /*Point to the first line of HELP message.*/ GUI_GotoXY(HELP_X0+HelpX, HELP_Y0+HelpY); while(1) { if(SetHelpTag()==-1) { // HintDelay("HELP parsing error!!"); // printf("HELP parsing error! !"); // take off HintDelay Function HelpTagC=-1; /*Reset TAG.*/ HelpTagB=-1; HelpTagF=-1; break; } if(ShowHelp()==-1) { HelpTagC=-1; /*Reset TAG.*/ HelpTagB=-1; HelpTagF=-1; break; } } //GUI_SetFont(&GUI_GWFont6x8); GUI_SetFont(Parameter_Font); GUI_SetLBorder(0); }
void DrawMenuFrame(BYTE item, BYTE type) { int i,y,x; x= item*64; switch(type) { case 0: break; case 0x01: /* Draw frame + separator */ GUI_SetColor(MEM_BLACK); for(i=x+7;i<x+58;i++) GUI_DrawPixel(i,222); GUI_SetColor(GW_WHITE); for(i=x+7;i<x+58;i++) GUI_DrawPixel(i,223); break; case 0x02: /* Draw frame */ break; case 0x03: GUI_SetColor(MEM_BLACK); GUI_DrawPixel(x-31,235); GUI_DrawPixel(x-31,236); GUI_DrawPixel(x-32,236); GUI_DrawPixel(x-32,237); GUI_DrawPixel(x-33,238); GUI_SetColor(GW_WHITE); GUI_DrawPixel(x-31,238); GUI_DrawPixel(x-30,236); GUI_DrawPixel(x-30,237); GUI_DrawPixel(x-29,238); break; case 0x04: /* Pre Menu */ GUI_SetColor(MEM_BLACK); GUI_DrawPixel(x-31,209); GUI_DrawPixel(x-31,208); GUI_DrawPixel(x-30,208); GUI_DrawPixel(x-30,207); GUI_DrawPixel(x-29,206); GUI_SetColor(GW_WHITE); GUI_DrawPixel(x-31,206); GUI_DrawPixel(x-32,208); GUI_DrawPixel(x-32,207); GUI_DrawPixel(x-33,206); break; default: break; } if(type) { GUI_SetColor(MEM_BLACK); for(i=204;i<240;i++) GUI_DrawPixel(x,i); GUI_SetColor(GW_WHITE); for(i=204;i<240;i++) GUI_DrawPixel(x+1,i); GUI_SetColor(GW_WHITE); for(i=x;i<x+65;i++) GUI_DrawPixel(i,204); } if(Soft_Key_Temp) { /* Clear Previous Setting*/ for(y=0;y<5;y++) { x= y*64; GUI_SetColor(MEM_BLACK); for(i=204;i<240;i++) GUI_DrawPixel(x,i); GUI_SetColor(GW_WHITE); for(i=204;i<240;i++) GUI_DrawPixel(x+1,i); GUI_SetColor(GW_WHITE); for(i=x;i<x+65;i++) GUI_DrawPixel(i,204); } /* Using Now Setting*/ y= Soft_Key_Temp-1; x= y*64; GUI_SetColor(MEM_BLACK); for(i=204;i<240;i++) GUI_DrawPixel(x+1,i); GUI_SetColor(MEM_BLACK); for(i=x;i<x+65;i++) GUI_DrawPixel(i,204); y++; x= y*64; GUI_SetColor(GW_WHITE); for(i=204;i<240;i++) GUI_DrawPixel(x,i); } }