1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.ximtec.igesture.app.showcaseapp.descriptor;
28
29 import java.awt.Graphics2D;
30 import java.awt.RenderingHints;
31
32 import org.sigtec.ink.Note;
33 import org.ximtec.igesture.core.DigitalDescriptor;
34
35
36
37
38
39
40
41 public class TriangleDescriptor extends DigitalDescriptor {
42
43 public TriangleDescriptor() {
44 super();
45 }
46
47
48 @Override
49 public void getDigitalObject(Graphics2D graphic, Note note) {
50 int x1 = (int)note.getBounds2D().getMinX();
51 int x2 = (int)note.getBounds2D().getMaxX();
52 int y = (int)note.getBounds2D().getMaxY();
53 int y2 = (int)note.getBounds2D().getMinY();
54 graphic.setRenderingHint(RenderingHints.KEY_RENDERING,
55 RenderingHints.VALUE_RENDER_QUALITY);
56 graphic.drawLine(x1, y, x2, y);
57 graphic.drawLine(x1, y, (x1 + x2) / 2, y2);
58 graphic.drawLine(x2, y, (x1 + x2) / 2, y2);
59 }
60
61 @Override
62 public String getName() {
63 return this.getClass().getSimpleName();
64 }
65
66 }