| 1 |
/******************************************************************************* |
|---|
| 2 |
* Copyright (c) 2000, 2008 IBM Corporation and others. |
|---|
| 3 |
* All rights reserved. This program and the accompanying materials |
|---|
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 5 |
* which accompanies this distribution, and is available at |
|---|
| 6 |
* http://www.eclipse.org/legal/epl-v10.html |
|---|
| 7 |
* |
|---|
| 8 |
* Contributors: |
|---|
| 9 |
* IBM Corporation - initial API and implementation |
|---|
| 10 |
* Port to the D programming language: |
|---|
| 11 |
* Frank Benoit <benoit@tionex.de> |
|---|
| 12 |
*******************************************************************************/ |
|---|
| 13 |
module dwt.graphics.LineAttributes; |
|---|
| 14 |
|
|---|
| 15 |
import dwt.DWT; |
|---|
| 16 |
|
|---|
| 17 |
/** |
|---|
| 18 |
* <code>LineAttributes</code> defines a set of line attributes that |
|---|
| 19 |
* can be modified in a GC. |
|---|
| 20 |
* <p> |
|---|
| 21 |
* Application code does <em>not</em> need to explicitly release the |
|---|
| 22 |
* resources managed by each instance when those instances are no longer |
|---|
| 23 |
* required, and thus no <code>dispose()</code> method is provided. |
|---|
| 24 |
* </p> |
|---|
| 25 |
* |
|---|
| 26 |
* @see GC#getLineAttributes() |
|---|
| 27 |
* @see GC#setLineAttributes(LineAttributes) |
|---|
| 28 |
* @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a> |
|---|
| 29 |
* |
|---|
| 30 |
* @since 3.3 |
|---|
| 31 |
*/ |
|---|
| 32 |
public class LineAttributes { |
|---|
| 33 |
|
|---|
| 34 |
/** |
|---|
| 35 |
* The line width. |
|---|
| 36 |
*/ |
|---|
| 37 |
public float width; |
|---|
| 38 |
|
|---|
| 39 |
/** |
|---|
| 40 |
* The line style. |
|---|
| 41 |
* |
|---|
| 42 |
* @see dwt.DWT#LINE_CUSTOM |
|---|
| 43 |
* @see dwt.DWT#LINE_DASH |
|---|
| 44 |
* @see dwt.DWT#LINE_DASHDOT |
|---|
| 45 |
* @see dwt.DWT#LINE_DASHDOTDOT |
|---|
| 46 |
* @see dwt.DWT#LINE_DOT |
|---|
| 47 |
* @see dwt.DWT#LINE_SOLID |
|---|
| 48 |
*/ |
|---|
| 49 |
public int style; |
|---|
| 50 |
|
|---|
| 51 |
/** |
|---|
| 52 |
* The line cap style. |
|---|
| 53 |
* |
|---|
| 54 |
* @see dwt.DWT#CAP_FLAT |
|---|
| 55 |
* @see dwt.DWT#CAP_ROUND |
|---|
| 56 |
* @see dwt.DWT#CAP_SQUARE |
|---|
| 57 |
*/ |
|---|
| 58 |
public int cap; |
|---|
| 59 |
|
|---|
| 60 |
/** |
|---|
| 61 |
* The line join style. |
|---|
| 62 |
* |
|---|
| 63 |
* @see dwt.DWT#JOIN_BEVEL |
|---|
| 64 |
* @see dwt.DWT#JOIN_MITER |
|---|
| 65 |
* @see dwt.DWT#JOIN_ROUND |
|---|
| 66 |
*/ |
|---|
| 67 |
public int join; |
|---|
| 68 |
|
|---|
| 69 |
/** |
|---|
| 70 |
* The line dash style for DWT.LINE_CUSTOM. |
|---|
| 71 |
*/ |
|---|
| 72 |
public float[] dash; |
|---|
| 73 |
|
|---|
| 74 |
/** |
|---|
| 75 |
* The line dash style offset for DWT.LINE_CUSTOM. |
|---|
| 76 |
*/ |
|---|
| 77 |
public float dashOffset; |
|---|
| 78 |
|
|---|
| 79 |
/** |
|---|
| 80 |
* The line miter limit. |
|---|
| 81 |
*/ |
|---|
| 82 |
public float miterLimit; |
|---|
| 83 |
|
|---|
| 84 |
/** |
|---|
| 85 |
* Create a new line attributes with the specified line width. |
|---|
| 86 |
* |
|---|
| 87 |
* @param width the line width |
|---|
| 88 |
*/ |
|---|
| 89 |
public this(float width) { |
|---|
| 90 |
this(width, DWT.CAP_FLAT, DWT.JOIN_MITER, DWT.LINE_SOLID, null, 0, 10); |
|---|
| 91 |
} |
|---|
| 92 |
|
|---|
| 93 |
/** |
|---|
| 94 |
* Create a new line attributes with the specified line cap, join and width. |
|---|
| 95 |
* |
|---|
| 96 |
* @param width the line width |
|---|
| 97 |
* @param cap the line cap style |
|---|
| 98 |
* @param join the line join style |
|---|
| 99 |
*/ |
|---|
| 100 |
public this(float width, int cap, int join) { |
|---|
| 101 |
this(width, cap, join, DWT.LINE_SOLID, null, 0, 10); |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
/** |
|---|
| 105 |
* Create a new line attributes with the specified arguments. |
|---|
| 106 |
* |
|---|
| 107 |
* @param width the line width |
|---|
| 108 |
* @param cap the line cap style |
|---|
| 109 |
* @param join the line join style |
|---|
| 110 |
* @param style the line style |
|---|
| 111 |
* @param dash the line dash style |
|---|
| 112 |
* @param dashOffset the line dash style offset |
|---|
| 113 |
* @param miterLimit the line miter limit |
|---|
| 114 |
*/ |
|---|
| 115 |
public this(float width, int cap, int join, int style, float[] dash, float dashOffset, float miterLimit) { |
|---|
| 116 |
this.width = width; |
|---|
| 117 |
this.cap = cap; |
|---|
| 118 |
this.join = join; |
|---|
| 119 |
this.style = style; |
|---|
| 120 |
this.dash = dash; |
|---|
| 121 |
this.dashOffset = dashOffset; |
|---|
| 122 |
this.miterLimit = miterLimit; |
|---|
| 123 |
} |
|---|
| 124 |
} |
|---|