Recent

Author Topic: setPixelF for float coordinates  (Read 1132 times)

winni

  • Hero Member
  • *****
  • Posts: 3197
setPixelF for float coordinates
« on: May 02, 2020, 12:15:07 am »
Hi!

It often bothered me, that BGRAbitmap has a getpixel for float coordinates but not a setpixel.

After some thinking I came to a bloody simple solution:

Code: Pascal  [Select][+][-]
  1. procedure SetPixelF (dest: TBGRAbitmap; P: TPointF; col: TBGRApixel);
  2. begin
  3.  dest.FillRectAntialias(P.x-0.5, P.y-0.5, P.x+0.5, P.y+0.5, col,true);
  4. end;
  5.  

Yes - a hardrock solution with perhaps too much overhead - but it works.
In case of heavy use you can inline it.

Winni
 

circular

  • Hero Member
  • *****
  • Posts: 4471
    • Personal webpage
Re: setPixelF for float coordinates
« Reply #1 on: May 02, 2020, 11:16:47 am »
Ok I understand what effect you would like.

I've added DrawPixelF, ErasePixelF and AlphaPixelF on dev branch.
Conscience is the debugger of the mind

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: setPixelF for float coordinates
« Reply #2 on: May 02, 2020, 04:03:10 pm »
That's nice!

Thanx
Winni

 

TinyPortal © 2005-2018