Page 1 of 1
Vectorgraphics
Posted: Sun Aug 07, 2016 11:44 pm
by lazi
Code: Select all
StartPath(1)
LineTo(1,100,100)
DebugPrint(IsPathEmpty(1))
DrawPath(1,0,0,#YELLOW)
IsPathEmpty returns FALSE because the LineTo is inserted into the path however DrawPath cannot draw that and fails with "Cannot draw empty path".
In this case I cannot check if the path is drawable.
Re: Vectorgraphics
Posted: Thu Aug 11, 2016 4:05 pm
by airsoftsoftwair
I think this is a bug in your code because you use LineTo() without having defined a current point. Note that StartPath() doesn't define a current point, as per the documentation:
Once the new path is created, you should first define a current point for the path by calling the MoveTo() command. After that, you can start adding vertices to the path
See:
StartPath() doc
Re: Vectorgraphics
Posted: Sun Aug 14, 2016 9:04 am
by lazi
I made a DR2D to Hollywood path importer and I made no sanity checks in there.
So You are right, a missing MoveTo can be handled.
Anyway a bit misleading the error message: "Cannot draw empty path" in that condition.
After one sees that it is obvious that brings
IsPathEmpty() to check against the error. But it says no, it is not empty. A bit illogical to me.
Re: Vectorgraphics
Posted: Sun Aug 14, 2016 9:14 am
by lazi
A small graphics glitch which I called by "Evil-M".
The same is happen with some other vectorgraphics softwares too, so I do not know if it is an easily solvable bug or a side effect of the used algorithm.
Code: Select all
SetFillStyle(#FILLGRADIENT,#LINEAR,#RED,#YELLOW)
SetFormStyle(#EDGE,#WHITE,2)
SetFormStyle(#ANTIALIAS)
SetFont(#SANS,50)
StartPath(1)
MoveTo(1,0,0)
AddTextToPath(1,"M")
ClosePath(1)
DrawPath(1,#CENTER,#CENTER,#WHITE,{scalex=2,scaley=2})
WaitLeftMouse
It look like this:
Re: Vectorgraphics
Posted: Sun Aug 14, 2016 9:08 pm
by airsoftsoftwair
Yes, this is related to the edging algorithm. It's not a bug. You can see the same thing in the "VectorTest" example. Click on "T" to show the "Hollywood" text, then press "+" to increase the border width.... you'll then see an "Evil W"