def cairo_skin_sick(cr, size=1.0): with cairo_save(cr): cr.scale(size, size) cairo_plot_rectangle(cr, -.5, -.5, 1, 1, fill_color=YELLOW, border_color=BLACK, border_width=0.005) w2 = 1.0 / 1.6 l = 1.0 / 3 cairo_plot_rectangle(cr, .5 - l, -w2 / 2, l, w2, fill_color=BLACK)
def cairo_robot_skin_tracked(cr, width=1.0, length=1.0): with cairo_save(cr): def track(): wheel(cr, w=length * .7, h=width / 3.0) with cairo_transform(cr, t=[0, -width / 2.0]): track() with cairo_transform(cr, t=[0, +width / 2.0]): track() cairo_plot_rectangle(cr, -length / 2.0, -width / 2.0, length, width, **CairoConstants.robot_body_style)
def cairo_robot_skin_rectangle(cr, w, h): """ A simple rectangle painted like the robot. """ with cairo_save(cr): cairo_plot_rectangle(cr, -w / 2.0, -h / 2.0, w, h, **CairoConstants.robot_body_style)