Mikrocontroller und Digitale Elektronik
›
Thread
Suche GLCD funktion für kreis MIT Dicke
S
Simon
Gast
20.06.2014 20:27
#3697487
Hallo
Ich suche eine Funktion für ein GLCD um einen Kreis zu zeichnen, bei dem
die Dicke der Linie mit angegeben werden kann.
Kennt jemand etwas?
Ich habe bisher das hier:
Bei diesem Code habe ich versucht die Dicke mit einzubringen.
1 void draw_circle ( uint16_t x , uint16_t y , uint16_t radius , uint8_t fill , uint16_t color )
2 {
3 signed int a , b , P ;
4 a = 0 ;
5 b = radius ;
6 P = 1 - radius ;
7
8 uint8_t counter = 0 ;
9
10 do
11 {
12 if ( fill )
13 {
14 LCD_Line ( x - a , y + b , x + a , y + b , color );
15 LCD_Line ( x - a , y - b , x + a , y - b , color );
16 LCD_Line ( x - b , y + a , x + b , y + a , color );
17 LCD_Line ( x - b , y - a , x + b , y - a , color );
18 }
19 else
20 {
21 counter = 5 ; //War mein versuch die Dicke einzubinden
22 while ( counter )
23 {
24 LCD_PutPixel ( a + x + counter , b + y + counter , color );
25 LCD_PutPixel ( b + x + counter , a + y + counter , color );
26 LCD_PutPixel ( x - a - counter , b + y + counter , color );
27 LCD_PutPixel ( x - b - counter , a + y + counter , color );
28 LCD_PutPixel ( b + x + counter , y - a - counter , color );
29 LCD_PutPixel ( a + x + counter , y - b - counter , color );
30 LCD_PutPixel ( x - a - counter , y - b - counter , color );
31 LCD_PutPixel ( x - b - counter , y - a - counter , color );
32 counter -- ;
33 }
34 }
35
36 if ( P < 0 )
37 P += 3 + 2 * a ++ ;
38 else
39 P += 5 + 2 * ( a ++ - b -- );
40 } while ( a <= b );
41
42
43 }
R
Ralf
Gast
20.06.2014 20:31
#3697497
Hm... Wie wäre es mehrere Kreise mit unterschiedlichen Radien zu nehmen?
Dann brauchst du den Pinsel nicht "mitrotieren".
Ralf
T
Tim
Gast
20.06.2014 20:35
#3697505
Ralf schrieb:
> Hm... Wie wäre es mehrere Kreise mit unterschiedlichen Radien zu
> nehmen?
> Dann brauchst du den Pinsel nicht "mitrotieren".
>
> Ralf
Hab ich versucht, aber es gibt immer ein paar wenige pixel, welche nicht
eingefärbt werden
S
Simon
Gast
20.06.2014 21:24
#3697554
Gibts denn keine Library?
Antwort schreiben
Bitte melde dich an, um einen Beitrag zu schreiben.
Noch kein Account?
Die Registrierung ist kostenlos und dauert nur eine Minute.
Jetzt registrieren