Beispiel #1
0
        public void Snapshot(Resource resource, DISPMANX_TRANSFORM_T transform)
        {
            var ret = DispmanxNativeMethods.Snapshot(this.m_handle, resource.Handle, transform);

            if (ret != DISPMANX_STATUS_T.SUCCESS)
            {
                throw new DispmanException($"Operation failed : {nameof(DispmanxNativeMethods.Snapshot)}");
            }
        }
Beispiel #2
0
        /// <summary>
        /// Opens an offscreen display
        /// </summary>
        /// <param name="dest"></param>
        /// <param name="orientation"></param>
        /// <returns></returns>
        public Display DisplayOpenOffscreen(Resource dest, DISPMANX_TRANSFORM_T orientation)
        {
            DISPMANX_DISPLAY_HANDLE_T handle = NativeMethods.DisplayOpenOffscreen(dest.Handle, orientation);

            if (handle.Handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new Display(handle));
        }
 extern static uint vc_dispmanx_element_add(
     uint update,
     uint display,
     int layer,
     ref VC_RECT_T dest_rect,
     uint src,
     ref VC_RECT_T src_rect,
     DISPMANX_PROTECTION_T protection,
     IntPtr /* ref VC_DISPMANX_ALPHA_T */ alpha,
     IntPtr /* ref DISPMANX_CLAMP_T */ clamp,
     DISPMANX_TRANSFORM_T transform
     );
        public Element ElementAdd(Update update, Display display, int layer, Rectangle dest_rect, Resource resource, Rectangle src_rect, Protection protection, Alpha alpha, Clamp clamp, DISPMANX_TRANSFORM_T transform)
        {
            if (update == null)
            {
                throw new ArgumentNullException(nameof(update));
            }
            if (display == null)
            {
                throw new ArgumentNullException(nameof(display));
            }
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }
            if (protection == null)
            {
                throw new ArgumentNullException(nameof(protection));
            }

            VC_RECT_T d = new VC_RECT_T(dest_rect);
            VC_RECT_T s = new VC_RECT_T(src_rect);

            VC_DISPMANX_ALPHA_T nativeAlpha = alpha?.Native;
            DISPMANX_CLAMP_T    nativeClamp = clamp?.Native;

            DISPMANX_ELEMENT_HANDLE_T handle = NativeMethods.ElementAdd(update.Handle, display.Handle, layer, ref d, resource.Handle, ref s, protection.Handle, ref nativeAlpha, ref nativeClamp, transform);

            if (handle.Handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new Element(handle));
        }
 public static extern DISPMANX_STATUS_T Snapshot(DISPMANX_DISPLAY_HANDLE_T display, DISPMANX_RESOURCE_HANDLE_T snapshot_resource, DISPMANX_TRANSFORM_T transform);
 public static extern DISPMANX_ELEMENT_HANDLE_T ElementAdd(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_DISPLAY_HANDLE_T display, int layer, ref VC_RECT_T dest_rect, DISPMANX_RESOURCE_HANDLE_T src, ref VC_RECT_T src_rect, DISPMANX_PROTECTION_T protection, ref VC_DISPMANX_ALPHA_T alpha, ref DISPMANX_CLAMP_T clamp, DISPMANX_TRANSFORM_T transform);
 public static extern DISPMANX_DISPLAY_HANDLE_T DisplayOpenOffscreen(DISPMANX_RESOURCE_HANDLE_T handle, DISPMANX_TRANSFORM_T orientation);
Beispiel #8
0
 internal extern static DISPMANX_ELEMENT_HANDLE_T vc_dispmanx_element_add(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_DISPLAY_HANDLE_T display, Int32 layer, IntPtr dest_rect, DISPMANX_RESOURCE_HANDLE_T src, IntPtr src_rect, DISPMANX_PROTECTION_T protection, IntPtr alpha, IntPtr clamp, DISPMANX_TRANSFORM_T transform);
Beispiel #9
0
        public static DISPMANX_ELEMENT_HANDLE_T vc_dispmanx_element_add(DISPMANX_UPDATE_HANDLE_T update, DISPMANX_DISPLAY_HANDLE_T display, Int32 layer, VC_RECT_T dest_rect, DISPMANX_RESOURCE_HANDLE_T src, VC_RECT_T src_rect, DISPMANX_PROTECTION_T protection, IntPtr alpha, IntPtr clamp, DISPMANX_TRANSFORM_T transform)
        {
            DISPMANX_ELEMENT_HANDLE_T retvalue;

            GCHandle dest_rectHandle = GCHandle.Alloc(dest_rect, GCHandleType.Pinned);
            GCHandle src_rectHandle  = GCHandle.Alloc(src_rect, GCHandleType.Pinned);

            try {
                Debug.Assert(Delegates.pvc_dispmanx_element_add != null, "vc_dispmanx_element_add not implemented");
                retvalue = Delegates.pvc_dispmanx_element_add(update, display, layer, dest_rectHandle.AddrOfPinnedObject(), src, src_rectHandle.AddrOfPinnedObject(), protection, alpha, clamp, transform);
                LogCommand("vc_dispmanx_element_add", retvalue, update, display, layer, dest_rect, src, src_rect, protection, alpha, clamp, transform);
            } finally {
                dest_rectHandle.Free();
                src_rectHandle.Free();
            }

            return(retvalue);
        }