Permalink
Please sign in to comment.
Browse files
modified: OpenVGApp.lua
modified: bcm_host.lua renamed: interface/common.lua -> common.lua renamed: interface/connection.lua -> connection.lua renamed: freetype.lua -> experimental/freetype.lua modified: media/desktop.ppm renamed: interface/message.lua -> message.lua deleted: test_bcm_host.lua modified: test_snapshot.lua new file: tests/snapper.lua renamed: test_dispmanx.lua -> tests/test_dispmanx.lua renamed: test_egl.lua -> tests/test_egl.lua renamed: test_egl_vg_window.lua -> tests/test_egl_vg_window.lua renamed: test_egl_window.lua -> tests/test_egl_window.lua renamed: test_egles_basic.lua -> tests/test_egles_basic.lua renamed: test_enumdispman.lua -> tests/test_enumdispman.lua renamed: test_picast.lua -> tests/test_picast.lua renamed: test_tiger.lua -> tests/test_tiger.lua renamed: test_triangle.lua -> tests/test_triangle.lua renamed: test_window_basic.lua -> tests/test_window_basic.lua renamed: tiger.lua -> tests/tiger.lua renamed: interface/vc_cec.lua -> vc_cec.lua renamed: interface/vc_cecservice.lua -> vc_cecservice.lua renamed: interface/vc_display_types.lua -> vc_display_types.lua renamed: interface/vc_dispmanx.lua -> vc_dispmanx.lua renamed: interface/vc_dispmanx_types.lua -> vc_dispmanx_types.lua renamed: interface/vc_dispservice_x_defs.lua -> vc_dispservice_x_defs.lua renamed: interface/vc_hdmi.lua -> vc_hdmi.lua renamed: interface/vc_hdmi_property.lua -> vc_hdmi_property.lua renamed: interface/vc_image_types.lua -> vc_image_types.lua renamed: interface/vc_sdtv.lua -> vc_sdtv.lua renamed: interface/vc_tvservice.lua -> vc_tvservice.lua renamed: interface/vc_tvservice_defs.lua -> vc_tvservice_defs.lua renamed: interface/vcgencmd.lua -> vcgencmd.lua renamed: interface/vchi.lua -> vchi.lua renamed: interface/vchi_cfg.lua -> vchi_cfg.lua renamed: interface/vchi_cfg_internal.lua -> vchi_cfg_internal.lua renamed: interface/vchi_common.lua -> vchi_common.lua renamed: interface/vchi_mh.lua -> vchi_mh.lua renamed: interface/vcos.lua -> vcos.lua renamed: interface/vcos_assert.lua -> vcos_assert.lua renamed: interface/vcos_init.lua -> vcos_init.lua renamed: interface/vcos_platform.lua -> vcos_platform.lua renamed: interface/vcos_platform_types.lua -> vcos_platform_types.lua renamed: interface/vcos_semaphore.lua -> vcos_semaphore.lua renamed: interface/vcos_types.lua -> vcos_types.lua
- Loading branch information...
Showing
with
68 additions
and 66 deletions.
- +3 −49 OpenVGApp.lua
- +3 −4 bcm_host.lua
- 0 {interface → }/common.lua
- 0 {interface → }/connection.lua
- 0 { → experimental}/freetype.lua
- BIN media/desktop.ppm
- 0 {interface → }/message.lua
- +0 −12 test_bcm_host.lua
- +1 −1 test_snapshot.lua
- +60 −0 tests/snapper.lua
- 0 { → tests}/test_dispmanx.lua
- 0 { → tests}/test_egl.lua
- 0 { → tests}/test_egl_vg_window.lua
- 0 { → tests}/test_egl_window.lua
- 0 { → tests}/test_egles_basic.lua
- 0 { → tests}/test_enumdispman.lua
- 0 { → tests}/test_picast.lua
- +1 −0 { → tests}/test_tiger.lua
- 0 { → tests}/test_triangle.lua
- 0 { → tests}/test_window_basic.lua
- 0 { → tests}/tiger.lua
- 0 {interface → }/vc_cec.lua
- 0 {interface → }/vc_cecservice.lua
- 0 {interface → }/vc_display_types.lua
- 0 {interface → }/vc_dispmanx.lua
- 0 {interface → }/vc_dispmanx_types.lua
- 0 {interface → }/vc_dispservice_x_defs.lua
- 0 {interface → }/vc_hdmi.lua
- 0 {interface → }/vc_hdmi_property.lua
- 0 {interface → }/vc_image_types.lua
- 0 {interface → }/vc_sdtv.lua
- 0 {interface → }/vc_tvservice.lua
- 0 {interface → }/vc_tvservice_defs.lua
- 0 {interface → }/vcgencmd.lua
- 0 {interface → }/vchi.lua
- 0 {interface → }/vchi_cfg.lua
- 0 {interface → }/vchi_cfg_internal.lua
- 0 {interface → }/vchi_common.lua
- 0 {interface → }/vchi_mh.lua
- 0 {interface → }/vcos.lua
- 0 {interface → }/vcos_assert.lua
- 0 {interface → }/vcos_init.lua
- 0 {interface → }/vcos_platform.lua
- 0 {interface → }/vcos_platform_types.lua
- 0 {interface → }/vcos_semaphore.lua
- 0 {interface → }/vcos_types.lua
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
File renamed without changes.
@@ -1,12 +0,0 @@ | ||
---package.path = package.path..";../?.lua" | ||
- | ||
-local ffi = require "ffi" | ||
- | ||
- | ||
-local bcm = require "BcmHost" | ||
- | ||
- | ||
-print(bcm.GetDisplaySize()); | ||
- | ||
- | ||
- |
@@ -0,0 +1,60 @@ | ||
+ | ||
+local ffi = require "ffi" | ||
+local DMX = require "DisplayManX" | ||
+ | ||
+local Display = DMXDisplay(); | ||
+Display:SetBackground(0,0,0); | ||
+ | ||
+local screenWidth, screenHeight = Display:GetSize(); | ||
+local ratio = screenWidth / screenHeight; | ||
+ | ||
+local displayHeight = screenHeight; | ||
+local displayWidth = screenWidth; | ||
+--local displayHeight = 320; | ||
+--local displayWidth = 640; | ||
+--local displayHeight = 70; | ||
+--local displayWidth = displayHeight * ratio; | ||
+ | ||
+ | ||
+-- Create the view that will display the snapshot | ||
+local displayView = Display:CreateView( | ||
+ displayWidth, displayHeight, | ||
+ 0, screenHeight-displayHeight-1, | ||
+ 0, ffi.C.VC_IMAGE_RGB888) | ||
+ | ||
+ | ||
+local function WritePPM(filename, pixbuff) | ||
+ local r, c, val; | ||
+ | ||
+ local fp = io.open(filename, "wb") | ||
+ if not fp then | ||
+ return false | ||
+ end | ||
+ | ||
+ local header = string.format("P6\n%d %d\n255\n", pixbuff.Width, pixbuff.Height) | ||
+ fp:write(header); | ||
+ | ||
+ for row=0,pixbuff.Height-1 do | ||
+ local dataPtr = ffi.cast("char *",pixbuff.Data) + pixbuff.Pitch*row | ||
+ local data = ffi.string(dataPtr, pixbuff.Width*3); | ||
+ fp:write(data); | ||
+ end | ||
+ | ||
+ fp:close(); | ||
+end | ||
+ | ||
+ | ||
+-- Do the snapshot | ||
+Display:Snapshot(displayView.Resource); | ||
+ | ||
+ | ||
+local pixeldata, err = displayView.Resource:ReadPixelData(); | ||
+if pixeldata then | ||
+ -- Write the data out | ||
+ local filename = "media/desktop.ppm" | ||
+-- print("Writing: ", filename); | ||
+ | ||
+ WritePPM(filename, pixeldata); | ||
+end | ||
+ | ||
+ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
0 comments on commit
68b0eb4