Java 类org.eclipse.swt.graphics.LineAttributes 实例源码

项目:jo-widgets    文件:GraphicContextSpiImpl.java   
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);
        }

    }
}
项目:gef-gwt    文件:PrinterGraphics.java   
/**
 * 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);
    }
}
项目:gef-gwt    文件:SWTGraphics.java   
/**
 * 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);
        }
    }
}
项目:kettle-trunk    文件:SWTGC.java   
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;
  }
}
项目:simpledance    文件:SWTContext.java   
@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;
    }
}
项目:IndentGuide    文件:IndentGuidePainter.java   
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);
    }
}
项目:pentaho-kettle    文件:SWTDirectGC.java   
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;
  }
}
项目:pentaho-kettle    文件:SWTGC.java   
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;
  }
}
项目:neoscada    文件:MouseDragZoomer.java   
@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 );
    }
}
项目:neoscada    文件:YAxisDynamicRenderer.java   
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 );
}
项目:neoscada    文件:XAxisDynamicRenderer.java   
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;
}
项目:neoscada    文件:LineInput.java   
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;
}
项目:neoscada    文件:ItemObserver.java   
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 );
}
项目:gef-gwt    文件:SWTGraphics.java   
/**
 * 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);
    }
}
项目:gef-gwt    文件:SWTGraphics.java   
/**
 * 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;
}
项目:gef-gwt    文件:Shape.java   
/**
 * 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;
}
项目:read-open-source-code    文件:SWTGC.java   
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;
    }
}
项目:kettle-4.4.0-stable    文件:SWTGC.java   
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;
    }
}
项目:kettle-trunk    文件:SWTDirectGC.java   
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;
    }
}
项目:neoscada    文件:SWTGraphics.java   
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.gc.setLineAttributes ( lineAttributes );
}
项目:neoscada    文件:AbstractLineRender.java   
public AbstractLineRender ( final ChartRenderer chart, final SeriesData abstractSeriesData )
{
    super ( chart, abstractSeriesData );
    this.lineAttributes = new LineAttributes ( 1.0f );
}
项目:neoscada    文件:AbstractLineRender.java   
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.lineAttributes = lineAttributes;
}
项目:neoscada    文件:AbstractLineRender.java   
public LineAttributes getLineAttributes ()
{
    return this.lineAttributes;
}
项目:neoscada    文件:AbstractRuler.java   
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.lineAttributes = lineAttributes;
}
项目:neoscada    文件:Draw2DGraphics.java   
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
    this.g.setLineAttributes ( lineAttributes );
}
项目:TuxGuitar-1.3.1-fork    文件:TGPainterImpl.java   
public void setLineWidth(float width) {
    this.gc.setLineAttributes(new LineAttributes((width == THINNEST_LINE_WIDTH ? 1f : width)));
}
项目:PDFReporter-Studio    文件:J2DScaledGraphics.java   
public void setLineAttributes(LineAttributes paramLineAttributes) {
    setLineWidthFloat(paramLineAttributes.width);
    setLineStyle(paramLineAttributes.style);
}
项目:PDFReporter-Studio    文件:J2DScaledGraphics.java   
public LineAttributes getLineAttributes() {
    LineAttributes localLineAttributes;
    (localLineAttributes = new LineAttributes(getLineWidthFloat())).style = getLineStyle();
    return localLineAttributes;
}
项目:PDFReporter-Studio    文件:J2DGraphics.java   
public void setLineAttributes(LineAttributes paramLineAttributes) {
    setLineWidthFloat(paramLineAttributes.width);
    setLineStyle(paramLineAttributes.style);
}
项目:PDFReporter-Studio    文件:J2DGraphics.java   
public LineAttributes getLineAttributes() {
    LineAttributes localLineAttributes;
    (localLineAttributes = new LineAttributes(getLineWidthFloat())).style = getLineStyle();
    return localLineAttributes;
}
项目:gef-gwt    文件:ScaledGraphics.java   
/** @see Graphics#getLineAttributes() */
public LineAttributes getLineAttributes() {
    LineAttributes a = graphics.getLineAttributes();
    a.width = getLocalLineWidth();
    return a;
}
项目:gef-gwt    文件:ScaledGraphics.java   
/** @see Graphics#setLineAttributes(LineAttributes) */
public void setLineAttributes(LineAttributes attributes) {
    graphics.setLineAttributes(attributes);
    setLocalLineWidth(attributes.width);
}
项目:gef-gwt    文件:SWTGraphics.java   
/**
 * @since 3.5
 */
public void getLineAttributes(LineAttributes lineAttributes) {
    copyLineAttributes(lineAttributes, currentState.lineAttributes);
}
项目:gef-gwt    文件:SWTGraphics.java   
public void setLineAttributes(LineAttributes lineAttributes) {
    copyLineAttributes(currentState.lineAttributes, lineAttributes);
}
项目:geokettle-2.0    文件:JobGraph.java   
protected void drawLine(GC gc, JobHopMeta hop, boolean is_candidate) {
  int line[] = getLine(hop.from_entry, hop.to_entry);

  gc.setLineWidth(linewidth);
  Color col;

  if (hop.from_entry.isLaunchingInParallel()) {
    gc.setLineAttributes(new LineAttributes((float) linewidth, SWT.CAP_FLAT, SWT.JOIN_MITER, SWT.LINE_CUSTOM,
        new float[] { 5, 3, }, 0, 10));
  } else {
    gc.setLineStyle(SWT.LINE_SOLID);
  }

  if (is_candidate) {
    col = GUIResource.getInstance().getColorBlue();
  } else if (hop.isEnabled()) {
    if (hop.isUnconditional()) {
      col = GUIResource.getInstance().getColorBlack();
    } else {
      if (hop.getEvaluation()) {
        col = GUIResource.getInstance().getColorGreen();
      } else {
        col = GUIResource.getInstance().getColorRed();
      }
    }
  } else {
    col = GUIResource.getInstance().getColorGray();
  }

  gc.setForeground(col);

  if (hop.isSplit())
    gc.setLineWidth(linewidth + 2);
  drawArrow(gc, line);
  if (hop.isSplit())
    gc.setLineWidth(linewidth);

  gc.setForeground(GUIResource.getInstance().getColorBlack());
  gc.setBackground(GUIResource.getInstance().getColorBackground());
  gc.setLineStyle(SWT.LINE_SOLID);
}
项目:gef-gwt    文件:Shape.java   
/**
 * Sets all line attributes at once.
 * 
 * @see org.eclipse.swt.graphics.LineAttributes
 * 
 * @param la
 * @since 3.5
 */
public void setLineAttributes(LineAttributes la) {
    if (!lineAttributes.equals(la)) {
        // SWTGraphics.copyLineAttributes(lineAttributes, la);
        repaint();
    }
}
项目:gef-gwt    文件:Graphics.java   
/**
 * Returns the current collection of line attributes.
 * 
 * @see org.eclipse.swt.graphics.LineAttributes
 * @return all attributes used for line drawing
 * @since 3.5
 */
public LineAttributes getLineAttributes() {
    throwNotImplemented();
    return null;
}
项目:gef-gwt    文件:Graphics.java   
/**
 * Sets all line attributes together
 * 
 * @param attributes
 *            the line attributes
 * @since 3.5
 */
public void setLineAttributes(LineAttributes attributes) {
    throwNotImplemented();
}
项目:gef-gwt    文件:Shape.java   
/**
 * Returns line attributes used when drawing this shape.
 * 
 * @see org.eclipse.swt.graphics.LineAttributes
 * 
 *      Performance note: creates and returns a clone.
 * 
 * @return current line attributes
 * @since 3.5
 */
public LineAttributes getLineAttributes() {
    // return SWTGraphics.clone(lineAttributes);
    return null;
}
项目:neoscada    文件:Graphics.java   
public void setLineAttributes ( LineAttributes lineAttributes );