Ejemplo n.º 1
0
void DrawRoundRect(unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char radius, unsigned char color) {
  	int tSwitch, x1 = 0, y1 = radius;
  	tSwitch = 3 - 2 * radius;

	while (x1 <= y1) {
	    SetDot(x+radius - x1, y+radius - y1, color);
	    SetDot(x+radius - y1, y+radius - x1, color);

	    SetDot(x+width-radius + x1, y+radius - y1, color);
	    SetDot(x+width-radius + y1, y+radius - x1, color);

	    SetDot(x+width-radius + x1, y+height-radius + y1, color);
	    SetDot(x+width-radius + y1, y+height-radius + x1, color);

	    SetDot(x+radius - x1, y+height-radius + y1, color);
	    SetDot(x+radius - y1, y+height-radius + x1, color);

	    if (tSwitch < 0) {
	    	tSwitch += (4 * x1 + 6);
	    } else {
	    	tSwitch += (4 * (x1 - y1) + 10);
	    	y1--;
	    }
	    x1++;
	}

	DrawHoriLine(x+radius, y, width-(2*radius), color);			// top
	DrawHoriLine(x+radius, y+height, width-(2*radius), color);	// bottom
	DrawVertLine(x, y+radius, height-(2*radius), color);		// left
	DrawVertLine(x+width, y+radius, height-(2*radius), color);	// right
}
Ejemplo n.º 2
0
void Form_ADChannel_Draw(LPWindow pWindow)
{
	uint16 i;
	LPControl	lpControl;

	//清除显存
	EraseBuffer();

	//禁止绘图
	SetRedraw(FALSE);

	//禁止刷屏
	EnableScreenFlush(FALSE);

	//设置视图
	SetGdiView(pWindow->nViewPosX, pWindow->nViewPosY, pWindow->nViewSizeX, pWindow->nViewSizeY);
	EnableGdiView(TRUE);
//     sprintf(sZero_Value,"%d",fZero_Value);

//     
//     sprintf(sCali_Title,"%s",sScale_Title);
//		DrawGbText("重量标定", 112, 88);
//		DrawGbText("按确定键开始标定,否则请返回", 42, 110);
    
    DrawGbText("AD通道1",5,44);
    DrawGbText("AD通道2",5,66);
    DrawGbText("AD通道3",5,88);
    DrawGbText("AD通道4",5,110);

    snprintf(sADChannel_Title, 23, "通道的AD值 SCS-ZC-%d", (Get_System_Mode() + 1));

	DrawGbText(sADChannel_Title, 5, 21);
    DrawHoriLine(0, 40, 240);
    DrawHoriLine(0, 62, 240);
    DrawHoriLine(0, 84, 240);
    DrawHoriLine(0, 106, 240);
    DrawHoriLine(0, 127, 240);
    DrawVertLine(60, 40, 88);
//     DrawVertLine(140, 40, 44);

	//绘制控件
	for(i = 0; i < pWindow->nNbControls; i++)
	{
		lpControl = *(pWindow->pLPControls + i);
		if(lpControl->state & CTRL_VISABLE)
		{
			lpControl->DrawFunc(lpControl);
		}
	}

	//使能刷屏
	EnableScreenFlush(TRUE);

	//刷屏
	FlushScreen();

	//使能绘图
	SetRedraw(TRUE);
}
Ejemplo n.º 3
0
void DrawLine(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char color) {
	unsigned char length, i, y, yAlt, xTmp, yTmp;
	int m;
	//
	// vertical line
	//
	if(x1 == x2) {
		// x1|y1 must be the upper point
		if(y1 > y2) {
			yTmp = y1;
			y1 = y2;
			y2 = yTmp;
		}
		DrawVertLine(x1, y1, y2-y1, color);
	
	//
	// horizontal line
	//
	} else if(y1 == y2) {	
		// x1|y1 must be the left point
		if(x1 > x2) {
			xTmp = x1;
			x1 = x2;
			x2 = xTmp;
		}
		DrawHoriLine(x1, y1, x2-x1, color);
	
	//
	// angled line :)
	//
	} else {
		// angle >= 45°
		if((y2-y1) >= (x2-x1) || (y1-y2) >= (x2-x1)) {
			// x1 must be smaller than x2
			if(x1 > x2) {
				xTmp = x1;
				yTmp = y1;
				x1 = x2;
				y1 = y2;
				x2 = xTmp;
				y2 = yTmp;
			}
		
			length = x2-x1;		// not really the length :)
			m = ((y2-y1)*200)/length;
			yAlt = y1;
			
			for(i=0; i<=length; i++) {
				y = ((m*i)/200)+y1;
				
				if((m*i)%200 >= 100)
					y++;
				else if((m*i)%200 <= -100)
					y--;
				
				DrawLine(x1+i, yAlt, x1+i, y, color);
				
				if(length <= (y2-y1) && y1 < y2)
					yAlt = y+1;
				else if(length <= (y1-y2) && y1 > y2)
					yAlt = y-1;
				else
					yAlt = y;
			}
		
		// angle < 45°
		} else {
			// y1 must be smaller than y2
			if(y1 > y2) {
				xTmp = x1;
				yTmp = y1;
				x1 = x2;
				y1 = y2;
				x2 = xTmp;
				y2 = yTmp;
			}
			
			length = y2-y1;
			m = ((x2-x1)*200)/length;
			yAlt = x1;
			
			for(i=0; i<=length; i++) {
				y = ((m*i)/200)+x1;
				
				if((m*i)%200 >= 100)
					y++;
				else if((m*i)%200 <= -100)
					y--;
				
				DrawLine(yAlt, y1+i, y, y1+i, color);
				if(length <= (x2-x1) && x1 < x2)
					yAlt = y+1;
				else if(length <= (x1-x2) && x1 > x2)
					yAlt = y-1;
				else
					yAlt = y;
			}
		}
	}
}
Ejemplo n.º 4
0
void DrawRect(unsigned char x, unsigned char y, unsigned char width, unsigned char height, unsigned char color) {
	DrawHoriLine(x, y, width, color);				// top
	DrawHoriLine(x, y+height, width, color);		// bottom
	DrawVertLine(x, y, height, color);			    // left
	DrawVertLine(x+width, y, height, color);		// right
}
Ejemplo n.º 5
0
void MsgBoxDlgDraw(LPWindow pWindow)
{
	uint16 i;
	int16 nStrSize;
	LPControl	lpControl;	  

	//½ûÖ¹»æͼ
	SetRedraw(FALSE);

	//½ûֹˢÆÁ
	EnableScreenFlush(FALSE);

	//ÉèÖÃÊÓͼ
	SetGdiView(pWindow->nViewPosX, pWindow->nViewPosY, pWindow->nViewSizeX, pWindow->nViewSizeY);
	EnableGdiView(TRUE);

	//Çå³ýÏÔ´æ
	EraseRect(0, 0, pWindow->nViewSizeX, pWindow->nViewSizeY);

	//»æÖÆ´°¿ÚÃû³Æ
	if(m_pTitle != NULL)
	{
		nStrSize = strlen((char*)m_pTitle);	
		if(nStrSize > 0)
		{		
			DrawGbText((char*)m_pTitle, 2, 2);
		}	
	}
	
	//½ûÖ¹»æͼ
	//SetRedraw(FALSE);

	//½ûֹˢÆÁ
	//EnableScreenFlush(FALSE);

	//»æÖƿؼþ
	for(i = 0; i < pWindow->nNbControls; i++)
	{
		lpControl = *(pWindow->pLPControls + i);

		if((lpControl->state & CTRL_VISABLE) != 0)
		{ 
			lpControl->DrawFunc(lpControl);
		}
	}

	//»­´°Ìå±ß¿ò
	DrawRect(0, 0, pWindow->nViewSizeX - 1, pWindow->nViewSizeY - 1);
	DrawHoriLine(1, pWindow->nViewSizeY - 1, pWindow->nViewSizeX);
	DrawVertLine(pWindow->nViewSizeX - 1, 1, pWindow->nViewSizeY);

	//»­·Ö¸ôÏß
	DrawHoriLine(1, 18, pWindow->nViewSizeX); 

	//ʹÄÜË¢ÆÁ
	EnableScreenFlush(TRUE);

	//Ë¢ÆÁ
	FlushScreen();

	//ʹÄÜ»æͼ
	SetRedraw(TRUE);
}