... and it looks like this is already provided with (from Cairo/src/cairo.jl):
function CairoImageSurface(img::Array{Uint32,2}, format::Integer; flipxy::Bool = true)
if flipxy
img = img'
end
w,h = size(img)
stride = format_stride_for_width(format, w)
@assert stride == 4w
ptr = ccall((:cairo_image_surface_create_for_data,_jl_libcairo),
Ptr{Void}, (Ptr{Void},Int32,Int32,Int32,Int32),
img, format, w, h, stride)
CairoSurface(ptr, w, h, img)
end
so you can construct and Image surface by provding your 2D array (Uint32).