Permalink
Browse files

modified: DisplayManX.lua

	modified:   OpenVGApp.lua
	modified:   egl_utils.lua
	renamed:    MouseInteractor.lua -> experimental/MouseInteractor.lua
	new file:   experimental/OMX_Core.lua
	new file:   experimental/OMX_IVCommon.lua
	new file:   experimental/OMX_Index.lua
	new file:   experimental/OMX_Types.lua
	new file:   experimental/OMX_Video.lua
	new file:   experimental/vc_vchi_gencmd_c.lua
	new file:   experimental/vc_vchi_gencmd_h.lua
	modified:   tests/test_tiger.lua
  • Loading branch information...
Wiladams committed Nov 10, 2012
1 parent 34bca99 commit 2a2094a92a9f0f1e18955e511705da2676d6998f
View
@@ -338,9 +338,9 @@ DMXDisplay_mt = {
resource = resource or DMXResource(width, height, pFormat);
- local win = DisplayManX.DMXView.new(self, x, y, width, height, layer, pFormat, resource, opacity)
-
- return win;
+ local view = DisplayManX.DMXView.new(self, x, y, width, height, layer, pFormat, resource, opacity)
+
+ return view;
end,
GetInfo = function(self)
@@ -558,13 +558,14 @@ local DMXView_mt = {
__index = DMXView,
}
-DMXView.new = function(display, x, y, width, height, layer, pformat, resource, opacity)
+DMXView.new = function(display, x, y, width, height, layer, pformat, resource, opacity, show)
x = x or 0
y = y or 0
layer = layer or 0
pformat = pformat or ffi.C.VC_IMAGE_RGB565
resource = resource or DMXResource(width, height, pformat);
opacity = opacity or 1.0;
+ show = show or true;
local obj = {
X = x;
@@ -578,7 +579,9 @@ DMXView.new = function(display, x, y, width, height, layer, pformat, resource, o
}
setmetatable(obj, DMXView_mt);
- obj:Show();
+ if show then
+ obj:Show();
+ end
return obj
end
@@ -609,31 +612,54 @@ DMXView.Show = function(self)
self.Surface = self.Display:CreateElement(dst_rect, self.Resource, src_rect, self.Layer, DISPMANX_PROTECTION_NONE, alpha);
end
+--[[
+ change_flags (bit 0 layer, bit 1 opacity, bit 2 dest rect, bit 3 src rect, bit 4 mask, bit 5 transform)
+--]]
+
+local CHANGE_SOURCE = 0x01;
+local CHANGE_DST_RECT = 0x02;
+local CHANGE_SRC_RECT = 0x04;
+local CHANGE_OPACITY = 0x08;
+
+local CHANGE_MASK = 0x10;
+local CHANGE_LAYER = 0x20;
+local CHANGE_TRANSFORM = 0x40;
+local CHANGE_INSERT_ABOVE = 0x80;
+
+local CHANGE_FLAGS = 0x100;
+local CHANGE_NOTHING = 0x200;
+
DMXView.MoveTo = function(self, x, y)
local update = DMXUpdate(10);
if not update then
return false;
end
+print("DMXView.MoveTo() - ", x, y, self.Width, self.Height);
- local dst_rect = VC_RECT_T(x, y, self.Width, self.Height);
+ local dst_rect = VC_RECT_T(0, 0, self.Width, self.Height);
local src_rect = VC_RECT_T( 0, 0, lshift(self.Width, 16), lshift(self.Height, 16) );
self.X = x;
self.Y = y;
- local change_flags = 0;
+ local change_flags = bor(CHANGE_DST_RECT, CHANGE_SRC_RECT);
local mask = 0;
local transform = self.Transform or ffi.C.VC_IMAGE_ROT0;
- DisplayManX.element_change_attributes(update.Handle, self.Handle,
+print("change_flags: ", change_flags);
+
+ local success, err = DisplayManX.element_change_attributes(update.Handle, self.Surface.Handle,
change_flags,
self.Layer,
self.Opacity,
- dest_rect, src_rect,
+ dest_rect,
+ src_rect,
mask,
transform);
+--print("DMXView:MoveTo(), ", success, err);
+
update:SubmitSync();
end
@@ -642,7 +668,6 @@ end
DisplayManX.DMXPixelData = DMXPixelData;
---DisplayManX.DMXPixelBuffer = DMXPixelBuffer;
DisplayManX.DMXView = DMXView;
View
@@ -22,7 +22,7 @@ local VG = EGL.Lib;
OpenVGApp = {}
-OpenVGApp.init = function(width, height)
+OpenVGApp.init = function(width, height, x, y)
width = width or 640;
height = height or 480;
@@ -36,7 +36,7 @@ OpenVGApp.init = function(width, height)
OpenVGApp.Keyboard.OnKeyUp = OpenVGApp.KeyUp;
-- Create the Main Window
- OpenVGApp.Window = EGL.Window.new(width, height, nil, EGL.EGL_OPENVG_API);
+ OpenVGApp.Window = EGL.Window.new(width, height, x,y, nil, EGL.EGL_OPENVG_API);
return OpenVGApp;
end
View
@@ -172,23 +172,28 @@ the lowest level window 'handle'. EGL then
uses this handle to create a managed 'window'.
--]]
-local function createNativeWindow(dmxdisplay, width, height)
+local function createNativeView(dmxdisplay, width, height, x, y, level)
+ x = x or 0
+ y = y or 0
+ level = level or 0
- local dst_rect = VC_RECT_T(0,0,width, height);
+ local dst_rect = VC_RECT_T(x,y,width, height);
local src_rect = VC_RECT_T(0,0, lshift(width, 16), lshift(height,16));
--local alpha = VC_DISPMANX_ALPHA_T(ffi.C.DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS,255,0);
- --local dmxview = dmxdisplay:CreateElement(dst_rect, nil, src_rect, 0, DISPMANX_PROTECTION_NONE, alpha);
- local dmxview = dmxdisplay:CreateElement(dst_rect, nil, src_rect);
- assert(dmxview, "FAILURE: Did not create dmxview");
+ --local view = dmxdisplay:CreateElement(dst_rect, nil, src_rect, 0, DISPMANX_PROTECTION_NONE, alpha);
+ --local view = dmxdisplay:CreateElement(dst_rect, nil, src_rect);
+ local view = dmxdisplay:CreateView(width, height, x,y, level);
+
+ assert(view, "FAILURE: Did not create element");
-- create an EGL window surface
local nativewindow = ffi.new("EGL_DISPMANX_WINDOW_T");
- nativewindow.element = dmxview.Handle;
+ nativewindow.element = view.Surface.Handle;
nativewindow.width = width;
nativewindow.height = height;
- return nativewindow, dmxview;
+ return nativewindow, view;
end
@@ -197,11 +202,14 @@ local EGLWindow_mt = {
__index = EGLWindow,
}
-EGLWindow.new = function(width, height, config, api)
-
+EGLWindow.new = function(width, height, x, y, config, api)
+ x = x or 0
+ y = y or 0
config = config or {background = {153, 153, 153}};
local obj = {
+ X = x;
+ Y = y;
Width = width;
Height = height;
}
@@ -211,7 +219,7 @@ EGLWindow.new = function(width, height, config, api)
-- create nativewindow
local dmxdisplay = DMX.DMXDisplay();
- obj.NativeWindow, obj.NativeElement = createNativeWindow(dmxdisplay, width, height);
+ obj.NativeWindow, obj.NativeView = createNativeView(dmxdisplay, width, height, x, y);
-- create window surface
obj.Surface = obj.Display:CreateWindowSurface(obj.NativeWindow);
@@ -244,6 +252,17 @@ EGLWindow.SwapBuffers = function(self)
self.Display:SwapBuffers();
end
+EGLWindow.MoveTo = function(self, x, y)
+ self.NativeView:MoveTo(x,y);
+ self.X = x;
+ self.Y = y;
+
+ --self:SwapBuffers();
+end
+
+
+
+
EGL.Display = EglDisplay
EGL.Window = EGLWindow;
File renamed without changes.
Oops, something went wrong.

0 comments on commit 2a2094a

Please sign in to comment.