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

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

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

GC.setBackgroundPattern介绍

[英]Sets the background pattern. The default value is null.

This operation requires the operating system's advanced graphics subsystem which may not be available on some platforms.
[中]设置背景图案。默认值为null
此操作需要操作系统的高级图形子系统,该子系统在某些平台上可能不可用。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

return;
gc.setBackgroundPattern( (Pattern) object );
gc.fillRectangle( canvas.getClientArea() );
gc.setBackgroundPattern( null );
return;

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

/**
 * This method draws the gradient patterns that make up the image. The image
 * consists of 4 rows, each consisting of 4 gradient patterns (total of 16).
 */
@Override
public void paint(GC gc, int width, int height) {
  if (!example.checkAdvancedGraphics()) return;
  Device device = gc.getDevice();

  Image image = createImage(device, colorGB1.getBgColor1(), colorGB2.getBgColor1(), width, height);
  Pattern p = new Pattern(device, image);
  gc.setBackgroundPattern(p);
  gc.fillRectangle(0, 0, width, height);

  p.dispose();
  image.dispose();
}

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

/**
 * Creates an image based on a gradient pattern made up of two colors.
 *
 * @param device - The Device
 * @param color1 - The first color used to create the image
 * @param color2 - The second color used to create the image
 *
 * */
static Image createImage(Device device, Color color1, Color color2, int width, int height) {
  Image image = new Image(device, width, height);
  GC gc = new GC(image);
  Rectangle rect = image.getBounds();
  Pattern pattern = new Pattern(device, rect.x, rect.y, rect.width - 1,
        rect.height - 1, color1, color2);
  gc.setBackgroundPattern(pattern);
  gc.fillRectangle(rect);
  gc.drawRectangle(rect.x, rect.y, rect.width - 1, rect.height - 1);
  gc.dispose();
  pattern.dispose();
  return image;
}

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

} else if (fillColor.getBgImage() != null) {
  pattern = new Pattern(device, fillColor.getBgImage());
  gc.setBackgroundPattern(pattern);

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

setAlpha(0xFF);
setAntialias(SWT.DEFAULT);
setBackgroundPattern(null);
setClipping((Rectangle)null);
setForegroundPattern(null);

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

void createCanvas(Composite parent) {
  int style = SWT.NO_BACKGROUND;
  if (dbItem.getSelection()) style |= SWT.DOUBLE_BUFFERED;
  canvas = new Canvas(parent, style);
  canvas.addListener(SWT.Paint, event -> {
    GC gc = event.gc;
    Rectangle rect = canvas.getClientArea();
    Device device = gc.getDevice();
    Pattern pattern = null;
    if (background.getBgColor1() != null) {
      if (background.getBgColor2() != null) { // gradient
        pattern = new Pattern(device, 0, 0, rect.width,
            rect.height,
            background.getBgColor1(),
            background.getBgColor2());
        gc.setBackgroundPattern(pattern);
      } else {	// solid color
        gc.setBackground(background.getBgColor1());
      }
    } else if (background.getBgImage() != null) {		// image
      pattern = new Pattern(device, background.getBgImage());
      gc.setBackgroundPattern(pattern);
    }
    gc.fillRectangle(rect);
    GraphicsTab tab = getTab();
    if (tab != null) tab.paint(gc, rect.width, rect.height);
    if (pattern != null) pattern.dispose();
  });
}

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

gc.setBackgroundPattern(pattern1);
Path path = new Path(device);
path.addRectangle(0, 0, width/4f, height/4f);
gc.setBackgroundPattern(pattern2);
path = new Path(device);
path.addRectangle(width/4f, 0, width/4f, height/4f);

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

setAlpha(0xFF);
setAntialias(SWT.DEFAULT);
setBackgroundPattern(null);
setClipping(0);
setForegroundPattern(null);

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

setAlpha(0xFF);
setAntialias(SWT.DEFAULT);
setBackgroundPattern(null);
setClipping(0);
setForegroundPattern(null);

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

setAlpha(0xFF);
setAntialias(SWT.DEFAULT);
setBackgroundPattern(null);
setClipping(0);
setForegroundPattern(null);

代码示例来源:origin: BiglySoftware/BiglyBT

Pattern pattern = new Pattern(event.gc.getDevice(), 0, 0, 0,
    area.height, color1, 0, color2, 200);
event.gc.setBackgroundPattern(pattern);
event.gc.setBackgroundPattern(null);
pattern.dispose();

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

device.getSystemColor(SWT.COLOR_BLUE), 0x7f,
      device.getSystemColor(SWT.COLOR_RED), 0x7f);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
gc.drawPath(path);
      device.getSystemColor(SWT.COLOR_DARK_CYAN), 0x7f,
      device.getSystemColor(SWT.COLOR_WHITE), 0x7f);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
gc.drawPath(path);
    device.getSystemColor(SWT.COLOR_DARK_GREEN), 0x7f,
    device.getSystemColor(SWT.COLOR_DARK_MAGENTA), 0x7f);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
gc.drawPath(path);
    device.getSystemColor(SWT.COLOR_DARK_RED), 0x7f,
    device.getSystemColor(SWT.COLOR_YELLOW), 0x7f);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
gc.drawPath(path);

代码示例来源:origin: BiglySoftware/BiglyBT

e.gc.setBackgroundPattern(isSortColumn ? patternDown : patternUp);
  e.gc.fillRectangle(x, 1, w, headerHeight - 2);
  e.gc.setForeground(line);
e.gc.setBackgroundPattern(patternUp);
e.gc.fillRectangle(x, 1, clientArea.width - x, headerHeight - 2);
e.gc.setBackgroundPattern(null);

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

bounds.height + 1, gradientTop, gc.getDevice()
        .getSystemColor(SWT.COLOR_WHITE));
gc.setBackgroundPattern(backgroundPattern);

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt

gc.setBackgroundPattern(backgroundPattern);
gc.setForeground(selectedTabFillColors[1]);

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

} else if (background.getBgImage() != null) {
  pattern = new Pattern(device, background.getBgImage());
  gc.setBackgroundPattern(pattern);

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

gc.setAlpha (oldAlpha);
gc.setAntialias (oldAntialias);
gc.setBackgroundPattern (oldBackgroundPattern);
gc.setForegroundPattern (oldForegroundPattern);
gc.setInterpolation (oldInterpolation);
gc.setAlpha (oldAlpha);
gc.setAntialias (oldAntialias);
gc.setBackgroundPattern (oldBackgroundPattern);
gc.setClipping (cellBounds);
gc.setForegroundPattern (oldForegroundPattern);
gc.setAlpha (oldAlpha);
gc.setAntialias (oldAntialias);
gc.setBackgroundPattern (oldBackgroundPattern);
gc.setClipping (cellBounds);
gc.setForegroundPattern (oldForegroundPattern);

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

} else if (background.getBgImage() != null) {
  pattern = new Pattern(device, background.getBgImage());
  gc.setBackgroundPattern(pattern);

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

} else if (background.getBgImage() != null) {
  pattern = new Pattern(device, background.getBgImage());
  gc.setBackgroundPattern(pattern);

相关文章

GC类方法