Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Vectorize
- class Surface
- extend FFI::Library
- # TODO: How to make this portable?
- ffi_lib "/usr/X11/lib/libcairo.dylib"
- attach_function :cairo_create, [:pointer], :pointer
- CAIRO_FORMAT_INVALID = -1
- CAIRO_FORMAT_ARGB32 = 0
- CAIRO_FORMAT_RGB24 = 1
- CAIRO_FORMAT_A8 = 2
- CAIRO_FORMAT_A1 = 3
- CAIRO_FORMAT_RGB16_565 = 4
- attr_reader :surface_pointer
- attr_reader :context_pointer
- def context
- @context_pointer ||= self.class.cairo_create(surface_pointer)
- end
- end
- end
Add Comment
Please, Sign In to add comment