Skip to content

Commit

Permalink
Merge pull request #119 from lobingera/new_canvas
Browse files Browse the repository at this point in the history
CairoContext from pointer only,
  • Loading branch information
timholy committed Sep 13, 2015
2 parents 3ca577c + 9971cd5 commit 1e6d7c3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Cairo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ type CairoSurface <: GraphicsDevice
finalizer(self, destroy)
self
end
function CairoSurface(ptr::Ptr{Void})
self = new(ptr)
#finalizer(self, destroy)
self
end



end

width(surface::CairoSurface) = surface.width
Expand Down Expand Up @@ -339,6 +347,18 @@ type CairoContext <: GraphicsContext
finalizer(self, destroy)
self
end
function CairoContext(ptr::Ptr{Void})
surface_p = ccall((:cairo_get_target,_jl_libcairo),
Ptr{Void}, (Ptr{Void},), ptr)
surface = CairoSurface(surface_p)
layout = ccall((:pango_cairo_create_layout,_jl_libpangocairo),
Ptr{Void}, (Ptr{Void},), ptr)
self = new(ptr,surface,layout)
#finalizer(self, destroy)
self
end


end

creategc(s::CairoSurface) = CairoContext(s)
Expand Down

0 comments on commit 1e6d7c3

Please sign in to comment.