Module Drawing :: Class OutputLanguage
[hide private]
[frames] | no frames]

Class OutputLanguage

source code

Known Subclasses:
PostScript, SVG

OutputLanguage abstracts the drawing backend by providing abstract canvas operations.

This is the parent class for the specific backends; it should not be instantiated directly.



Instance Methods [hide private]
 
__init__(self) source code
 
translate(self, x, y)
Translate a block of drawing commands by the given x and y offsets.
source code
 
rotate(self, theta)
Rotate a block of drawing commands by the given angle CCW around the origin.
source code
 
stroke(self)
Return a path which will be stroked.
source code
 
fill(self)
Return a path which will be filled.
source code
 
write(self, str)
Write an uninterpreted raw string to the current output target.
source code
Method Details [hide private]

translate(self, x, y)

source code 

Translate a block of drawing commands by the given x and y offsets.

For example:

with out.translate(10,10):
   with out.stroke() as path:
     path.moveto(0,0)
     path.lineto(5,5)

rotate(self, theta)

source code 

Rotate a block of drawing commands by the given angle CCW around the origin.

For example:

with out.rotate(45):
   with out.stroke() as path:
     path.moveto(0,0)
     path.lineto(5,5)

stroke(self)

source code 

Return a path which will be stroked.

For example:

out.setgray(.5)
out.setlinewidth(2)
with out.stroke() as path:
  path.moveto(0, 0)
  path.lineto(5, 5)

fill(self)

source code 

Return a path which will be filled.

For example:

out.setgray(.5)
with out.fill() as path:
  path.moveto(0, 0)
  path.lineto(5, 5)
  path.lineto(10, 0)
  path.closepath()