Java源码示例:org.eclipse.swt.graphics.LineAttributes
示例1
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;
}
}
示例2
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;
}
}
示例3
protected void startPushMode() {
final Image image = new Image (styledText.getDisplay(), 20, 20);
GC gc = new GC (image);
gc.setBackground (styledText.getDisplay().getSystemColor(SWT.COLOR_BLACK));
gc.fillRectangle (0, 0, 20, 20);
gc.setForeground (styledText.getDisplay().getSystemColor(SWT.COLOR_WHITE));
gc.setLineAttributes(new LineAttributes(2));
gc.drawLine (0, 13, gc.getFontMetrics().getAverageCharWidth(), 13);
gc.dispose ();
defaultCaret = styledText.getCaret();
Caret cc = new Caret(styledText, 0);
cc.setImage(image);
styledText.setCaret(cc);
int carOffset = styledText.getCaretOffset();
String str = reverseStr(styledText.getText());
styledText.setText(str);
indxPushSegmentStart = carOffset;
styledText.setCaretOffset(getUpdatedCaret(carOffset));
if (!isWidgetReversed) {
setBidiKeyboardLanguage();
} else {
setNonBidiKeyboardLanguage();
}
}
示例4
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(color);
gc.setLineStyle(lineStyle);
gc.setLineWidth(lineWidth);
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);
}
}
示例5
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);
}
}
示例6
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;
}
}
示例7
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;
}
}
示例8
@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 );
}
}
示例9
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 );
}
示例10
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;
}
示例11
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
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
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
this.gc.setLineAttributes ( lineAttributes );
}
示例14
public AbstractLineRender ( final ChartRenderer chart, final SeriesData abstractSeriesData )
{
super ( chart, abstractSeriesData );
this.lineAttributes = new LineAttributes ( 1.0f );
}
示例15
public void setLineAttributes ( final LineAttributes lineAttributes )
{
this.lineAttributes = lineAttributes;
}
示例16
public LineAttributes getLineAttributes ()
{
return this.lineAttributes;
}
示例17
public void setLineAttributes ( final LineAttributes lineAttributes )
{
this.lineAttributes = lineAttributes;
}
示例18
@Override
public void setLineAttributes ( final LineAttributes lineAttributes )
{
this.g.setLineAttributes ( lineAttributes );
}
示例19
public void setLineWidth(float width) {
this.getControl().setLineAttributes(new LineAttributes((width == THINNEST_LINE_WIDTH ? 1f : width)));
}
示例20
public void setLineAttributes ( LineAttributes lineAttributes );