diff options
| author | Po Lu | 2024-04-28 16:58:58 +0800 |
|---|---|---|
| committer | Po Lu | 2024-04-28 17:00:43 +0800 |
| commit | e658a6938e3b7a8a7c0be8b74fbd885787c26df6 (patch) | |
| tree | 9da9dec34bfd979ad7d09b4cdd6997ea0480f048 /src/androidgui.h | |
| parent | b329358334712671de38f919c99d1434026aa8f2 (diff) | |
| download | emacs-e658a6938e3b7a8a7c0be8b74fbd885787c26df6.tar.gz emacs-e658a6938e3b7a8a7c0be8b74fbd885787c26df6.zip | |
Implement dots and dashes on Android
* java/org/gnu/emacs/EmacsDrawLine.java (EmacsDrawLine)
(measureLine, polyDashPattern): New function.
(perform): Delegate to polyDashPattern if the line style is not
LineSolid. Also simplify now that anti-aliasing need no longer
be taken into account.
* java/org/gnu/emacs/EmacsDrawRectangle.java (perform): Mention
omission in commentary.
* java/org/gnu/emacs/EmacsGC.java (EmacsGC): Disable
anti-aliasing in default paint object.
<line_style, line>: New fields.
(markDirty): Apply stroke width.
* src/android.c (android_init_emacs_gc_class): Initialize new
fields.
(android_create_gc, android_free_gc, android_change_gc)
(android_set_dashes, android_get_gc_values):
* src/androidgui.h (enum android_line_style)
(enum android_gc_value_mask, struct android_gc): Introduce line
style, width, dash offset and dash GC attributes.
* src/androidterm.c (android_draw_dash, android_fill_underline)
(android_draw_glyph_string): Port from X.
* src/xterm.c (x_draw_dash): Delete redundant code.
Diffstat (limited to 'src/androidgui.h')
| -rw-r--r-- | src/androidgui.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/androidgui.h b/src/androidgui.h index f941c7cc577..5e4f6ec3989 100644 --- a/src/androidgui.h +++ b/src/androidgui.h | |||
| @@ -71,6 +71,10 @@ enum android_gc_value_mask | |||
| 71 | ANDROID_GC_FILL_STYLE = (1 << 7), | 71 | ANDROID_GC_FILL_STYLE = (1 << 7), |
| 72 | ANDROID_GC_TILE_STIP_X_ORIGIN = (1 << 8), | 72 | ANDROID_GC_TILE_STIP_X_ORIGIN = (1 << 8), |
| 73 | ANDROID_GC_TILE_STIP_Y_ORIGIN = (1 << 9), | 73 | ANDROID_GC_TILE_STIP_Y_ORIGIN = (1 << 9), |
| 74 | ANDROID_GC_LINE_STYLE = (1 << 10), | ||
| 75 | ANDROID_GC_LINE_WIDTH = (1 << 11), | ||
| 76 | ANDROID_GC_DASH_LIST = (1 << 12), | ||
| 77 | ANDROID_GC_DASH_OFFSET = (1 << 13), | ||
| 74 | }; | 78 | }; |
| 75 | 79 | ||
| 76 | enum android_fill_style | 80 | enum android_fill_style |
| @@ -79,6 +83,12 @@ enum android_fill_style | |||
| 79 | ANDROID_FILL_OPAQUE_STIPPLED = 1, | 83 | ANDROID_FILL_OPAQUE_STIPPLED = 1, |
| 80 | }; | 84 | }; |
| 81 | 85 | ||
| 86 | enum android_line_style | ||
| 87 | { | ||
| 88 | ANDROID_LINE_SOLID = 0, | ||
| 89 | ANDROID_LINE_ON_OFF_DASH = 1, | ||
| 90 | }; | ||
| 91 | |||
| 82 | enum android_window_value_mask | 92 | enum android_window_value_mask |
| 83 | { | 93 | { |
| 84 | ANDROID_CW_BACK_PIXEL = (1 << 1), | 94 | ANDROID_CW_BACK_PIXEL = (1 << 1), |
| @@ -114,6 +124,18 @@ struct android_gc_values | |||
| 114 | 124 | ||
| 115 | /* The tile-stipple X and Y origins. */ | 125 | /* The tile-stipple X and Y origins. */ |
| 116 | int ts_x_origin, ts_y_origin; | 126 | int ts_x_origin, ts_y_origin; |
| 127 | |||
| 128 | /* The line style. */ | ||
| 129 | enum android_line_style line_style; | ||
| 130 | |||
| 131 | /* The line width. */ | ||
| 132 | int line_width; | ||
| 133 | |||
| 134 | /* Offset in pixels into the dash pattern specified below. */ | ||
| 135 | int dash_offset; | ||
| 136 | |||
| 137 | /* One integer providing both segments of a even-odd dash pattern. */ | ||
| 138 | int dash; | ||
| 117 | }; | 139 | }; |
| 118 | 140 | ||
| 119 | /* X-like graphics context structure. This is implemented in | 141 | /* X-like graphics context structure. This is implemented in |
| @@ -152,6 +174,18 @@ struct android_gc | |||
| 152 | 174 | ||
| 153 | /* The tile-stipple X and Y origins. */ | 175 | /* The tile-stipple X and Y origins. */ |
| 154 | int ts_x_origin, ts_y_origin; | 176 | int ts_x_origin, ts_y_origin; |
| 177 | |||
| 178 | /* The line style. */ | ||
| 179 | enum android_line_style line_style; | ||
| 180 | |||
| 181 | /* The line width. */ | ||
| 182 | int line_width; | ||
| 183 | |||
| 184 | /* Offset in pixels into the dash pattern specified below. */ | ||
| 185 | int dash_offset; | ||
| 186 | |||
| 187 | /* The segments of an even/odd dash pattern. */ | ||
| 188 | int *dashes, n_segments; | ||
| 155 | }; | 189 | }; |
| 156 | 190 | ||
| 157 | enum android_swap_action | 191 | enum android_swap_action |
| @@ -675,6 +709,7 @@ extern void android_set_clip_rectangles (struct android_gc *, | |||
| 675 | int, int, | 709 | int, int, |
| 676 | struct android_rectangle *, | 710 | struct android_rectangle *, |
| 677 | int); | 711 | int); |
| 712 | extern void android_set_dashes (struct android_gc *, int, int *, int); | ||
| 678 | extern void android_change_gc (struct android_gc *, | 713 | extern void android_change_gc (struct android_gc *, |
| 679 | enum android_gc_value_mask, | 714 | enum android_gc_value_mask, |
| 680 | struct android_gc_values *); | 715 | struct android_gc_values *); |