This source file includes following definitions.
- perform
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.gnu.emacs;
21
22 import android.graphics.Canvas;
23 import android.graphics.Paint;
24 import android.graphics.Path;
25 import android.graphics.Point;
26 import android.graphics.Rect;
27 import android.graphics.RectF;
28
29 public final class EmacsFillPolygon
30 {
31 public static void
32 perform (EmacsDrawable drawable, EmacsGC gc, Point points[])
33 {
34 Canvas canvas;
35 Path path;
36 Paint paint;
37 Rect rect;
38 RectF rectF;
39 int i;
40
41 canvas = drawable.lockCanvas (gc);
42
43 if (canvas == null)
44 return;
45
46 paint = gc.gcPaint;
47
48
49 path = new Path ();
50
51 if (points.length >= 1)
52 {
53 path.moveTo (points[0].x, points[0].y);
54
55 for (i = 1; i < points.length; ++i)
56 path.lineTo (points[i].x, points[i].y);
57
58 path.close ();
59 }
60
61
62 rectF = new RectF (0, 0, 0, 0);
63 path.computeBounds (rectF, true);
64
65 rect = new Rect ((int) Math.floor (rectF.left),
66 (int) Math.floor (rectF.top),
67 (int) Math.ceil (rectF.right),
68 (int) Math.ceil (rectF.bottom));
69
70 paint.setStyle (Paint.Style.FILL);
71
72 if (gc.clip_mask == null)
73 canvas.drawPath (path, paint);
74
75 drawable.damageRect (rect);
76
77
78
79 }
80 }