3
votes

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
Maybe the last answer at stackoverflow.com/questions/10592874/… is of help?Gerard
Thanks for the link. Aligning drawing co-ordinates with pixels will only avoid anti-aliasing for vertical and horizontal lines. Its not going to be of help with text or rounded corners - at least thats what I assume, there is no help in the documentation as usual. What I need to do is turn it off.David Peters
Please provide simple code example that demonstrates the problem.Marcus Adams

2 Answers

1
votes

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
votes

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