Merhabalar;
LCD_DrawCircle(x, y, aci); fonksiyonu ile ekrana bir tane daire cizebiliyorum.
Ben ise bu dairenin yarısını cizdirmek istiyorum.
Fonksiyonda nasıl bir değişiklik yapmam lazım.
veya kısa yoldan nasıl yarım daire cizebilirim.
void LCD_DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
{
int32_t D;/* Decision Variable */
uint32_t CurX;/* Current X Value */
uint32_t CurY;/* Current Y Value */
D = 3 - (Radius << 1);
CurX = 0;
CurY = Radius;
while (CurX <= CurY)
{
LCD_SetCursor(Xpos + CurX, Ypos + CurY);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos + CurX, Ypos - CurY);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos - CurX, Ypos + CurY);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos - CurX, Ypos - CurY);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos + CurY, Ypos + CurX);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos + CurY, Ypos - CurX);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos - CurY, Ypos + CurX);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
LCD_SetCursor(Xpos - CurY, Ypos - CurX);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
LCD_WriteRAM(TextColor);
if (D < 0)
{
D += (CurX << 2) + 6;
}
else
{
D += ((CurX - CurY) << 2) + 10;
CurY--;
}
CurX++;
}
}
Aslında C de bahsettiğim işlemi yapan arc fonksiyon var
Ornek
arc (200, 100, 90, 180, 50);
şimdi bu fonksiyonun içeriğini veya mantığını bilsem yukardaki fonksiyon da uygulayacam.