Windows drawing issue: Triangle point up is crisp, point down is anti-aliased

I’m doing some drawing in Windows and I’ve run into a weird issue.
I draw a triangle, simple enough.

Drawing it with the point up, I get a nice clean, crisp triangle.
Drawing it point down, I get a weird anti-aliased effect on the flat side of the triangle.

I’m not quite sure why it would behave that way, maybe there’s a better way to draw it?
Does anybody have any suggestions / ideas?

Screenshots:

Code:

  dim ariPoints(6) as Integer
  if iDirection = 0 then // point up
    ariPoints(1) = 5
    ariPoints(2) = 0 // Top point
    ariPoints(3) = 9
    ariPoints(4) = 5 // Btm right
    ariPoints(5) = 0
    ariPoints(6) = 5 // Btm left
    
  elseif iDirection = 1 then // point down
    ariPoints(1) = 5
    ariPoints(2) = 4 // Btm point
    ariPoints(3) = 9
    ariPoints(4) = 0 // Top right
    ariPoints(5) = 0
    ariPoints(6) = 0 // Top left
  end
  
  g.FillPolygon(ariPoints)

Why don’t you use fonts ?

That won’t solve the drawing mystery, though.

Oh I hadn’t thought of that, quite clever!
What font/character should I use? I don’t see any arrow directions on asciitable.com but I’m pretty sure they exist.

9x5px

http://www.fileformat.info/info/unicode/char/25bc/index.htm

System should display it just fine with font fallback.

The symbol is present in Lucida Grande.

If you need it cross platform I will have a look on Windows.

I only need it on Windows actually :slight_smile:

Under OSX it anti-alias the sides (which I would expect)… but Jean-Paul is correct, your orignal code mades a lop-sided arrow,

but also setting ANTIALIAS=false makes a black only triangle

Windings 3 Regular on all versions &uF070 and &uF071

Segoe UI Symbol &u25B2 and &u25BC on Windows 10 .

I’ve solved it, but not the way I’d hoped. I’m using the triangle drawing code, as I can’t rely on fonts being installed (I have no idea the reach this could go.) Plus the triangle that better represents the shape I need wasn’t part of unicode until 2014 and doesn’t exist in the font that Xojo on Windows uses for System. (the symbol)

I turned anti-aliasing off to find that point down, it drew better with the point at 4px instead of 5px from the left. It could be related to points/positioning within Xojo - but I do not know.

I literally spent the last 10 minutes adjusting points and re-trying to get it to look right. I cheated the anti-aliased flat side by drawing it -1px off the top so it gets cut off.

Wingdings has been present in Windows since XP and there is no indication it will be removed.

The advantage of fonts is that in Retina mode they are automatically at the max resolution.

Good to know! Thanks :slight_smile:

Thanks to everyone who helped me with this!

Tim, if your area is 9x5, the coordinates go from 0 to 8 on the X axis, Not 9… And yes, the halfway point is 4.