Esempio n. 1
0
        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 (protection == null)
            {
                throw new ArgumentNullException(nameof(protection));
            }

            VC_RECT_T d = dest_rect;
            VC_RECT_T s = src_rect;

            VC_DISPMANX_ALPHA_T        nativeAlpha = alpha?.Native;
            DISPMANX_CLAMP_T           nativeClamp = clamp?.Native;
            DISPMANX_RESOURCE_HANDLE_T resHandle   = resource?.Handle ?? DISPMANX_RESOURCE_HANDLE_T.Null;

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

            if (handle.Handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new Element(handle));
        }
        /// <summary>
        /// Create a new resource
        /// </summary>
        /// <param name="type"></param>
        /// <param name="width"></param>
        /// <param name="height"></param>
        /// <returns></returns>
        public Resource CreateResource(VC_IMAGE_TYPE_T type, int width, int height)
        {
            DISPMANX_RESOURCE_HANDLE_T handle = NativeMethods.ResourceCreate(type, (uint)width, (uint)height, out IntPtr imagePtr);

            if (handle.Handle == IntPtr.Zero)
            {
                return(null);
            }
            return(new Resource(handle, type, imagePtr));
        }
Esempio n. 3
0
 internal Resource(DISPMANX_RESOURCE_HANDLE_T handle, VC_IMAGE_TYPE_T type, IntPtr imagePtr)
 {
     this.m_handle   = handle;
     this.m_type     = type;
     this.m_imagePtr = imagePtr;
 }