Skip to content

Instantly share code, notes, and snippets.

@gschanuel
Created June 11, 2018 15:46
Show Gist options
  • Save gschanuel/7928f19a8abfdeb69615bb3f16cc7a78 to your computer and use it in GitHub Desktop.
Save gschanuel/7928f19a8abfdeb69615bb3f16cc7a78 to your computer and use it in GitHub Desktop.
function draw_line_in_circle(offset, length, width, degree)
cairo_set_line_width(cr, width)
point = (math.pi / -180) * degree
start_x = 0 + (offset * math.sin(point))
start_y = 0 - (offset * math.cos(point))
end_x = 0 + ((offset + length) * math.sin(point))
end_y = 0 - ((offset + length) * math.cos(point))
cairo_move_to(cr, start_x + center_x, start_y + center_y)
cairo_line_to(cr, end_x + center_x, end_y + center_y)
cairo_set_source_rgb (cr, 0, 10, 10);
cairo_stroke(cr)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment