@@ -306,16 +306,21 @@ private static ImageData autoScaleImageData (Device device, final ImageData imag
306306 boolean useSmoothScaling = isSmoothScalingEnabled () && imageData .getTransparencyType () != SWT .TRANSPARENCY_MASK ;
307307 if (useSmoothScaling ) {
308308 Image original = new Image (device , (ImageDataProvider ) zoom -> imageData );
309- /* Create a 24 bit image data with alpha channel */
310- final ImageData resultData = new ImageData (scaledWidth , scaledHeight , 24 , new PaletteData (0xFF , 0xFF00 , 0xFF0000 ));
311- resultData .alphaData = new byte [scaledWidth * scaledHeight ];
312- Image resultImage = new Image (device , (ImageDataProvider ) zoom -> resultData );
313- GC gc = new GC (resultImage );
314- gc .setAntialias (SWT .ON );
315- Image .drawScaled (gc , original , width , height , scaleFactor );
316- gc .dispose ();
309+ ImageGcDrawer drawer = new ImageGcDrawer () {
310+ @ Override
311+ public void drawOn (GC gc , int imageWidth , int imageHeight ) {
312+ gc .setAntialias (SWT .ON );
313+ Image .drawScaled (gc , original , width , height , scaleFactor );
314+ };
315+
316+ @ Override
317+ public int getGcStyle () {
318+ return SWT .TRANSPARENT ;
319+ }
320+ };
321+ Image resultImage = new Image (device , drawer , scaledWidth , scaledHeight );
322+ ImageData result = resultImage .getImageData (100 );
317323 original .dispose ();
318- ImageData result = resultImage .getImageData (getDeviceZoom ());
319324 resultImage .dispose ();
320325 return result ;
321326 } else {
0 commit comments