summaryrefslogtreecommitdiffstats
path: root/lib/efl/evas.rb
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2011-05-04 23:42:07 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2011-05-04 23:42:07 +0200
commite4baccaefd209a25daa3ff8d5277fe86aca1d379 (patch)
treeeb2744b7a8624a7538cb0224d40879074c819653 /lib/efl/evas.rb
parent3974ea1fb3734cbf4150c759eebdf8a93d77dc8b (diff)
downloadffi-efl-seperate-natives.zip
ffi-efl-seperate-natives.tar.gz
FFI are in separate namespaces (Efl::Evas::Native), ruby classes are in upper level (Efl::Evas)seperate-natives
Diffstat (limited to 'lib/efl/evas.rb')
-rw-r--r--lib/efl/evas.rb96
1 files changed, 50 insertions, 46 deletions
diff --git a/lib/efl/evas.rb b/lib/efl/evas.rb
index a99f652..4637ae3 100644
--- a/lib/efl/evas.rb
+++ b/lib/efl/evas.rb
@@ -1,56 +1,60 @@
#! /usr/bin/env ruby
# -*- coding: UTF-8 -*-
#
-require 'efl/ffi/evas'
+require 'efl/native/evas'
#
module Efl
#
module Evas
#
+ module Native
+ #
+ callback :new_update_region_cb, [:int, :int, :int, :int, :int_p], :pointer
+ callback :free_update_region_cb, [:int, :int, :int, :int, :pointer], :void
+ #
+ class EngineInfoStruct < FFI::Struct
+ layout :magic, :int
+ end
+ class EngineInfoBufferFuncStruct < FFI::Struct
+ layout :new_update_region, :new_update_region_cb,
+ :free_update_region, :free_update_region_cb
+ end
+ class EngineInfoBufferInfoStruct < FFI::Struct
+ layout :depth_type, :int,
+ :dest_buffer, :pointer,
+ :dest_buffer_row_bytes, :int,
+ :use_color_key, :char,
+ :alpha_threshold, :int,
+ :color_key_r, :int,
+ :color_key_g, :int,
+ :color_key_b, :int,
+ :func, EngineInfoBufferFuncStruct
+ end
+ class EngineInfoBufferStruct < FFI::Struct
+ layout :magic, EngineInfoStruct,
+ :info, EngineInfoBufferInfoStruct,
+# :func, EvasEngineInfoBufferFunc,
+ :mode, :evas_engine_render_mode
+ end
+ #
+ end
+ #
EVAS_ENGINE_BUFFER_DEPTH_ARGB32 = 0
EVAS_ENGINE_BUFFER_DEPTH_BGRA32 = 1
EVAS_ENGINE_BUFFER_DEPTH_RGB24 = 2
EVAS_ENGINE_BUFFER_DEPTH_BGR24 = 3
EVAS_ENGINE_BUFFER_DEPTH_RGB32 = 4
#
- callback :new_update_region_cb, [:int, :int, :int, :int, :int_p], :pointer
- callback :free_update_region_cb, [:int, :int, :int, :int, :pointer], :void
- #
- class EngineInfoStruct < FFI::Struct
- layout :magic, :int
- end
- class EngineInfoBufferFuncStruct < FFI::Struct
- layout :new_update_region, :new_update_region_cb,
- :free_update_region, :free_update_region_cb
- end
- class EngineInfoBufferInfoStruct < FFI::Struct
- layout :depth_type, :int,
- :dest_buffer, :pointer,
- :dest_buffer_row_bytes, :int,
- :use_color_key, :char,
- :alpha_threshold, :int,
- :color_key_r, :int,
- :color_key_g, :int,
- :color_key_b, :int,
- :func, EngineInfoBufferFuncStruct
- end
- class EngineInfoBufferStruct < FFI::Struct
- layout :magic, EngineInfoStruct,
- :info, EngineInfoBufferInfoStruct,
-# :func, EvasEngineInfoBufferFunc,
- :mode, :evas_engine_render_mode
- end
- #
class REvas
#
include Efl::ClassHelper
- proxy_list [Efl::Evas,'evas_'].freeze
+ proxy_list [Efl::Evas::Native,'evas_'].freeze
#
def initialize o=nil
@ptr = (
case o
when NilClass
- FFI::AutoPointer.new Efl::Evas.evas_new, REvas.method(:release)
+ FFI::AutoPointer.new Native.evas_new, REvas.method(:release)
when FFI::Pointer
o
else
@@ -60,7 +64,7 @@ module Efl
yield self if block_given?
end
def self.release p
- Efl::Evas.evas_free p unless p.nil?
+ Native.evas_free p unless p.nil?
end
def free
@ptr.autorelease=false if @ptr.is_a? FFI::AutoPointer
@@ -68,14 +72,14 @@ module Efl
@ptr=nil
end
def object_add t
- r = Efl::Evas::REvasObject.new Efl::Evas.send "evas_object_#{t.to_s}_add", @ptr
+ r = Evas::REvasObject.new Native.send "evas_object_#{t.to_s}_add", @ptr
yield r if block_given?
r
end
def output_size_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
- Efl::Evas.evas_output_size_get @ptr, x, y
+ Native.evas_output_size_get @ptr, x, y
[ x.read_int, y.read_int ]
end
alias :size :output_size_get
@@ -84,19 +88,19 @@ module Efl
y = FFI::MemoryPointer.new :int
w = FFI::MemoryPointer.new :int
h = FFI::MemoryPointer.new :int
- Efl::Evas.evas_output_viewport_get @ptr, x, y, w, h
+ Native.evas_output_viewport_get @ptr, x, y, w, h
[ x.read_int, y.read_int, w.read_int, h.read_int ]
end
def pointer_output_xy_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
- Efl::Evas.evas_pointer_output_xy_get @ptr, x, y
+ Native.evas_pointer_output_xy_get @ptr, x, y
[ x.read_int, y.read_int ]
end
def pointer_canvas_xy_get
x = FFI::MemoryPointer.new :int
y = FFI::MemoryPointer.new :int
- Efl::Evas.evas_pointer_canvas_xy_get @ptr, x, y
+ Native.evas_pointer_canvas_xy_get @ptr, x, y
[ x.read_int, y.read_int ]
end
end
@@ -104,13 +108,13 @@ module Efl
class REvasObject
#
include Efl::ClassHelper
- proxy_list [Efl::Evas,'evas_object_'].freeze, [Efl::Evas,'evas_'].freeze
+ proxy_list [Efl::Evas::Native,'evas_object_'].freeze, [Efl::Evas::Native,'evas_'].freeze
#
def initialize o=nil
@ptr = (
case o
when NilClass
- FFI::AutoPointer.new Efl::Evas.evas_new, REvasObject.method(:release)
+ FFI::AutoPointer.new Native.evas_new, REvasObject.method(:release)
when FFI::Pointer
o
else
@@ -120,7 +124,7 @@ module Efl
yield self if block_given?
end
def self.release p
- Efl::Evas.evas_object_del p unless p.nil?
+ Native.evas_object_del p unless p.nil?
end
def free
@ptr.autopointer=false if @ptr.is_a? FFI::AutoPointer
@@ -132,7 +136,7 @@ module Efl
y = FFI::MemoryPointer.new :int
w = FFI::MemoryPointer.new :int
h = FFI::MemoryPointer.new :int
- Efl::Evas.evas_object_geometry_get @ptr, x, y, w, h
+ Native.evas_object_geometry_get @ptr, x, y, w, h
[ x.read_int, y.read_int, w.read_int, h.read_int ]
end
alias :geometry :geometry_get
@@ -140,27 +144,27 @@ module Efl
geometry_get[2..-1]
end
def size= wh
- Efl::Evas.evas_object_resize @ptr, *wh
+ Native.evas_object_resize @ptr, *wh
end
def color_get
r = FFI::MemoryPointer.new :int
g = FFI::MemoryPointer.new :int
b = FFI::MemoryPointer.new :int
a = FFI::MemoryPointer.new :int
- Efl::Evas.evas_object_color_get @ptr, r, g, b, a
+ Native.evas_object_color_get @ptr, r, g, b, a
[ r.read_int, g.read_int, b.read_int, a.read_int ]
end
alias :color :color_get
def evas_get
- REvas.new Efl::Evas.evas_object_evas_get @ptr
+ REvas.new Native.evas_object_evas_get @ptr
end
alias :evas :evas_get
def above_get
- REvasObject.new Efl::Evas.evas_object_above_get @ptr
+ REvasObject.new Native.evas_object_above_get @ptr
end
alias :above :above_get
def below_get
- REvasObject.new Efl::Evas.evas_object_below_get @ptr
+ REvasObject.new Native.evas_object_below_get @ptr
end
alias :below :below_get
end