Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/cairo_colors.py
blob: f26acddd2526ff1d25b5c6320077765e0ba0ab4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cairo
import array

width = 50
# green
color = 255 * 256 + 0xff000000

# blue
color = 255 + 0xff000000

# red
color = 255 * 65536 + 0xff000000

pixels = array.array('I', [color] * (width * width))

surface = cairo.ImageSurface.create_for_data(pixels, cairo.FORMAT_ARGB32, width, width)
surface.write_to_png('/tmp/test1.png')