Skip to content

Instantly share code, notes, and snippets.

@stuaxo
Created August 8, 2015 13:37
Show Gist options
  • Select an option

  • Save stuaxo/453e460797096c37bb41 to your computer and use it in GitHub Desktop.

Select an option

Save stuaxo/453e460797096c37bb41 to your computer and use it in GitHub Desktop.
Draw a yellow rectangle in cairocffi
# coding: utf-8
# In[12]:
# draw a yellow rectangle with cairocffi
import cairocffi as cairo
im = cairo.ImageSurface(cairo.FORMAT_ARGB32, 512, 512)
ctx = cairo.Context(im)
ctx.set_source_rgb (1., 1., 0.)
ctx.rectangle(0, 0, 256,256)
ctx.fill()
im.write_to_png("yellow-rectangle.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment