You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
On MacOS, when using the constructor org.eclipse.swt.graphics.Image#Image(org.eclipse.swt.graphics.Device, org.eclipse.swt.graphics.Image, int), the new image is more blurry, and the base image too.
The base image and its copies become more and more blurry as we use the same constructor again.
The bug seems to be created when the base image was created from an ImageDescriptor.
The bug occurs with any flag passed as a parameter to create the new image.
To Reproduce
Edit IMAGE_PATH to put the path to your icon, by example you can download it:
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import java.io.File;
import java.net.MalformedURLException;
public final class HelloWorld {
private static final String IMAGE_PATH = "/path/to/file_icon.png";
public static void main(final String[] args) throws MalformedURLException {
final Display display = new Display();
final Shell shell = new Shell(display);
final ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(new File(IMAGE_PATH).toURI().toURL());
final Image baseImage = imageDescriptor.createImage();
final int imageWidth = baseImage.getImageData().width;
shell.addListener(SWT.Paint, event -> {
int x = 0;
for (int i = 0; i < 10; i++) {
final Image copy = new Image(baseImage.getDevice(), baseImage, SWT.IMAGE_COPY);
event.gc.drawImage(copy, x, 0);
x += imageWidth + 10;
event.gc.drawImage(baseImage, x, 0);
x += imageWidth + 10;
copy.dispose();
}
});
shell.setSize(400, 300);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
baseImage.dispose();
display.dispose();
}
}
Expected behavior
The base image and its copies must not be blurry.
Screenshots
Environment:
Select the platform(s) on which the behavior is seen:
All OS
Windows
Linux
macOS
Additional OS info
Tried on : MacOS Sequoia, aarch64
JRE/JDK version
Tried on Eclipse Temurin 21.0.5
Workaround
Create a temporary image by passing the ImageData of the base image.
Replace...
final Image copy = new Image(baseImage.getDevice(), baseImage, SWT.IMAGE_COPY);
... with
final Image tmpImage = new Image(baseImage.getDevice(), baseImage.getImageData());
final Image copy = new Image(baseImage.getDevice(), tmpImage, SWT.IMAGE_COPY);
tmpImage.dispose();
The text was updated successfully, but these errors were encountered:
Describe the bug
On MacOS, when using the constructor
org.eclipse.swt.graphics.Image#Image(org.eclipse.swt.graphics.Device, org.eclipse.swt.graphics.Image, int)
, the new image is more blurry, and the base image too.The base image and its copies become more and more blurry as we use the same constructor again.
The bug seems to be created when the base image was created from an ImageDescriptor.
The bug occurs with any flag passed as a parameter to create the new image.
To Reproduce
Edit IMAGE_PATH to put the path to your icon, by example you can download it:
Expected behavior
The base image and its copies must not be blurry.
Screenshots
Environment:
Tried on : MacOS Sequoia, aarch64
Tried on Eclipse Temurin 21.0.5
Workaround
Create a temporary image by passing the ImageData of the base image.
Replace...
... with
The text was updated successfully, but these errors were encountered: