summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/common/org/eclipse/swt/graphics/LineAttributes.java
blob: 5113d825ba483843ced9eb02e987d164b21826f7 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.graphics;

import org.eclipse.swt.*;

/**
 * <code>LineAttributes</code> defines a set of line attributes that
 * can be modified in a GC.
 * <p>
 * Application code does <em>not</em> need to explicitly release the
 * resources managed by each instance when those instances are no longer
 * required, and thus no <code>dispose()</code> method is provided.
 * </p>
 * 
 * @see GC#getLineAttributes()
 * @see GC#setLineAttributes(LineAttributes)
 *  
 * @since 3.3
 */
public class LineAttributes {

	/**
	 * The line width.
	 */
	public float width;

	/**
	 * The line style.
	 * 
	 * @see org.eclipse.swt.SWT#LINE_CUSTOM
	 * @see org.eclipse.swt.SWT#LINE_DASH
	 * @see org.eclipse.swt.SWT#LINE_DASHDOT
	 * @see org.eclipse.swt.SWT#LINE_DASHDOTDOT
	 * @see org.eclipse.swt.SWT#LINE_DOT
	 * @see org.eclipse.swt.SWT#LINE_SOLID
	 */
	public int style;

	/**
	 * The line cap style.
	 * 
	 * @see org.eclipse.swt.SWT#CAP_FLAT
	 * @see org.eclipse.swt.SWT#CAP_ROUND
	 * @see org.eclipse.swt.SWT#CAP_SQUARE
	 */
	public int cap;

	/**
	 * The line join style.
	 * 
	 * @see org.eclipse.swt.SWT#JOIN_BEVEL
	 * @see org.eclipse.swt.SWT#JOIN_MITER
	 * @see org.eclipse.swt.SWT#JOIN_ROUND
	 */
	public int join;

	/**
	 * The line dash style for SWT.LINE_CUSTOM.
	 */
	public float[] dash;

	/**
	 * The line dash style offset for SWT.LINE_CUSTOM.
	 */
	public float dashOffset;

	/**
	 * The line miter limit.
	 */
	public float miterLimit;

/** 
 * Create a new line attributes with the specified line width.
 *
 * @param width the line width
 */
public LineAttributes(float width) {
	this(width, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_SOLID, null, 0, 10);
}
	
/** 
 * Create a new line attributes with the specified line cap, join and width.
 *
 * @param width the line width
 * @param cap the line cap style
 * @param join the line join style
 */
public LineAttributes(float width, int cap, int join) {
	this(width, cap, join, SWT.LINE_SOLID, null, 0, 10);
}

/** 
 * Create a new line attributes with the specified arguments.
 *
 * @param width the line width
 * @param cap the line cap style
 * @param join the line join style
 * @param style the line style
 * @param dash the line dash style
 * @param dashOffset the line dash style offset
 * @param miterLimit the line miter limit
 */
public LineAttributes(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) {
	this.width = width;
	this.cap = cap;
	this.join = join;
	this.style = style;
	this.dash = dash;
	this.dashOffset = dashOffset;
	this.miterLimit = miterLimit;
}
}