java类org.eclipse.swt.graphics.LineAttributes的实例源码

GraphicContextSpiImpl.java 文件源码 项目:jo-widgets 阅读 25 收藏 0 点赞 0 评论 0
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);
        }

    }
}
PrinterGraphics.java 文件源码 项目:gef-gwt 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
SWTGraphics.java 文件源码 项目:gef-gwt 阅读 35 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
SWTGC.java 文件源码 项目:kettle-trunk 阅读 28 收藏 0 点赞 0 评论 0
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;
  }
}
SWTContext.java 文件源码 项目:simpledance 阅读 23 收藏 0 点赞 0 评论 0
@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;
    }
}
IndentGuidePainter.java 文件源码 项目:IndentGuide 阅读 30 收藏 0 点赞 0 评论 0
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);
    }
}
SWTDirectGC.java 文件源码 项目:pentaho-kettle 阅读 31 收藏 0 点赞 0 评论 0
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;
  }
}
SWTGC.java 文件源码 项目:pentaho-kettle 阅读 30 收藏 0 点赞 0 评论 0
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;
  }
}
MouseDragZoomer.java 文件源码 项目:neoscada 阅读 25 收藏 0 点赞 0 评论 0
@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 );
    }
}
YAxisDynamicRenderer.java 文件源码 项目:neoscada 阅读 23 收藏 0 点赞 0 评论 0
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 );
}
XAxisDynamicRenderer.java 文件源码 项目:neoscada 阅读 31 收藏 0 点赞 0 评论 0
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;
}
LineInput.java 文件源码 项目:neoscada 阅读 23 收藏 0 点赞 0 评论 0
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;
}
ItemObserver.java 文件源码 项目:neoscada 阅读 22 收藏 0 点赞 0 评论 0
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 );
}
SWTGraphics.java 文件源码 项目:gef-gwt 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
    }
}
SWTGraphics.java 文件源码 项目:gef-gwt 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 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;
}
Shape.java 文件源码 项目:gef-gwt 阅读 26 收藏 0 点赞 0 评论 0
/**
 * 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;
}
SWTGC.java 文件源码 项目:read-open-source-code 阅读 26 收藏 0 点赞 0 评论 0
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;
    }
}
SWTGC.java 文件源码 项目:kettle-4.4.0-stable 阅读 32 收藏 0 点赞 0 评论 0
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;
    }
}
SWTDirectGC.java 文件源码 项目:kettle-trunk 阅读 20 收藏 0 点赞 0 评论 0
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;
    }
}
SWTGraphics.java 文件源码 项目:neoscada 阅读 23 收藏 0 点赞 0 评论 0
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.gc.setLineAttributes ( lineAttributes );
}
AbstractLineRender.java 文件源码 项目:neoscada 阅读 21 收藏 0 点赞 0 评论 0
public AbstractLineRender ( final ChartRenderer chart, final SeriesData abstractSeriesData )
{
    super ( chart, abstractSeriesData );
    this.lineAttributes = new LineAttributes ( 1.0f );
}
AbstractLineRender.java 文件源码 项目:neoscada 阅读 23 收藏 0 点赞 0 评论 0
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.lineAttributes = lineAttributes;
}
AbstractLineRender.java 文件源码 项目:neoscada 阅读 27 收藏 0 点赞 0 评论 0
public LineAttributes getLineAttributes ()
{
    return this.lineAttributes;
}
AbstractRuler.java 文件源码 项目:neoscada 阅读 25 收藏 0 点赞 0 评论 0
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.lineAttributes = lineAttributes;
}
Draw2DGraphics.java 文件源码 项目:neoscada 阅读 28 收藏 0 点赞 0 评论 0
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.g.setLineAttributes ( lineAttributes );
}
TGPainterImpl.java 文件源码 项目:TuxGuitar-1.3.1-fork 阅读 34 收藏 0 点赞 0 评论 0
public void setLineWidth(float width) {
    this.gc.setLineAttributes(new LineAttributes((width == THINNEST_LINE_WIDTH ? 1f : width)));
}
J2DScaledGraphics.java 文件源码 项目:PDFReporter-Studio 阅读 24 收藏 0 点赞 0 评论 0
public void setLineAttributes(LineAttributes paramLineAttributes) {
    setLineWidthFloat(paramLineAttributes.width);
    setLineStyle(paramLineAttributes.style);
}
J2DScaledGraphics.java 文件源码 项目:PDFReporter-Studio 阅读 30 收藏 0 点赞 0 评论 0
public LineAttributes getLineAttributes() {
    LineAttributes localLineAttributes;
    (localLineAttributes = new LineAttributes(getLineWidthFloat())).style = getLineStyle();
    return localLineAttributes;
}
J2DGraphics.java 文件源码 项目:PDFReporter-Studio 阅读 25 收藏 0 点赞 0 评论 0
public void setLineAttributes(LineAttributes paramLineAttributes) {
    setLineWidthFloat(paramLineAttributes.width);
    setLineStyle(paramLineAttributes.style);
}
J2DGraphics.java 文件源码 项目:PDFReporter-Studio 阅读 24 收藏 0 点赞 0 评论 0
public LineAttributes getLineAttributes() {
    LineAttributes localLineAttributes;
    (localLineAttributes = new LineAttributes(getLineWidthFloat())).style = getLineStyle();
    return localLineAttributes;
}


问题


面经


文章

微信
公众号

扫码关注公众号