summaryrefslogtreecommitdiff
path: root/platform/java/src/com/artifex/mupdf/fitz/StrokeState.java
blob: 815729c9524236dff476251cbd54815ca30b1fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.artifex.mupdf.fitz;

public class StrokeState
{
	static {
		Context.init();
	}

	public static final int LINECAP_BUTT = 0;
	public static final int LINECAP_ROUND = 1;
	public static final int LINECAP_SQUARE = 2;
	public static final int LINECAP_TRIANGLE = 3;

	public static final int LINEJOIN_MITER = 0;
	public static final int LINEJOIN_ROUND = 1;
	public static final int LINEJOIN_BEVEL = 2;
	public static final int LINEJOIN_MITER_XPS = 3;

	private long pointer;

	protected native void finalize();

	public void destroy() {
		finalize();
		pointer = 0;
	}

	private native long newNative(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit,
			float dashPhase, float dash[]);

	// Private constructor for the C to use. Any objects created by the
	// C are done for purposes of calling back to a java device, and
	// should therefore be considered const. This is fine as we don't
	// currently provide mechanisms for changing individual elements
	// of the StrokeState.
	private StrokeState(long p) {
		pointer = p;
	}

	public StrokeState(int startCap, int endCap, int lineJoin, float lineWidth, float miterLimit) {
		pointer = newNative(startCap, 0, endCap, lineJoin, lineWidth, miterLimit, 0, null);
	}

	public StrokeState(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit,
			float dashPhase, float dash[]) {
		pointer = newNative(startCap, dashCap, endCap, lineJoin, lineWidth, miterLimit, dashPhase, dash);
	}

	public native int getStartCap();
	public native int getDashCap();
	public native int getEndCap();
	public native int getLineJoin();
	public native float getLineWidth();
	public native float getMiterLimit();
	public native float getDashPhase();
	public native float[] getDashes();
}