Example #1
0
void lcd_draw_circle(uint16 x, uint16 y, uint16 r, uint16 color)
{
    int a,b;
	int di;
	a=0;b=r;
	di=3-(r<<1);
	while(a<=b)
	{
		lcd_set_pixel(x-b,y-a,color);             //3
		lcd_set_pixel(x+b,y-a,color);             //0
		lcd_set_pixel(x-a,y+b,color);             //1
		lcd_set_pixel(x-b,y-a,color);             //7
		lcd_set_pixel(x-a,y-b,color);             //2
		lcd_set_pixel(x+b,y+a,color);             //4
		lcd_set_pixel(x+a,y-b,color);             //5
		lcd_set_pixel(x+a,y+b,color);             //6
		lcd_set_pixel(x-b,y+a,color);
		a++;
		if(di<0)di +=4*a+6;
		else
		{
			di+=10+4*(a-b);
			b--;
		}
		lcd_set_pixel(x+a,y+b,color);
	}
}
Example #2
0
void demo_pixel() {
	printf("Demo pixel\n");
	char key;

	clear_screen();
	while (1) {
		lcd_set_pixel(rand()%130, rand()%130, colors[rand()%10], display);
		lcd_set_pixel(rand()%130, rand()%130, colors[rand()%10], display);
		lcd_set_pixel(rand()%130, rand()%130, colors[rand()%10], display);
		lcd_set_pixel(rand()%130, rand()%130, colors[rand()%10], display);
		key = get_key();
		if (key == QUIT)
			break;
	}
}
Example #3
0
File: disp.c Project: Ziul/Moderna
void lcd_retangulo(uint16_t color,uint8_t x,uint8_t dx,uint8_t y,uint8_t dy)
{
	uint8_t index_x,index_y;
	for(index_x = x;index_x <= x+dx ; index_x++)
		for(index_y = y; index_y <= y+dy; index_y++)
			lcd_set_pixel(color,index_x,index_y);
}
Example #4
0
File: disp.c Project: Ziul/Moderna
void lcd_circulo(uint16_t color,uint8_t xc,uint8_t yc,uint8_t raio)
{
	uint8_t index_x = xc,index_y = yc;

//	for(index_x = xc;index_x <= (int)fabs(sqrt((raio*raio) - (index_y*index_y)));index_x++)
//	for(index_y = yc;index_y <= (int)fabs(sqrt((raio*raio) - (index_x*index_x)));index_y++)
	lcd_set_pixel(color,index_x,index_y);

}
Example #5
0
T_VOID Fwl_SetPixel(T_U16 x, T_U16 y, T_U16 color) 
{
	if (Lcd_Lock)
	{
		return;
	}
	
	lcd_set_pixel(x, y, color);
}
Example #6
0
/**
 * \brief Toggle pixel (icon) in LCD display memory.
 *
 * This function toggles a pixel in LCD (icon) display memory. If a parameter
 * is out of range, then the function doesn't toggle any bit.
 *
 * \param  pix_com  Pixel coordinate - COMx - of the pixel (icon).
 * \param  pix_seg  Pixel coordinate - SEGy - of the pixel (icon).
 */
void lcd_tgl_pixel(uint8_t pix_com, uint8_t pix_seg)
{
	if ((pix_com < LCD_MAX_NR_OF_COM) && (pix_seg < LCD_MAX_NBR_OF_SEG)) {
		uint8_t pixels = *lcd_get_pixel_register(pix_com, pix_seg);

		if (pixels & (1 << (pix_seg % 8))) {
			lcd_clear_pixel(pix_com, pix_seg);
		} else {
			lcd_set_pixel(pix_com, pix_seg);
		}
	}
}
Example #7
0
void lcd_draw_line(uint16 x1, uint16 x2, uint16 y1, uint16 y2, uint16 color)
{
    if((x1 == x2) || (y1 == y2)){
        lcd_draw_rect(x1,x2,y1,y2,color,1);
    }else{
        uint16 t;
        int xerr=0,yerr=0,delta_x,delta_y,distance;
        int incx,incy,uRow,uCol;

        delta_x=x2-x1;
        delta_y=y2-y1;
        uRow=x1;
        uCol=y1;
        if(delta_x>0)incx=1;
        else if(delta_x==0)incx=0;
        else {incx=-1;delta_x=-delta_x;}
        if(delta_y>0)incy=1;
        else if(delta_y==0)incy=0;
        else{incy=-1;delta_y=-delta_y;}
        if( delta_x>delta_y)distance=delta_x;
        else distance=delta_y;
        for(t=0;t<=distance+1;t++ )
        {
            lcd_set_pixel(uRow,uCol, color);
            xerr+=delta_x ;
            yerr+=delta_y ;
            if(xerr>distance)
            {
                xerr-=distance;
                uRow+=incx;
            }
            if(yerr>distance)
            {
                yerr-=distance;
                uCol+=incy;
            }
        }
    }
}