if ( ( (Pattern) object ).isDisposed() ) { return;
/** * 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(); }
Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); surface = image.surface; init();
gc.setForeground(lineColor.getBgColor1()); } else if (lineColor.getBgImage() != null) { pattern = new Pattern(device, lineColor.getBgImage()); gc.setForegroundPattern(pattern);
/** * 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; }
Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); surface = image.surface; init();
Rectangle rect = image.getBounds(); Pattern pattern1 = new Pattern(device, rect.x, rect.y, rect.width/2f, rect.height/2f, color1, color2); gc.setBackgroundPattern(pattern1); Path path = new Path(device); path.dispose(); Pattern pattern2 = new Pattern(device, rect.width, 0, rect.width/2f, rect.height/2f, color1, color2); gc.setBackgroundPattern(pattern2); path = new Path(device); pattern1.dispose(); pattern2.dispose(); return image;
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ @Override public String toString() { if (isDisposed()) return "Pattern {*DISPOSED*}"; return "Pattern {" + handle + "}"; }
Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); surface = image.surface; init();
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(); }); }
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ @Override public String toString() { if (isDisposed()) return "Pattern {*DISPOSED*}"; return "Pattern {" + handle + "}"; }
color = NSColor.colorWithPatternImage(image.handle); color.retain(); init(); } finally { if (pool != null) pool.release();
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ @Override public String toString() { if (isDisposed()) return "Pattern {*DISPOSED*}"; return "Pattern {" + handle + "}"; }
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ public String toString() { if (isDisposed()) return "Pattern {*DISPOSED*}"; return "Pattern {" + (color != null ? color.id : gradient.id) + "}"; }
GC.setCairoPatternColor(handle, 1, color2, alpha2); Cairo.cairo_pattern_set_extend(handle, Cairo.CAIRO_EXTEND_REPEAT); init();
Color color2 = ColorCache.getColor(event.gc.getDevice(), 169, 195, 252); Pattern pattern = new Pattern(event.gc.getDevice(), 0, 0, 0, area.height, color1, 0, color2, 200); event.gc.setBackgroundPattern(pattern); pattern.dispose(); pattern = new Pattern(event.gc.getDevice(), 0, 0, 0, area.height, color2, 50, color2, 255); event.gc.setForegroundPattern(pattern); pattern.dispose();
/** * Returns a string containing a concise, human-readable * description of the receiver. * * @return a string representation of the receiver */ @Override public String toString() { if (isDisposed()) return "Pattern {*DISPOSED*}"; return "Pattern {" + handle + "}"; }