Package igraph :: Module drawing :: Class ShapeDrawer
[hide private]
[frames] | no frames]

Class ShapeDrawer

object --+
         |
        ShapeDrawer
Known Subclasses:

Static class, the ancestor of all vertex shape drawer classes.

Custom shapes must implement at least the draw_path method of the class. The method must not stroke or fill, it should just set up the current Cairo path appropriately.

Instance Methods [hide private]

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Static Methods [hide private]
 
draw_path(ctx, cx, cy, w, h=None)
Draws the path of the shape on the given Cairo context, without stroking or filling it.
 
intersection_point(cx, cy, sx, sy, w, h=None)
Determines where the shape centered at (cx, cy) intersects with a line drawn from (sx, sy) to (cx, cy).
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

draw_path(ctx, cx, cy, w, h=None)
Static Method

 

Draws the path of the shape on the given Cairo context, without stroking or filling it.

This method must be overridden in derived classes implementing custom shapes and declared as a static method using staticmethod(...).

Parameters:
  • ctx - the context to draw on
  • cx - the X coordinate of the center of the object
  • cy - the Y coordinate of the center of the object
  • w - the width of the object
  • h - the height of the object. If None, equals to the width.

intersection_point(cx, cy, sx, sy, w, h=None)
Static Method

 

Determines where the shape centered at (cx, cy) intersects with a line drawn from (sx, sy) to (cx, cy).

Can be overridden in derived classes. Must always be defined as a static method using staticmethod(...)

Parameters:
  • w - the width of the shape
  • h - the height of the shape. If None, defaults to the width
Returns:
the intersection point (the closest to (sx, sy) if there are more than one) or (cx, cy) if there is no intersection