Firemonkey (FMX) bitmap and colours

倾然丶 夕夏残阳落幕 提交于 2019-12-03 23:27:12

FMX use antialiazing for drawing. If you would like draw line without blur effect you should use special function for pixel alignment:

  • TCanvas.AlignToPixel
  • TCanvas.AlignToPixelVertically
  • TCanvas.AlignToPixelHorizontally

This functions automatically calculate pixel position for drawing without blur.

Thank you

The colors in the example are anti-aliased, meaning they're part the color you set, and part the background color. The precise ratio is based on many considerations done behind the scenes.

Not familiar with FireMonkey(or delphi), so I can't tell you if there's a way around it, but if you want to know where a certain color lands what you could do is test the ratios between RGB values, that's assuming you draw only one line on a black background(otherwise, the ratios must be a range to catch pixels with large amounts of noise)

example: yellow(#ffff00)

red/green=1

red/blue=green/blue=#inf(or if you want, 255/1=255)

a sampled pixel could be #fcfc00 maintaining the ratios

a sampled pixel with noise could be #fcff09 has

red/green=0.988

red/blue=28

green/blue=28.33

red and green are still pretty close and both much higher than blue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!