So in der Zwischenzeit hat sich hier wieder was getan; die Funktion für "schräge" Linien ist fertig:
Code:
void GLCD_Line(ui8_t xstart, ui8_t ystart, ui8_t xend, ui8_t yend, ui8_t color)
{
ui8_t pixelsX = xend - xstart + 1;
ui8_t pixelsY = yend - ystart + 1;
ui8_t pixelcnt;
ui8_t coord;
double inclination;
if (pixelsX > pixelsY)
{
// width > height
inclination = (double) pixelsY / (double) pixelsX;
for (pixelcnt = xstart ; pixelcnt < xend+1 ; pixelcnt++)
{
coord = ystart + (pixelcnt * inclination);
GLCD_SetPixel(pixelcnt, coord, color);
}
}
else
{
// width <= height
inclination = (double) pixelsX / (double) pixelsY;
for (pixelcnt = ystart ; pixelcnt < yend+1 ; pixelcnt++)
{
coord = xstart + (pixelcnt * inclination);
GLCD_SetPixel(coord, pixelcnt, color);
}
}
}
Zu der Animation: Bin grade dabei, ne kleine Animation zu basteln. Nur die Daten aufzubereiten ist etwas schwieriger als gedacht, da ich aus Effizienzgründen nicht die einzelnen Pixel setzen möchte sondern gleich ganze Pages, also 8 Pixel auf einmal. Muss mir da erst nochn Programm zusammenzimmern.
Lesezeichen