GC.drawImage to shrink does not look good on Windowshttps://www.eclipse.org/forums/index.php/mv/msg/148551/467342/#msg_467342
I use GC.drawImage to shrink an image on the canvas. When I shrink to
50% or greater the image quality is very poor, text is not readable,
broken segments, etc. This only happens on Windows! On Linux, it looks
great. I can shrink the image as small as I want as it still looks good.
Is this a bug in SWT or is there something I can do to make it look
better on Windows?

many thanks,

Barry]]>Barry Andrews2006-01-29T16:20:01-00:00Re: GC.drawImage to shrink does not look good on Windowshttps://www.eclipse.org/forums/index.php/mv/msg/148551/467345/#msg_467345
I suspect the only way around this would be to perform the image shrinking yourself (by implementing your own anti-aliasing mechanism), and then draw it with a 1-1 image size via the Windows API.

The image resizing is a function of the graphics card and driver on your Windows system, so a different graphics card (or different driver settings) may have an effect. 3D graphics cards, for example, often have various anti-aliasing effects which affect how they perform.

If you want to use different sizes, then it might be worth preparing different image sizes in advance; for example, there's a bunch of 32x32 and 16x16 icons that are used at different sizes instead of doing on-the-fly conversion. Also, dropping size by exactly 1/2 sometimes has benefits (since it can use a different anti-aliasing mechanism).

Have a look at the images in Internet Explorer, with a simple IMG="src.gif" width="32" height="32" type tag, and then change it to a different size (e.g. width="30" height="30"). You'll almost certainly see the same pixelation that you see with Eclipse. However, on other operating systems (Mac,Linux etc.) you will probably see a better anti-aliasing of the image in question (and maybe even for Firefox too, since it probably implements its own routine).

For more information, search wikipedia for anti-aliasing if you want to knnow more.

Alex.]]>Alex Blewitt2006-01-29T17:40:05-00:00Re: GC.drawImage to shrink does not look good on Windowshttps://www.eclipse.org/forums/index.php/mv/msg/148551/467349/#msg_467349
setTextAntialias()

Still doesn't look quite as good as it does on Linux but it's a huge
improvement.

-Barry

Alex Blewitt wrote:
> What you're describing sounds like anti-aliasing (or lack thereof). I don't know if Windows does anti-aliasing by default when changing image sizes; by the sounds of things, your graphics card isn't doing that.
>
> I suspect the only way around this would be to perform the image shrinking yourself (by implementing your own anti-aliasing mechanism), and then draw it with a 1-1 image size via the Windows API.
>
> The image resizing is a function of the graphics card and driver on your Windows system, so a different graphics card (or different driver settings) may have an effect. 3D graphics cards, for example, often have various anti-aliasing effects which affect how they perform.
>
> If you want to use different sizes, then it might be worth preparing different image sizes in advance; for example, there's a bunch of 32x32 and 16x16 icons that are used at different sizes instead of doing on-the-fly conversion. Also, dropping size by exactly 1/2 sometimes has benefits (since it can use a different anti-aliasing mechanism).
>
> Have a look at the images in Internet Explorer, with a simple IMG="src.gif" width="32" height="32" type tag, and then change it to a different size (e.g. width="30" height="30"). You'll almost certainly see the same pixelation that you see with Eclipse. However, on other operating systems (Mac,Linux etc.) you will probably see a better anti-aliasing of the image in question (and maybe even for Firefox too, since it probably implements its own routine).
>
> For more information, search wikipedia for anti-aliasing if you want to knnow more.
>
> Alex.]]>Barry Andrews2006-01-30T00:50:54-00:00Re: GC.drawImage to shrink does not look good on Windowshttps://www.eclipse.org/forums/index.php/mv/msg/148551/467446/#msg_467446
further in windows.

Adrian]]>Adrian Yiu2006-01-31T16:21:52-00:00Re: GC.drawImage to shrink does not look good on Windowshttps://www.eclipse.org/forums/index.php/mv/msg/148551/467490/#msg_467490
the closer the new image's size is to the original ( less shrinkage ),
the worse the image looks. ( It starts getting blurry. ) So based on my
initial tests, I would say if you are shrinking the image a lot then use
it, otherwise don't because it will actually make the image look worse.
I did not try this on Linux.

Thanks for the hint!

-Barry

Adrian Yiu wrote:
> You may also try setInterpolation(SWT.HIGH) and see whether it can
> improve further in windows.
>
> Adrian
>]]>Barry Andrews2006-02-01T00:37:30-00:00