Page 1 of 1

Empty path

Posted: Sat Jan 14, 2023 1:10 pm
by Flinx
For graphics that adjust to the window size, I got the error message "Cannot draw empty path!", which may be correct at this point, but not optimally worded in combination with IsPathEmpty(), I think. Or should IsPathEmpty() return a different result here?

Code: Select all

StartPath(1)
MoveTo(1, 1, 1)
LineTo(1, 1, 1)
LineTo(1, 1, 1)
ClosePath(1)
If Not IsPathEmpty(1)
	id=PathToBrush(Nil, {{ID=1, Color=#WHITE, X=9, Y=9}})
	FreePath(1)
	DisplayBrush(id, xpos, ypos, {Name="test"})
	FreeBrush(id)
EndIf
WaitLeftMouse
Ralf

Re: Empty path

Posted: Sat Jan 14, 2023 10:09 pm
by airsoftsoftwair
True, the wording is a bit confusing. For DrawPath() and PathToBrush() a path is empty in case there's nothing to draw. For IsPathEmpty() a path is empty if there are no vertices...

Re: Empty path

Posted: Sun Jan 15, 2023 9:53 pm
by Flinx
"Nothing to draw" would be a candidate for a better error message for me. But maybe it makes sense to just draw a dot?

Ralf

Re: Empty path

Posted: Sun Jan 29, 2023 6:30 pm
by airsoftsoftwair

Code: Select all

- Change: When using DrawPath() on a path whose width/height is 0, nothing will be drawn; in the case of
  PathToBrush(), you'll get a 1x1 fully transparent brush