Пример #1
0
void LCD_Rect(u16 x1, u16 y1, u16 x2, u16 y2, u16 color)
{
	LCD_Line(x1,y1,x2,y1,color);
	LCD_Line(x1,y1,x1,y2,color);
	LCD_Line(x1,y2,x2,y2,color);
	LCD_Line(x2,y1,x2,y2,color);
}
Пример #2
0
void LCD_Rectangle(u16 x0, u16 y0, u16 x1, u16 y1,u16 color, u16 fillColor)
{
	if(x0>x1){
		x0 = x0 + x1;
		x1 = x0 - x1;
		x0 = x0 - x1;
	}
	if(y0>y1){
			y0 = y0 + y1;
			y1 = y0 - y1;
			y0 = y0 - y1;
	}
	if(fillColor!=Transparent){
		if(color==Transparent) {
			x0++;x1--;y0++;y1--;
		}
		LCD_SetWindow(x0,y0,x1,y1);
		u32 i;
		LCD_PrepareWrite();
		u32 c = (x1-x0+1)*(y1-y0+1);
		for(i=0; i<c; i++)
			LCD_WriteWord(fillColor);
		LCD_ResetWindow();
		if(color==fillColor || color==Transparent)
			return;
	}

	LCD_Line(x0,y0,x0,y1,color);
	LCD_Line(x0,y1,x1,y1,color);
	LCD_Line(x1,y1,x1,y0,color);
	LCD_Line(x1,y0,x0,y0,color);
}
Пример #3
0
void LCD_Circle(u16 cx,u16 cy,u16 r,u16 color,u8 fill)
{
	u16 x,y;
	s16 delta,tmp;
	x=0;
	y=r;
	delta=3-(r<<1);

	while(y>x)
	{
		if(fill)
		{
			LCD_Line(cx+x,cy+y,cx-x,cy+y,color);
			LCD_Line(cx+x,cy-y,cx-x,cy-y,color);
			LCD_Line(cx+y,cy+x,cx-y,cy+x,color);
			LCD_Line(cx+y,cy-x,cx-y,cy-x,color);
		}
		else
		{
			LCD_SetPoint(cx+x,cy+y,color);
			LCD_SetPoint(cx-x,cy+y,color);
			LCD_SetPoint(cx+x,cy-y,color);
			LCD_SetPoint(cx-x,cy-y,color);
			LCD_SetPoint(cx+y,cy+x,color);
			LCD_SetPoint(cx-y,cy+x,color);
			LCD_SetPoint(cx+y,cy-x,color);
			LCD_SetPoint(cx-y,cy-x,color);
		}
		x++;
		if(delta>=0)
		{
			y--;
			tmp=(x<<2);
			tmp-=(y<<2);
			delta+=(tmp+10);
		}
		else
		{
			delta+=((x<<2)+6);
		}
	}
}
Пример #4
0
void LCD_GradientFill(u16 x0, u16 y0, u16 x1, u16 y1, u8 PercentageFilled, const u16 *GradientStops, u8 GradientStopsCount)
{
    if (y1 > y0 || PercentageFilled > 100) return;
    u16 i;
    u16 DeltaY = y0 - y1;
    u16 StopY = y0 - ((PercentageFilled*DeltaY)/100);

    for (i = 0; i < DeltaY; i++) {
        if (y0 == StopY) break;
        LCD_Line(x0, y0, x1, y0, getRgb(0, DeltaY, i, GradientStops, GradientStopsCount));
        y0--;
    }

}
Пример #5
0
/*******************************************************************************
* Function Name  : DisplayMenuTitle
* Description    : Prints menu header
* Input          : ptr - pointer to header string
* Output         : None
* Return         : None
*******************************************************************************/
void DisplayMenuTitle(ucint8_t *ptr)
{
  uint32_t x, y;
  sFONT *OldFont = CurrentFont;
  LCD_Method OldMethod = CurrentMethod;

  CurrentFont = &Font_6x8;
  CurrentMethod = MET_AND;

  x = (MAX_X - (CurrentFont->Width * strlen((const char *)ptr))) / 2;
  LCD_PUTS(x, 0, ptr);

  y = CurrentFont->Height + 1;
  CurrentMethod = MET_OR;
  LCD_Line(0, y, MAX_X, y);

  CurrentFont = OldFont;
  CurrentMethod = OldMethod;
}
Пример #6
0
void Nokia_lcd::lineTo(unsigned char x, unsigned char y) { 
  LCD_Line(_x,_y, x, y, _color);
  _x = x;
  _y = y;
}
Пример #7
0
void Nokia_lcd::cLCD_Line(unsigned char x0, unsigned char y0, unsigned char x1, unsigned char y1, int color) { 
	LCD_Line(x0,y0, x1,y1, color); 

}
Пример #8
0
void put_cross(int x, int y, unsigned colidx)
{
	LCD_Line(x - 10, y, x - 2, y,LCD_COLOR_RED);
	LCD_Line(x + 2, y, x + 10, y,LCD_COLOR_RED);
	LCD_Line(x, y - 10, x, y - 2,LCD_COLOR_RED);
	LCD_Line(x, y + 2, x, y + 10,LCD_COLOR_RED);

#if 1
	LCD_Line(x - 6, y - 9, x - 9, y - 9,LCD_COLOR_RED);
	LCD_Line(x - 9, y - 8, x - 9, y - 6,LCD_COLOR_RED);
	LCD_Line(x - 9, y + 6, x - 9, y + 9,LCD_COLOR_RED);
	LCD_Line(x - 8, y + 9, x - 6, y + 9,LCD_COLOR_RED);
	LCD_Line(x + 6, y + 9, x + 9, y + 9,LCD_COLOR_RED);
	LCD_Line(x + 9, y + 8, x + 9, y + 6,LCD_COLOR_RED);
	LCD_Line(x + 9, y - 6, x + 9, y - 9,LCD_COLOR_RED);
	LCD_Line(x + 8, y - 9, x + 6, y - 9,LCD_COLOR_RED);
#else
	LCD_Line(x - 7, y - 7, x - 4, y - 4,LCD_COLOR_RED);
	LCD_Line(x - 7, y + 7, x - 4, y + 4,LCD_COLOR_RED);
	LCD_Line(x + 4, y - 4, x + 7, y - 7,LCD_COLOR_RED);
	LCD_Line(x + 4, y + 4, x + 7, y + 7,LCD_COLOR_RED);
#endif
}