本文整理汇总了Java中org.eclipse.swt.graphics.LineAttributes类的典型用法代码示例。如果您正苦于以下问题:Java LineAttributes类的具体用法?Java LineAttributes怎么用?Java LineAttributes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LineAttributes类属于org.eclipse.swt.graphics包,在下文中一共展示了LineAttributes类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: YAxisDynamicRenderer
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
public YAxisDynamicRenderer ( final ChartRenderer chart )
{
super ( chart );
this.chart = chart;
this.lineAttributes = new LineAttributes ( 1.0f, SWT.CAP_FLAT, SWT.JOIN_BEVEL, SWT.LINE_SOLID, new float[0], 0.0f, 0.0f );
}
示例2: XAxisDynamicRenderer
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
public XAxisDynamicRenderer ( final ChartRenderer chart )
{
super ( chart );
this.chart = chart;
this.lineAttributes = new LineAttributes ( 1.0f, SWT.CAP_FLAT, SWT.JOIN_BEVEL, SWT.LINE_SOLID, new float[0], 0.0f, 0.0f );
this.labelSpacing = 20;
}
示例3: setLineAttributes
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
private void setLineAttributes(final int style) {
try {
gc.setLineAttributes(new LineAttributes(lineWidth, lineCap, lineJoin, style, dashPattern, dashPatternOffset, 10.0f));
}
catch (final NoSuchMethodError e) {
gc.setLineWidth(lineWidth);
gc.setLineCap(lineCap);
gc.setLineJoin(lineJoin);
if (dashPatternInt == null && dashPattern != null) {
this.dashPatternInt = new int[dashPattern.length];
for (int i = 0; i < dashPatternInt.length; i++) {
dashPatternInt[i] = (int) dashPattern[i];
}
gc.setLineDash(dashPatternInt);
}
}
}
示例4: setLineAttributes
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
/**
* Overridden to translate dashes to printer specific values.
*
* @see org.eclipse.draw2d.ScaledGraphics#setLineAttributes(org.eclipse.swt.graphics.LineAttributes)
*/
public void setLineAttributes(LineAttributes attributes) {
if (attributes.style == SWT.LINE_CUSTOM && attributes.dash != null
&& attributes.dash.length > 0) {
float[] newDashes = new float[attributes.dash.length];
float printerDot = (float) (printer.getDPI().y
/ Display.getCurrent().getDPI().y + 0.0000001);
for (int i = 0; i < attributes.dash.length; i++) {
newDashes[i] = attributes.dash[i] * printerDot;
}
// make a copy of attributes, we dont's want it changed on figure
// (or display will be affected)
super.setLineAttributes(new LineAttributes(attributes.width,
attributes.cap, attributes.join, attributes.style,
newDashes, attributes.dashOffset * printerDot,
attributes.miterLimit));
} else {
super.setLineAttributes(attributes);
}
}
示例5: copyLineAttributes
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
/**
* Countermeasure against LineAttributes class not having a copy by value
* function.
*
* @since 3.6
*/
public static void copyLineAttributes(LineAttributes dest,
LineAttributes src) {
if (dest != src) {
dest.cap = src.cap;
dest.join = src.join;
dest.miterLimit = src.miterLimit;
dest.style = src.style;
dest.width = src.width;
dest.dashOffset = src.dashOffset;
if (src.dash == null) {
dest.dash = null;
} else {
if ((dest.dash == null)
|| (dest.dash.length != src.dash.length)) {
dest.dash = new float[src.dash.length];
}
System.arraycopy(src.dash, 0, dest.dash, 0, src.dash.length);
}
}
}
示例6: setLineStyle
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
public void setLineStyle(ELineStyle lineStyle) {
switch (lineStyle) {
case DASHDOT:
gc.setLineStyle(SWT.LINE_DASHDOT);
break;
case SOLID:
gc.setLineStyle(SWT.LINE_SOLID);
break;
case DOT:
gc.setLineStyle(SWT.LINE_DOT);
break;
case PARALLEL:
gc.setLineAttributes(new LineAttributes((float) gc.getLineWidth(), SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM,
new float[] { 5, 3, }, 0, 10));
break;
}
}
示例7: setLineStyle
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
@Override
public void setLineStyle(LineStyle lineStyle)
{
super.setLineStyle(lineStyle);
switch (lineStyle)
{
case NORMAL:
gc.setLineAttributes(lineAttributes);
break;
case DOT:
gc.setLineAttributes(new LineAttributes(1, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_DOT, null, 0, 10));
break;
}
}
示例8: handleDrawRequest
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
private void handleDrawRequest(GC gc, int x, int y, int w, int h) {
int startLine = fTextWidget.getLineIndex(y);
int endLine = fTextWidget.getLineIndex(y + h - 1);
if (startLine <= endLine && startLine < fTextWidget.getLineCount()) {
Color fgColor = gc.getForeground();
LineAttributes lineAttributes = gc.getLineAttributes();
gc.setForeground(Activator.getDefault().getColor());
gc.setLineStyle(lineStyle);
gc.setLineWidth(lineWidth);
spaceWidth = gc.getAdvanceWidth(' ');
if (fIsAdvancedGraphicsPresent) {
int alpha = gc.getAlpha();
gc.setAlpha(this.lineAlpha);
drawLineRange(gc, startLine, endLine, x, w);
gc.setAlpha(alpha);
} else {
drawLineRange(gc, startLine, endLine, x, w);
}
gc.setForeground(fgColor);
gc.setLineAttributes(lineAttributes);
}
}
示例9: setLineStyle
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
public void setLineStyle( ELineStyle lineStyle ) {
switch ( lineStyle ) {
case DASHDOT:
gc.setLineStyle( SWT.LINE_DASHDOT );
break;
case SOLID:
gc.setLineStyle( SWT.LINE_SOLID );
break;
case DOT:
gc.setLineStyle( SWT.LINE_DOT );
break;
case DASH:
gc.setLineStyle( SWT.LINE_DASH );
break;
case PARALLEL:
gc.setLineAttributes( new LineAttributes(
gc.getLineWidth(), SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM, new float[] { 5, 3, }, 0, 10 ) );
break;
default:
break;
}
}
示例10: render
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
@Override
public void render ( final Graphics g, final Rectangle clientRectangle )
{
if ( this.selection != null )
{
final Rectangle chartRect = this.chart.getClientAreaProxy ().getClientRectangle ();
g.setLineAttributes ( new LineAttributes ( 1.0f ) );
g.setForeground ( null );
g.drawRectangle ( this.selection.x + chartRect.x, this.selection.y + chartRect.y, this.selection.width, this.selection.height );
}
}
示例11: makePreview
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
public static Image makePreview ( final Display display, final LineAttributes lineAttributes, final Color lineColor, final Point p )
{
final Image img = new Image ( display, p.x, p.y );
final GC gc = new GC ( img );
try
{
gc.setForeground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
gc.setBackground ( img.getDevice ().getSystemColor ( SWT.COLOR_WHITE ) );
gc.fillRectangle ( 0, 0, p.x, p.y );
gc.setLineAttributes ( lineAttributes );
if ( lineColor != null )
{
gc.setForeground ( lineColor );
}
gc.drawLine ( 0, p.y / 2, p.x, p.y / 2 );
}
finally
{
gc.dispose ();
}
return img;
}
示例12: LevelRuler
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
public LevelRuler ( final ChartRenderer manager, final String prefix, final YAxis y, final int style, final int alpha, final float lineWidth )
{
this.prefix = prefix;
this.manager = manager;
this.alpha = alpha;
this.ruler = new PositionYRuler ( y, style );
this.ruler.setAlpha ( this.alpha );
this.ruler.setLineAttributes ( new LineAttributes ( lineWidth ) );
this.manager.addRenderer ( this.ruler, 200 );
}
示例13: checkPaint
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
/**
* If the line width, line style, foreground or background colors have
* changed, these changes will be pushed to the GC. Also calls
* {@link #checkGC()}.
*/
protected final void checkPaint() {
checkGC();
if (currentState.fgColor != null) {
if (!currentState.fgColor.equals(appliedState.fgColor)
&& currentState.fgPattern == null) {
gc.setForeground(appliedState.fgColor = currentState.fgColor);
}
}
LineAttributes lineAttributes = currentState.lineAttributes;
if (!appliedState.lineAttributes.equals(lineAttributes)) {
if (getAdvanced()) {
gc.setLineAttributes(lineAttributes);
} else {
gc.setLineWidth((int) lineAttributes.width);
gc.setLineCap(lineAttributes.cap);
gc.setLineJoin(lineAttributes.join);
gc.setLineStyle(lineAttributes.style);
if (lineAttributes.dash != null) {
gc.setLineDash(convertFloatArrayToInt(lineAttributes.dash));
}
}
appliedState.lineAttributes = clone(lineAttributes);
}
if (!currentState.bgColor.equals(appliedState.bgColor)
&& currentState.bgPattern == null) {
gc.setBackground(appliedState.bgColor = currentState.bgColor);
}
}
示例14: clone
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
/**
* Countermeasure against LineAttributes class not having its own clone()
* method.
*
* @since 3.6
*/
public static LineAttributes clone(LineAttributes src) {
float[] dashClone = null;
if (src != null) {
if (src.dash != null) {
dashClone = new float[src.dash.length];
System.arraycopy(src.dash, 0, dashClone, 0, dashClone.length);
}
return new LineAttributes(src.width, src.cap, src.join, src.style,
dashClone, src.dashOffset, src.miterLimit);
}
return null;
}
示例15: Shape
import org.eclipse.swt.graphics.LineAttributes; //导入依赖的package包/类
/**
* Default constructor.
*
* @since 2.0
*/
public Shape() {
lineAttributes = new LineAttributes(1.0f);
fill = true;
outline = true;
xorFill = false;
xorOutline = false;
antialias = null;
alpha = null;
// synchronize parameters
lineWidth = (int) lineAttributes.width;
lineStyle = lineAttributes.style;
lastLineWidth = lineWidth;
}