Bläddra i källkod

Verwende GeneralPath

saeder 6 år sedan
förälder
incheckning
c37b3fe532
1 ändrade filer med 12 tillägg och 1 borttagningar
  1. 12 1
      TryoutModules/src/de/sae/tryout/modules/FormMotionCourse.java

+ 12 - 1
TryoutModules/src/de/sae/tryout/modules/FormMotionCourse.java Visa fil

@@ -9,9 +9,11 @@ import com.codename1.ui.Container;
9 9
 import com.codename1.ui.Form;
10 10
 import com.codename1.ui.Graphics;
11 11
 import com.codename1.ui.Label;
12
+import com.codename1.ui.Stroke;
12 13
 import com.codename1.ui.TextField;
13 14
 import com.codename1.ui.animations.Motion;
14 15
 import com.codename1.ui.geom.Dimension;
16
+import com.codename1.ui.geom.GeneralPath;
15 17
 import com.codename1.ui.geom.Point;
16 18
 import com.codename1.ui.layouts.BorderLayout;
17 19
 import com.codename1.ui.layouts.BoxLayout;
@@ -42,10 +44,19 @@ import com.codename1.util.MathUtil;
42 44
 					int yAxis = motion.getValue();
43 45
 					points.add(new Point(xAxis, yAxis));
44 46
 				}
47
+				GeneralPath generalPath = new GeneralPath();
48
+				int steps = 0;
45 49
 				for (Point point: points) {
46
-					aGraphics.drawChar('+', getX() + shiftX + point.getX(), getY() + shiftY + point.getY());
50
+					if (steps < 1) {
51
+						generalPath.moveTo(getX() + shiftX + point.getX(), getY() + shiftY + point.getY());
52
+					} else {
53
+						generalPath.lineTo(getX() + shiftX + point.getX(), getY() + shiftY + point.getY());
54
+					}
55
+					steps++;
47 56
 				}
48 57
 				aGraphics.setColor(0x20aa20);
58
+				aGraphics.setAntiAliased(true);
59
+				aGraphics.drawShape(generalPath, new Stroke(3.0f, Stroke.CAP_ROUND, Stroke.JOIN_ROUND, 4.0f));
49 60
 				aGraphics.drawString("Time ->", minExtent - size, height - size);
50 61
 			}
51 62