# ``igraph`.`drawing`.`shapes`.`ShapeDrawer``

class documentation

`class ShapeDrawer: (source)`

Known subclasses: `igraph.drawing.shapes.CircleDrawer`, `igraph.drawing.shapes.DiamondDrawer`, `igraph.drawing.shapes.DownTriangleDrawer`, `igraph.drawing.shapes.NullDrawer`, `igraph.drawing.shapes.RectangleDrawer`, `igraph.drawing.shapes.UpTriangleDrawer`

View In Hierarchy

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.

Static Method | `draw_path` | Draws the path of the shape on the given Cairo context, without stroking or filling it.
Static Method | `intersection_point` | Determines where the shape centered at (center_x, center_y) intersects with a line drawn from (source_x, source_y) to (center_x, center_y).

@staticmethod
@abstractmethod
def draw_path(ctx, center_x, center_y, width, height=None, **kwargs): (source)
overridden in `igraph.drawing.shapes.CircleDrawer`, `igraph.drawing.shapes.DiamondDrawer`, `igraph.drawing.shapes.DownTriangleDrawer`, `igraph.drawing.shapes.NullDrawer`, `igraph.drawing.shapes.RectangleDrawer`, `igraph.drawing.shapes.UpTriangleDrawer`

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
center_x | the X coordinate of the center of the object
center_y | the Y coordinate of the center of the object
width | the width of the object
height | the height of the object. If `None`, equals to the width.
**kwargs | Undocumented

@staticmethod
def intersection_point(center_x, center_y, source_x, source_y, width, height=None): (source)
overridden in `igraph.drawing.shapes.CircleDrawer`, `igraph.drawing.shapes.DiamondDrawer`, `igraph.drawing.shapes.DownTriangleDrawer`, `igraph.drawing.shapes.RectangleDrawer`, `igraph.drawing.shapes.UpTriangleDrawer`

Determines where the shape centered at (center_x, center_y) intersects with a line drawn from (source_x, source_y) to (center_x, center_y).

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

Parameters
center_x | Undocumented
center_y | Undocumented
source_x | Undocumented
source_y | Undocumented
width | the width of the shape
height | the height of the shape. If `None`, defaults to the width

Returns
the intersection point (the closest to (source_x, source_y) if there are more than one) or (center_x, center_y) if there is no intersection