1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

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.
This commit is contained in:
Po Lu 2024-04-28 16:58:58 +08:00
parent b329358334
commit e658a6938e
7 changed files with 382 additions and 31 deletions

View file

@ -46,12 +46,17 @@ public final class EmacsGC extends EmacsHandleObject
public static final int GC_FILL_SOLID = 0;
public static final int GC_FILL_OPAQUE_STIPPLED = 1;
public static final int GC_LINE_SOLID = 0;
public static final int GC_LINE_ON_OFF_DASH = 1;
public static final Xfermode xorAlu, srcInAlu;
public int function, fill_style;
public int foreground, background;
public int clip_x_origin, clip_y_origin;
public int ts_origin_x, ts_origin_y;
public int line_style, line_width;
public int dashes[], dash_offset;
public Rect clip_rects[], real_clip_rects[];
public EmacsPixmap clip_mask, stipple;
public Paint gcPaint;
@ -89,6 +94,10 @@ public final class EmacsGC extends EmacsHandleObject
foreground = 0;
background = 0xffffff;
gcPaint = new Paint ();
/* Android S and above enable anti-aliasing unless explicitly told
otherwise. */
gcPaint.setAntiAlias (false);
}
/* Mark this GC as dirty. Apply parameters to the paint and
@ -119,7 +128,8 @@ public final class EmacsGC extends EmacsHandleObject
clipRectID = ++clip_serial;
}
gcPaint.setStrokeWidth (1f);
/* A line_width of 0 is equivalent to that of 1. */
gcPaint.setStrokeWidth (line_width < 1 ? 1 : line_width);
gcPaint.setColor (foreground | 0xff000000);
gcPaint.setXfermode (function == GC_XOR
? xorAlu : srcInAlu);