Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CairoContext from pointer only, #119

Merged
merged 2 commits into from
Sep 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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