Firemonkey drawing on bitmap without interpolation

2.3k views Asked by At

I am using the canvas draw functions drawrect and filltext to draw onto a Tbitmap but I don't want the results antialiased. Anyone know how to do that ?

Working with OSX and Delphi XE3 (but have XE4 and XE5 if needed)

2

There are 2 answers

6
GnomeDePlume On

Is the problem:

  1. the bitmap you create seems to have anti-aliasing present in the data?
  2. or have you got a good bitmap and want to disable anti-aliasing in the viewer/display?

If it is the former, have you checked that the anti-aliasing is actually present in the bitmap, and not introduced by your viewer?

In the past I've found it useful to draw a black-on-white test pattern, and display the image at 1:1 scale. Irfanview is a nice tool for viewing at 'true' scale. Then use a loupe/peak/lens to get a close-up of the actual pixels.

Black-on-white test patterns are particularly good since you should be able to see (hopefully) that the R,G and B sub-pixels are all equally illuminated when there is no anti-aliassing present. If you draw a black-on white pattern and you get solitary bright sub-pixels then you've definitely got anti-aliassing (or some other form of corruption!).

My experience has been that image viewers often do interpolation for you, and it can be tricky to see what is going on unless you look at the actual bitmap data or have a close-up look at the unscaled image...

0
Ivan Revelli On

Hi in the drawBitmap method you need to set HighSpeed parameter to "True", in the sample below:

NewBitmap.Canvas.DrawBitmap(SmallBmp, RectF(0, 0, SmallBmp.Width, SmallBmp.Height), RectF(0, 0, NewBitmap.Width, NewBitmap.Height), 1,**True**);

rgds Ivan