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.Rect;
25
26 public final class EmacsDrawLine
27 {
28 public static void
29 perform (EmacsDrawable drawable, EmacsGC gc,
30 int x, int y, int x2, int y2)
31 {
32 Rect rect;
33 Canvas canvas;
34 Paint paint;
35 int x0, x1, y0, y1;
36
37
38 if (gc.fill_style == EmacsGC.GC_FILL_OPAQUE_STIPPLED)
39 return;
40
41
42
43 x0 = Math.min (x, x2 + 1);
44 x1 = Math.max (x, x2 + 1);
45 y0 = Math.min (y, y2 + 1);
46 y1 = Math.max (y, y2 + 1);
47
48
49
50 paint = gc.gcPaint;
51 rect = new Rect (x0, y0, x1, y1);
52 canvas = drawable.lockCanvas (gc);
53
54 if (canvas == null)
55 return;
56
57 paint.setStyle (Paint.Style.FILL);
58
59
60
61
62
63
64
65 if (gc.clip_mask == null)
66 {
67 canvas.drawLine ((float) x + 0.5f, (float) y + 0.5f,
68 (float) x2 + 0.5f, (float) y2 + 0.5f,
69 paint);
70
71 if (x2 > x)
72 canvas.drawRect (new Rect (x, y, x + 1, y + 1), paint);
73 }
74
75
76
77 drawable.damageRect (rect);
78 }
79 }