Do Paths Work Yet?

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
bevbh
Posts: 5
Joined: Sat May 02, 2009 8:37 pm

Do Paths Work Yet?

Post by bevbh »

I just downloaded yesterday and tried to make a simple path but nothing draws. I tried various combinations of parameters for the stroke command and nothing happened. Took it out which should force a fill and still nothing drew.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

Paths work in the current version. Can you post your code?

bevbh
Posts: 5
Joined: Sat May 02, 2009 8:37 pm

Code sample

Post by bevbh »

I pared it down with no recursion.

Code: Select all

startshape SQUAREINSQUARE

rule SQUAREINSQUARE {

	ONESQUARE { }
	ONESQUARE {  x .75 y .75 s .25 }

	
}

path ONESQUARE {
	moveto { x 0.5  y 0.5 }
	lineto {  x  -0.5    y   0.5   }
	lineto {  x  -0.5    y  -0.5   }
	lineto {  x   0.5    y  -0.5   }
	closepoly {  }
	stroke { }
}


bevbh
Posts: 5
Joined: Sat May 02, 2009 8:37 pm

more info

Post by bevbh »

When I render this, there are no syntax errors, and it says 2 rules were loaded and there are 12 shapes. I don't understand why 12 shapes, I would guess 2 polygons or 8 lines.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

Context Free is case sensitive and all of the path operation are upper case

Code: Select all

startshape SQUAREINSQUARE 

rule SQUAREINSQUARE { 

   ONESQUARE { } 
   ONESQUARE {  x .75 y .75 s .25 } 

    
} 

path ONESQUARE { 
   MOVETO { x 0.5  y 0.5 } 
   LINETO {  x  -0.5    y   0.5   } 
   LINETO {  x  -0.5    y  -0.5   } 
   LINETO {  x   0.5    y  -0.5   } 
   CLOSEPOLY {  } 
   STROKE { } 
} 
That you got no error message is clearly a bug. If you fix the path operation names then you get two shapes, as expected.

bevbh
Posts: 5
Joined: Sat May 02, 2009 8:37 pm

Got a path to work

Post by bevbh »

I tried working on another image and got paths to work with arcto drawing ellipses. I uploaded it to the gallery. I was surprised to see that it uploaded the last version that I had saved rather than the version that was in my window at the time I uploaded. (I think it was the saved version, could have been some other random version. But the version on the screen at the time had the hue parameter removed from the DrawEllipse call.) Is that a feature or a bug?

bevbh
Posts: 5
Joined: Sat May 02, 2009 8:37 pm

Figured out my problem

Post by bevbh »

OK, the original problem was that my path commands, moveto, lineto, closepoly, etc were lower case. Changing them to uppercase fixed it. Would be nice to get some kind of error message for this, I'm not used to case sensitive languages.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Re: Got a path to work

Post by MtnViewJohn »

bevbh wrote:I tried working on another image and got paths to work with arcto drawing ellipses. I uploaded it to the gallery. I was surprised to see that it uploaded the last version that I had saved rather than the version that was in my window at the time I uploaded. (I think it was the saved version, could have been some other random version. But the version on the screen at the time had the hue parameter removed from the DrawEllipse call.) Is that a feature or a bug?
Sounds like a bug. We should ask people to save before uploading.

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

I played around with Context Free in Windows. It looks like the cfdg text that is uploaded to the gallery is that text that was present in the editor window when you hit the render button. So if you change the cfdg text after hitting render the changes won't be uploaded to the gallery. This is still a bug, but I think I'll delay fixing it until the next release. I'll list it as a known bug on the download page.

The work-around is to re-render the cfdg file before uploading to the gallery.

Post Reply