Author Topic: Bgrabitmap draw psDot/psDash line without antialiassing  (Read 347 times)


  • Jr. Member
  • **
  • Posts: 72
Bgrabitmap draw psDot/psDash line without antialiassing
« on: April 01, 2020, 01:50:40 pm »

I've noticed that when I want to draw a dash line in bgrabitmap that I need to use the antialias function.

Code: Pascal  [Select][+][-]
  1. Bitmap.PenStyle := psDash;
  3. // Gives me a nice dash line, but is a lot slower than below
  4. Bitmap.DrawPolyLineAntialias([Point(0,50), Point(Bitmap.Width,50)], BGRA(0,255,0), 1,3,True,65535);
  6. // Is fast, but only gives me a solid line
  7. Bitmap.DrawPolyLine([Point(0,55), Point(Bitmap.Width,55)],  BGRA(255,255,0), False, dmSet);
  8. Bitmap.DrawLine(0,60, Bitmap.Width,60, BGRA(0,255,0), False, dmSet);

I only need to draw simple straight horizontal and vertical dash lines, the AA version is more than 100 times slower, so would like to use a procedure without. Is that possible?

Best regards,



  • Hero Member
  • *****
  • Posts: 3341
    • Personal webpage
Re: Bgrabitmap draw psDot/psDash line without antialiassing
« Reply #1 on: April 01, 2020, 11:32:59 pm »
Hmmm, I suppose the antialias version can be optimized. The aliased version here is not necessary because the lines are horizontal and vertical.

For this, you could easily write your own procedure. Basically you can achieve what you want by calling HorizLine and VertLine functions with alternating colors.

Tell me if you come up with something, maybe I can add it to next version of BGRABitmap.
Conscience is the debugger of the mind


TinyPortal © 2005-2018