This source file includes following definitions.
- markDirty
- resetXfermode
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.Rect;
23 import android.graphics.Paint;
24
25 import android.graphics.PorterDuff.Mode;
26 import android.graphics.PorterDuffXfermode;
27 import android.graphics.Xfermode;
28
29
30
31
32 public final class EmacsGC extends EmacsHandleObject
33 {
34 public static final int GC_COPY = 0;
35 public static final int GC_XOR = 1;
36
37 public static final int GC_FILL_SOLID = 0;
38 public static final int GC_FILL_OPAQUE_STIPPLED = 1;
39
40 public static final Xfermode xorAlu, srcInAlu;
41
42 public int function, fill_style;
43 public int foreground, background;
44 public int clip_x_origin, clip_y_origin;
45 public int ts_origin_x, ts_origin_y;
46 public Rect clip_rects[], real_clip_rects[];
47 public EmacsPixmap clip_mask, stipple;
48 public Paint gcPaint;
49
50
51
52 private static long clip_serial;
53
54
55
56 public long clipRectID;
57
58 static
59 {
60 xorAlu = new PorterDuffXfermode (Mode.XOR);
61 srcInAlu = new PorterDuffXfermode (Mode.SRC_IN);
62 }
63
64
65
66 public
67 EmacsGC (short handle)
68 {
69
70
71
72
73 super (handle);
74
75 fill_style = GC_FILL_SOLID;
76 function = GC_COPY;
77 foreground = 0;
78 background = 0xffffff;
79 gcPaint = new Paint ();
80 }
81
82
83
84
85 public void
86 markDirty (boolean clipRectsChanged)
87 {
88 int i;
89
90 if (clipRectsChanged)
91 {
92 if ((ts_origin_x != 0 || ts_origin_y != 0)
93 && clip_rects != null)
94 {
95 real_clip_rects = new Rect[clip_rects.length];
96
97 for (i = 0; i < clip_rects.length; ++i)
98 {
99 real_clip_rects[i] = new Rect (clip_rects[i]);
100 real_clip_rects[i].offset (ts_origin_x, ts_origin_y);
101 }
102 }
103 else
104 real_clip_rects = clip_rects;
105
106 clipRectID = ++clip_serial;
107 }
108
109 gcPaint.setStrokeWidth (1f);
110 gcPaint.setColor (foreground | 0xff000000);
111 gcPaint.setXfermode (function == GC_XOR
112 ? xorAlu : srcInAlu);
113 }
114
115 public void
116 resetXfermode ()
117 {
118 gcPaint.setXfermode (function == GC_XOR
119 ? xorAlu : srcInAlu);
120 }
121 };