Source code for gulik.patterns
# -*- coding: utf-8 -*-
import cairo
[docs]def stripe45(color):
"""
A tilable pattern with 45° stripes.
"""
surface = cairo.ImageSurface(cairo.Format.ARGB32, 10, 10)
context = cairo.Context(surface)
context.set_source_rgba(*color.tuple_rgba())
context.move_to(5, 5)
context.line_to(10, 0)
context.line_to(10, 5)
context.line_to(5, 10)
context.line_to(0, 10)
context.line_to(5, 5)
context.close_path()
context.fill()
context.move_to(0, 0)
context.line_to(5, 0)
context.line_to(0, 5)
context.close_path()
context.fill()
return surface