Blog

Firemonkey bitmap scaling without Aliasing on Android

With Delphi , to the Seattle version , when you scale a bitmap image to enlarge using the command “Canvas.DrawBitmap(OiginalBitmap, RectF(0, 0, OiginalBitmap.Width, OiginalBitmap.Height), RectF(0, 0, Width, Height), 1, False);” the interpolation cant be disabled.

A way to eliminate the problem is to manually scale the bitmap directly creating an image pixel by pixel . To do this you need to get canvas.scale and create an image with the native resolution of the Android device .

This helped me for example to generate qrcode on the display of my Android devices that were as sharp as possible, i use the DelphiZXingQRCode to generate the qrcode in the original format.

To draw the qrcode generated from the library I have implemented the following procedure:

and the result is a perfect qrCode without aliasing and interpolation:

IMG_0058

This post is also available in: Inglese

Scoprite cosa possiamo fare per il vostro business
I nostri linguaggi