org.eclipse.swt.graphics.GC.setClipping()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.eclipse.swt.graphics.GC.setClipping()方法的一些代码示例,展示了GC.setClipping()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GC.setClipping()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.GC
类名称:GC
方法名:setClipping

GC.setClipping介绍

[英]Sets the area of the receiver which can be changed by drawing operations to the rectangular area specified by the arguments.
[中]将可通过绘图操作更改的接收器区域设置为参数指定的矩形区域。

代码示例

代码示例来源:origin: de.dentrassi.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public void setClipping ( final Rectangle rect )
{
  this.gc.setClipping ( rect );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

void setClippingInPixels(Rectangle rect) {
  if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && (drawable instanceof Tree || drawable instanceof Table)) {
    return; //FIXME: This is an atrocious hack for bug 446075
  }
  if (rect == null) {
    setClipping(0);
  } else {
    setClippingInPixels(rect.x, rect.y, rect.width, rect.height);
  }
}
/**

代码示例来源:origin: org.eclipse.neoscada.chart/org.eclipse.scada.chart.swt

@Override
public void setClipping ( final Rectangle rect )
{
  this.gc.setClipping ( rect );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void setClippingInPixels(Rectangle rect) {
  if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && (drawable instanceof Tree || drawable instanceof Table)) {
    return; //FIXME: This is an atrocious hack for bug 446075
  }
  if (rect == null) {
    setClipping(0);
  } else {
    setClippingInPixels(rect.x, rect.y, rect.width, rect.height);
  }
}
/**

代码示例来源:origin: org.jfree/swtgraphics2d

/**
 * Sets the clip region to the specified rectangle.
 *
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 * @param width  the width.
 * @param height  the height.
 */
@Override
public void setClip(int x, int y, int width, int height) {
  this.gc.setClipping(x, y, width, height);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void setClippingInPixels(Rectangle rect) {
  if (OS.GTK_VERSION >= OS.VERSION(3, 9, 0) && (drawable instanceof Tree || drawable instanceof Table)) {
    return; //FIXME: This is an atrocious hack for bug 446075
  }
  if (rect == null) {
    setClipping(0);
  } else {
    setClippingInPixels(rect.x, rect.y, rect.width, rect.height);
  }
}
/**

代码示例来源:origin: com.google.code.maven-play-plugin.org.xhtmlrenderer/core-renderer

public void setClip(Shape s) {
  Path path = convertToPath(s);
  if (path == null) {
    _gc.setClipping((Rectangle) null);
  } else {
    _gc.setClipping(path);
  }
  if (_clippingPath != null) {
    _clippingPath.dispose();
  }
  _clippingPath = path;
  _clippingArea = (s == null ? null : new Area(s));
}

代码示例来源:origin: rherrmann/eclipse-extras

private void drawText( Point location, Color foreground, Rectangle clipping ) {
 Rectangle previousClipping = gc.getClipping();
 if( clipping != null ) {
  gc.setClipping( clipping );
 }
 gc.setForeground( foreground );
 gc.drawText( text, location.x, location.y, SWT.DRAW_TRANSPARENT );
 if( clipping != null ) {
  gc.setClipping( previousClipping );
 }
}

代码示例来源:origin: org.jfree/swtgraphics2d

/**
 * Applies the specified clip.
 *
 * @param s  the shape for the clip.
 */
@Override
public void clip(Shape s) {
  Path path = toSwtPath(s);
  this.gc.setClipping(path);
  path.dispose();
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui

protected void paintItem(GC gc, TreeItem item, Rectangle bounds) {
  super.paintItem(gc, item, bounds);
  Object[] data = computeTreeExtensionData(item.getData());
  if ((data != null) && (data.length == 2)) {
    gc.setClipping(columnPosition, bounds.y + 1, controlWidth, bounds.height);
    gc.setForeground((Color) data[1]);
    gc.drawString((String) data[0], columnPosition + 5, bounds.y + 1);
    gc.setClipping((Rectangle) null);
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void fillRegion(GC gc, Region region) {
  // NOTE: region passed in to this function will be modified
  Region clipping = new Region();
  gc.getClipping(clipping);
  region.intersect(clipping);
  gc.setClipping(region);
  gc.fillRectangle(region.getBounds());
  gc.setClipping(clipping);
  clipping.dispose();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

void setClippingInPixels (int x, int y, int width, int height) {
  if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
  int /*long*/ hRgn = OS.CreateRectRgn(x, y, x + width, y + height);
  setClipping(hRgn);
  OS.DeleteObject(hRgn);
}

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

void fillRegion(GC gc, Region region) {
  // NOTE: region passed in to this function will be modified
  Region clipping = new Region();
  gc.getClipping(clipping);
  region.intersect(clipping);
  gc.setClipping(region);
  gc.fillRectangle(region.getBounds());
  gc.setClipping(clipping);
  clipping.dispose();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

void fillRegion(GC gc, Region region) {
  // NOTE: region passed in to this function will be modified
  Region clipping = new Region();
  gc.getClipping(clipping);
  region.intersect(clipping);
  gc.setClipping(region);
  gc.fillRectangle(region.getBounds());
  gc.setClipping(clipping);
  clipping.dispose();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

void fillRegion(GC gc, Region region) {
  // NOTE: region passed in to this function will be modified
  Region clipping = new Region();
  gc.getClipping(clipping);
  region.intersect(clipping);
  gc.setClipping(region);
  gc.fillRectangle(region.getBounds());
  gc.setClipping(clipping);
  clipping.dispose();
}

代码示例来源:origin: org.piccolo2d/piccolo2d-swt

/**
 * This method isn't really supported by SWT - so will use the shape bounds.
 * 
 * @param s shape of the clipping region to apply to graphics operations
 */
public void clip(final Shape s) {
  final Rectangle2D clipBds = s.getBounds2D();
  SWTShapeManager.transform(clipBds, transform);
  SWTShapeManager.awtToSWT(clipBds, SWT_RECT);
  org.eclipse.swt.graphics.Rectangle clip = gc.getClipping();
  clip = clip.intersection(SWT_RECT);
  gc.setClipping(SWT_RECT);
}

代码示例来源:origin: org.piccolo2d/piccolo2d-swt

/** {@inheritDoc} */
public void setClip(final int x, final int y, final int width, final int height) {
  TEMP_RECT.setRect(x, y, width, height);
  SWTShapeManager.transform(TEMP_RECT, transform);
  SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT);
  gc.setClipping(SWT_RECT);
}

代码示例来源:origin: org.piccolo2d/piccolo2d-swt

/** {@inheritDoc} */
public void clipRect(final int x, final int y, final int width, final int height) {
  TEMP_RECT.setRect(x, y, width, height);
  SWTShapeManager.transform(TEMP_RECT, transform);
  SWTShapeManager.awtToSWT(TEMP_RECT, SWT_RECT);
  org.eclipse.swt.graphics.Rectangle clip = gc.getClipping();
  clip = clip.intersection(SWT_RECT);
  gc.setClipping(clip);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

void headerPaintVShadows (GC gc, int x, int y, int width, int height) {
  gc.setClipping (x, y, width, height);
  int endX = x + width;
  gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
  gc.drawLine (x, y, x, y + height - 1);					/* highlight shadow */
  gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_NORMAL_SHADOW));
  gc.drawLine (endX - 2, y + 1, endX - 2, height - 2);	/* light inner shadow */
  gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_DARK_SHADOW));
  gc.drawLine (endX - 1, y, endX - 1, height - 1);		/* dark outer shadow */
}
void headerShowToolTip (int x) {

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

void headerPaintHShadows (GC gc, int x, int y, int width, int height) {
  gc.setClipping (x, y, width, height);
  int endX = x + width;
  gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW));
  gc.drawLine (x, y, endX, y);                    /* highlight shadow */
  gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_NORMAL_SHADOW));
  gc.drawLine (x, height - 2, endX, height - 2);	/* lowlight shadow */
  gc.setForeground (display.getSystemColor (SWT.COLOR_WIDGET_DARK_SHADOW));
  gc.drawLine (x, height - 1, endX, height - 1);	/* outer shadow */
}
void headerPaintVShadows (GC gc, int x, int y, int width, int height) {

相关文章

GC类方法