Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void doRename(boolean showPreview) {
Point size;
try {
size= composite.getSize();
image= new Image(gc.getDevice(), size.x, size.y);
image= new Image(gc.getDevice(), (iGc, width, height) -> {}, size.x, size.y) ;
gc.copyArea(image, 0, 0);
} finally {
gc.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageDataProvider;
import org.eclipse.swt.graphics.ImageGcDrawer;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
Expand Down Expand Up @@ -104,16 +105,22 @@ protected void drawCompositeImage(int width, int height) {
Display display= fParentComposite.getDisplay();

ImageDataProvider imageProvider= zoom -> {
Image image= new Image(display, ARROW_SIZE, ARROW_SIZE * 2);

GC gc= new GC(image, fLTR ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT);
gc.setAntialias(SWT.ON);

Color triangleColor= createColor(SWT.COLOR_LIST_FOREGROUND, SWT.COLOR_LIST_BACKGROUND, 20, display);
gc.setBackground(triangleColor);
gc.fillPolygon(new int[] { 0, 0, ARROW_SIZE, ARROW_SIZE, 0, ARROW_SIZE * 2 });
gc.dispose();
triangleColor.dispose();
ImageGcDrawer drawer = new ImageGcDrawer() {
@Override
public void drawOn(GC gc, int iWidth, int iHeight) {
gc.setAntialias(SWT.ON);
Color triangleColor= createColor(SWT.COLOR_LIST_FOREGROUND, SWT.COLOR_LIST_BACKGROUND, 20, display);
gc.setBackground(triangleColor);
gc.fillPolygon(new int[] { 0, 0, ARROW_SIZE, ARROW_SIZE, 0, ARROW_SIZE * 2 });
triangleColor.dispose();
}

@Override
public int getGcStyle() {
return fLTR ? SWT.LEFT_TO_RIGHT : SWT.RIGHT_TO_LEFT;
}
};
Image image= new Image(display, drawer, ARROW_SIZE, ARROW_SIZE * 2);

ImageData imageData= image.getImageData(zoom);
image.dispose();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.ImageDataProvider;
import org.eclipse.swt.graphics.ImageGcDrawer;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.ColorDialog;
import org.eclipse.swt.widgets.Shell;
Expand Down Expand Up @@ -54,16 +54,14 @@ class SignatureStylingColorPreferenceMenuItem extends Action implements ImageDat

@Override
public ImageData getImageData(int zoom) {
Image image= new Image(shell.getDisplay(), 16, 16);
GC gc= new GC(image);

gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BORDER));
gc.setBackground(new Color(shell.getDisplay(), getCurrentColor()));
gc.fillRectangle(image.getBounds());
gc.setLineWidth(2);
gc.drawRectangle(image.getBounds());
gc.dispose();

final ImageGcDrawer imageGcDrawer = (gc, width, height) -> {
gc.setForeground(shell.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BORDER));
gc.setBackground(new Color(shell.getDisplay(), getCurrentColor()));
gc.fillRectangle(0, 0, width, height);
gc.setLineWidth(2);
gc.drawRectangle(0, 0, width, height);
};
Image image= new Image(shell.getDisplay(), imageGcDrawer, 16, 16);
ImageData data= image.getImageData(zoom);
image.dispose();
return data;
Expand Down
Loading