Vectorgraphics

Report any Hollywood bugs here
Post Reply
User avatar
lazi
Posts: 382
Joined: Thu Feb 24, 2011 11:08 pm

Vectorgraphics

Post by lazi » Sun Aug 07, 2016 11:44 pm

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.

User avatar
airsoftsoftwair
Posts: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Vectorgraphics

Post by airsoftsoftwair » Thu Aug 11, 2016 4:05 pm

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

User avatar
lazi
Posts: 382
Joined: Thu Feb 24, 2011 11:08 pm

Re: Vectorgraphics

Post by lazi » Sun Aug 14, 2016 9:04 am

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.

User avatar
lazi
Posts: 382
Joined: Thu Feb 24, 2011 11:08 pm

Re: Vectorgraphics

Post by lazi » Sun Aug 14, 2016 9:14 am

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:
Image

User avatar
airsoftsoftwair
Posts: 3355
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Vectorgraphics

Post by airsoftsoftwair » Sun Aug 14, 2016 9:08 pm

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" :)

Post Reply