Exemplo n.º 1
0
        public BufferedPaintHandle(IWin32Window wnd, SafeDCHandle hdc, Rectangle targetRectangle,
                                   BP_ANIMATIONPARAMS?animationParams = null,
                                   BP_PAINTPARAMS paintParams         = null, BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
            : base(IntPtr.Zero, true)
        {
            RECT   rc = targetRectangle;
            var    ap = animationParams ?? BP_ANIMATIONPARAMS.Empty;
            IntPtr hdcFrom, hdcTo;
            var    hbp = BeginBufferedAnimation(new HandleRef(wnd, wnd.Handle), hdc, ref rc, fmt, paintParams, ref ap, out hdcFrom,
                                                out hdcTo);

            if (hbp == IntPtr.Zero)
            {
                throw new Win32Exception();
            }
            if (hdcFrom != IntPtr.Zero)
            {
                SourceGraphics = Graphics.FromHdc(hdcFrom);
            }
            if (hdcTo != IntPtr.Zero)
            {
                Graphics = Graphics.FromHdc(hdcTo);
            }
            SetHandle(hbp);
            ani = true;
        }
Exemplo n.º 2
0
 public static extern IntPtr BeginBufferedAnimation(
     IntPtr hwnd,
     IntPtr hdcTarget,
     ref Rectangle rcTarget,
     BP_BUFFERFORMAT dwFormat,
     IntPtr pPaintParams,
     ref BP_ANIMATIONPARAMS pAnimationParams,
     out IntPtr phdcFrom,
     out IntPtr phdcTo
     );
Exemplo n.º 3
0
        /// <summary>Initializes a new instance of the <see cref="BufferedPainter"/> class and begins a buffered paint operation.</summary>
        /// <param name="hdc">The handle of the target DC on which the buffer will be painted.</param>
        /// <param name="targetRectangle">Specifies the area of the target DC in which to paint.</param>
        /// <param name="paintParams">The paint operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="fmt">The format of the buffer.</param>
        /// <exception cref="Win32Exception">Buffered painting could not initialize.</exception>
        public BufferedPainter(SafeDCHandle hdc, Rectangle targetRectangle, BP_PAINTPARAMS paintParams = null,
                               BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
        {
            RECT target = targetRectangle;

            hbp = BeginBufferedPaint(hdc, ref target, fmt, paintParams, out IntPtr phdc);
            if (hbp.IsInvalid)
            {
                throw new Win32Exception();
            }
            if (phdc != IntPtr.Zero)
            {
                Graphics = Graphics.FromHdc(phdc);
            }
        }
Exemplo n.º 4
0
        /// <summary>Initializes a new instance of the <see cref="BufferedPainter"/> class and begins a buffered paint operation.</summary>
        /// <param name="hdc">The handle of the target DC on which the buffer will be painted.</param>
        /// <param name="targetRectangle">Specifies the area of the target DC in which to paint.</param>
        /// <param name="paintParams">The paint operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="fmt">The format of the buffer.</param>
        /// <exception cref="Win32Exception">Buffered painting could not initialize.</exception>
        public BufferedPainter(HDC hdc, Rectangle targetRectangle, BP_PAINTPARAMS paintParams = null,
                               BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
        {
            RECT target = targetRectangle;

            hbp = BeginBufferedPaint(hdc, target, fmt, paintParams, out var phdc);
            if (hbp.IsInvalid)
            {
                throw new Win32Exception();
            }
            if (!phdc.IsNull)
            {
                Graphics = Graphics.FromHdc((IntPtr)phdc);
            }
        }
Exemplo n.º 5
0
        public BufferedPaintHandle(SafeDCHandle hdc, Rectangle targetRectangle, BP_PAINTPARAMS paintParams = null,
                                   BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB) : base(IntPtr.Zero, true)
        {
            RECT   target = targetRectangle;
            IntPtr phdc;
            var    hbp = BeginBufferedPaint(hdc, ref target, fmt, paintParams, out phdc);

            if (hbp == IntPtr.Zero)
            {
                throw new Win32Exception();
            }
            if (phdc != IntPtr.Zero)
            {
                Graphics = Graphics.FromHdc(phdc);
            }
            SetHandle(hbp);
        }
Exemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BufferedPainter"/> class and begins a buffered animation operation. The animation consists of a
        /// cross-fade between the contents of two buffers over a specified period of time.
        /// </summary>
        /// <param name="wnd">The window in which the animations play.</param>
        /// <param name="hdc">A handle of the target DC on which the buffer is animated.</param>
        /// <param name="targetRectangle">Specifies the area of the target DC in which to draw.</param>
        /// <param name="animationParams">A structure that defines the animation operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="paintParams">A class that defines the paint operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="fmt">The format of the buffer.</param>
        /// <exception cref="Win32Exception">Buffered animation could not initialize.</exception>
        public BufferedAnimationPainter(IWin32Window wnd, SafeDCHandle hdc, Rectangle targetRectangle, BP_ANIMATIONPARAMS?animationParams = null,
                                        BP_PAINTPARAMS paintParams = null, BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
        {
            RECT rc = targetRectangle;
            var  ap = animationParams ?? BP_ANIMATIONPARAMS.Empty;

            hba = BeginBufferedAnimation(new HandleRef(wnd, wnd.Handle), hdc, ref rc, fmt, paintParams, ref ap, out IntPtr hdcFrom, out IntPtr hdcTo);
            if (hba.IsInvalid)
            {
                throw new Win32Exception();
            }
            if (hdcFrom != IntPtr.Zero)
            {
                SourceGraphics = Graphics.FromHdc(hdcFrom);
            }
            if (hdcTo != IntPtr.Zero)
            {
                DestinationGraphics = Graphics.FromHdc(hdcTo);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BufferedPainter"/> class and begins a buffered animation operation. The animation consists of a
        /// cross-fade between the contents of two buffers over a specified period of time.
        /// </summary>
        /// <param name="wnd">The window in which the animations play.</param>
        /// <param name="hdc">A handle of the target DC on which the buffer is animated.</param>
        /// <param name="targetRectangle">Specifies the area of the target DC in which to draw.</param>
        /// <param name="animationParams">A structure that defines the animation operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="paintParams">A class that defines the paint operation parameters. This value can be <see langword="null"/>.</param>
        /// <param name="fmt">The format of the buffer.</param>
        /// <exception cref="Win32Exception">Buffered animation could not initialize.</exception>
        public BufferedAnimationPainter(IWin32Window wnd, HDC hdc, Rectangle targetRectangle, BP_ANIMATIONPARAMS?animationParams = null,
                                        BP_PAINTPARAMS paintParams = null, BP_BUFFERFORMAT fmt = BP_BUFFERFORMAT.BPBF_TOPDOWNDIB)
        {
            RECT rc = targetRectangle;
            var  ap = animationParams ?? BP_ANIMATIONPARAMS.Empty;

            hba = BeginBufferedAnimation(wnd.Handle, hdc, rc, fmt, paintParams, ap, out var hdcFrom, out var hdcTo);
            if (hba.IsInvalid)
            {
                throw new Win32Exception();
            }
            if (!hdcFrom.IsNull)
            {
                SourceGraphics = Graphics.FromHdc((IntPtr)hdcFrom);
            }
            if (!hdcTo.IsNull)
            {
                DestinationGraphics = Graphics.FromHdc((IntPtr)hdcTo);
            }
        }
Exemplo n.º 8
0
 public static extern IntPtr BeginBufferedAnimation([NativeTypeName("HWND")] IntPtr hwnd, [NativeTypeName("HDC")] IntPtr hdcTarget, [NativeTypeName("const RECT *")] RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, BP_ANIMATIONPARAMS *pAnimationParams, [NativeTypeName("HDC *")] IntPtr *phdcFrom, [NativeTypeName("HDC *")] IntPtr *phdcTo);
Exemplo n.º 9
0
 public static extern IntPtr BeginBufferedPaint([NativeTypeName("HDC")] IntPtr hdcTarget, [NativeTypeName("const RECT *")] RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, [NativeTypeName("HDC *")] IntPtr *phdc);
Exemplo n.º 10
0
 public static extern IntPtr BeginBufferedPaint(IntPtr hdc, ref RECT prcTarget, BP_BUFFERFORMAT dwFormat, IntPtr pPaintParams, out IntPtr phdc);
Exemplo n.º 11
0
 public static extern IntPtr BeginBufferedPaint(IntPtr hdc, ref RECT prcTarget, BP_BUFFERFORMAT dwFormat,
                                                ref BP_PAINTPARAMS pPaintParams, out IntPtr phdc);
Exemplo n.º 12
0
 public static extern IntPtr BeginBufferedPaint(IntPtr hdcTarget, [In] ref Rectangle prcTarget, BP_BUFFERFORMAT dwFormat, [In] ref BP_PAINTPARAMS pPaintParams, out IntPtr phdc);
Exemplo n.º 13
0
 public static extern SafeBufferedPaintHandle BeginBufferedPaint(SafeDCHandle hdcTarget, [In] ref RECT prcTarget, BP_BUFFERFORMAT dwFormat, [In] BP_PAINTPARAMS pPaintParams, out IntPtr phdc);
Exemplo n.º 14
0
 public static extern SafeBufferedAnimationHandle BeginBufferedAnimation(HandleRef hwnd, SafeDCHandle hdcTarget, [In] ref RECT rcTarget, BP_BUFFERFORMAT dwFormat,
                                                                         [In] BP_PAINTPARAMS pPaintParams, [In] ref BP_ANIMATIONPARAMS pAnimationParams, out IntPtr phdcFrom, out IntPtr phdcTo);
Exemplo n.º 15
0
 public static extern HANIMATIONBUFFER BeginBufferedAnimation(HWND hwnd, HDC hdcTarget, [NativeTypeName("const RECT *")] RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, BP_ANIMATIONPARAMS *pAnimationParams, HDC *phdcFrom, HDC *phdcTo);
Exemplo n.º 16
0
 public static extern HPAINTBUFFER BeginBufferedPaint(HDC hdcTarget, [NativeTypeName("const RECT *")] RECT *prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS *pPaintParams, HDC *phdc);