Home / Lua API Manual / types / dt_lua_cairo_t
< dt_lua_backgroundjob_t
dt_lua_ellipsize_mode_t >

# dt_lua_cairo_t

`dt_type`

A wrapper around a cairo drawing context. You probably shouldn’t use this after the callback that got it passed returned. For more details of the member functions have a look at the cairo documentation for the drawing context, transformations and paths.

# 🔗dt_lua_cairo_t.save

    self:function(
    )

Save the state of the drawing context.

- self - types.dt_lua_cairo_t - The context to modify.

# 🔗types.dt_lua_cairo_t.restore

    self:function(
    )

Restore a previously saved state.

- self - types.dt_lua_cairo_t - The context to modify.

# 🔗dt_lua_cairo_t.move_to

    self:function(
      x : float,
      y : float
    )

Begin a new sub-path.

- self - types.dt_lua_cairo_t - The context to modify
- x - float - The x coordinate of the new position.
- y - float - The y coordinate of the new position.

# 🔗dt_lua_cairo_t.line_to

    self:function(
      x : float,
      y : float
    )

Add a line to the path.

- self - types.dt_lua_cairo_t - The context to modify.
- x - float - The x coordinate of the end of the new line.
- y - float - The y coordinate of the end of the new line.

# 🔗types.dt_lua_cairo_t.rectangle

    self:function(
      x : float,
      y : float,
      width : float,
      height : float
    )

Add a closed sub-path rectangle.

- self - types.dt_lua_cairo_t - The context to modify.
- x - float - The x coordinate of the top left corner of the rectangle.
- y - float - The y coordinate of the top left corner of the rectangle.
- width - float - The width of the rectangle.
- height - float - The height of the rectangle.

# 🔗dt_lua_cairo_t.arc

    self:function(
      x : float,
      y : float,
      radius : float,
      angle1 : float,
      angle2 : float
    )

Add a circular arc.

- self - types.dt_lua_cairo_t - The context to modify.
- x - float - The x position of the center of the arc.
- y - float - The y position of the center of the arc.
- radius - float - The radius of the arc.
- angle1 - float - The start angle, in radians.
- angle2 - float - The end angle, in radians.

# 🔗dt_lua_cairo_t.arc_negative

    self:function(
      x : float,
      y : float,
      radius : float,
      angle1 : float,
    angle2 : float
    )

Add a circular arc. It only differs in the direction from types.dt_lua_cairo_t.arc.

- self - types.dt_lua_cairo_t - The context to modify.
- x - float - The x position of the center of the arc.
- y - float - The y position of the center of the arc.
- radius - float - The radius of the arc.
- angle1 - float - The start angle, in radians.
- angle2 - float - The end angle, in radians.

# 🔗dt_lua_cairo_t.rotate

    self:function(
      angle : float
    )

Add a rotation to the transformation matrix.

- self - types.dt_lua_cairo_t - The context to modify.
- angle - float - The angle (in radians) by which the user-space axes will be rotated.

# 🔗dt_lua_cairo_t.scale

    self:function(
      x : float,
      y : float
    )

Add a scaling to the transformation matrix.

self** - _types.dt_lua_cairo_t_ - The context to modify.

- x - float - The scale factor for the x dimension.
- y - float - The scale factor for the y dimension.

# 🔗dt_lua_cairo_t.translate

    self:function(
      x : float,
      y : float
    )

Add a translation to the transformation matrix.

- self - types.dt_lua_cairo_t - The context to modify.
- x - float - Amount to translate in the x direction
- y - float - Amount to translate in the y direction

# 🔗dt_lua_cairo_t.new_sub_path

    self:function(
    )

Begin a new sub-path.

- self - types.dt_lua_cairo_t - The context to modify.

# 🔗dt_lua_cairo_t.draw_line

    self:function(
      x_start : float,
      y_start : float,
      x_end : float,
      y_end : float
    )

Helper function to draw a line with a given start and end.

- self - types.dt_lua_cairo_t - The context to modify.
- x_start - float - The x coordinate of the start of the new line.
- y_start - float - The y coordinate of the start of the new line.
- x_end - float - The x coordinate of the end of the new line.
- y_end - float - The y coordinate of the end of the new line.

< dt_lua_backgroundjob_t
dt_lua_ellipsize_mode_t >