@@ -474,102 +474,6 @@ public BP_ANIMATIONPARAMS(BP_ANIMATIONSTYLE animStyle, int dur = 0)
474474 public static BP_ANIMATIONPARAMS Empty => new ( ) { cbSize = ( uint ) Marshal . SizeOf ( typeof ( BP_ANIMATIONPARAMS ) ) } ;
475475 }
476476
477- /// <summary>Provides a handle to an animation buffer.</summary>
478- [ StructLayout ( LayoutKind . Sequential ) ]
479- public struct HANIMATIONBUFFER : IHandle
480- {
481- private IntPtr handle ;
482-
483- /// <summary>Initializes a new instance of the <see cref="HANIMATIONBUFFER"/> struct.</summary>
484- /// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
485- public HANIMATIONBUFFER ( IntPtr preexistingHandle ) => handle = preexistingHandle ;
486-
487- /// <summary>Returns an invalid handle by instantiating a <see cref="HANIMATIONBUFFER"/> object with <see cref="IntPtr.Zero"/>.</summary>
488- public static HANIMATIONBUFFER NULL => new ( IntPtr . Zero ) ;
489-
490- /// <summary>Gets a value indicating whether this instance is a null handle.</summary>
491- public bool IsNull => handle == IntPtr . Zero ;
492-
493- /// <summary>Performs an explicit conversion from <see cref="HANIMATIONBUFFER"/> to <see cref="IntPtr"/>.</summary>
494- /// <param name="h">The handle.</param>
495- /// <returns>The result of the conversion.</returns>
496- public static explicit operator IntPtr ( HANIMATIONBUFFER h ) => h . handle ;
497-
498- /// <summary>Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="HANIMATIONBUFFER"/>.</summary>
499- /// <param name="h">The pointer to a handle.</param>
500- /// <returns>The result of the conversion.</returns>
501- public static implicit operator HANIMATIONBUFFER ( IntPtr h ) => new ( h ) ;
502-
503- /// <summary>Implements the operator !=.</summary>
504- /// <param name="h1">The first handle.</param>
505- /// <param name="h2">The second handle.</param>
506- /// <returns>The result of the operator.</returns>
507- public static bool operator != ( HANIMATIONBUFFER h1 , HANIMATIONBUFFER h2 ) => ! ( h1 == h2 ) ;
508-
509- /// <summary>Implements the operator ==.</summary>
510- /// <param name="h1">The first handle.</param>
511- /// <param name="h2">The second handle.</param>
512- /// <returns>The result of the operator.</returns>
513- public static bool operator == ( HANIMATIONBUFFER h1 , HANIMATIONBUFFER h2 ) => h1 . Equals ( h2 ) ;
514-
515- /// <inheritdoc/>
516- public override bool Equals ( object ? obj ) => obj is HANIMATIONBUFFER h && handle == h . handle ;
517-
518- /// <inheritdoc/>
519- public override int GetHashCode ( ) => handle . GetHashCode ( ) ;
520-
521- /// <inheritdoc/>
522- public IntPtr DangerousGetHandle ( ) => handle ;
523- }
524-
525- /// <summary>Provides a handle to a paint buffer.</summary>
526- [ StructLayout ( LayoutKind . Sequential ) ]
527- public struct HPAINTBUFFER : IHandle
528- {
529- private IntPtr handle ;
530-
531- /// <summary>Initializes a new instance of the <see cref="HPAINTBUFFER"/> struct.</summary>
532- /// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
533- public HPAINTBUFFER ( IntPtr preexistingHandle ) => handle = preexistingHandle ;
534-
535- /// <summary>Returns an invalid handle by instantiating a <see cref="HPAINTBUFFER"/> object with <see cref="IntPtr.Zero"/>.</summary>
536- public static HPAINTBUFFER NULL => new ( IntPtr . Zero ) ;
537-
538- /// <summary>Gets a value indicating whether this instance is a null handle.</summary>
539- public bool IsNull => handle == IntPtr . Zero ;
540-
541- /// <summary>Performs an explicit conversion from <see cref="HPAINTBUFFER"/> to <see cref="IntPtr"/>.</summary>
542- /// <param name="h">The handle.</param>
543- /// <returns>The result of the conversion.</returns>
544- public static explicit operator IntPtr ( HPAINTBUFFER h ) => h . handle ;
545-
546- /// <summary>Performs an implicit conversion from <see cref="IntPtr"/> to <see cref="HPAINTBUFFER"/>.</summary>
547- /// <param name="h">The pointer to a handle.</param>
548- /// <returns>The result of the conversion.</returns>
549- public static implicit operator HPAINTBUFFER ( IntPtr h ) => new ( h ) ;
550-
551- /// <summary>Implements the operator !=.</summary>
552- /// <param name="h1">The first handle.</param>
553- /// <param name="h2">The second handle.</param>
554- /// <returns>The result of the operator.</returns>
555- public static bool operator != ( HPAINTBUFFER h1 , HPAINTBUFFER h2 ) => ! ( h1 == h2 ) ;
556-
557- /// <summary>Implements the operator ==.</summary>
558- /// <param name="h1">The first handle.</param>
559- /// <param name="h2">The second handle.</param>
560- /// <returns>The result of the operator.</returns>
561- public static bool operator == ( HPAINTBUFFER h1 , HPAINTBUFFER h2 ) => h1 . Equals ( h2 ) ;
562-
563- /// <inheritdoc/>
564- public override bool Equals ( object ? obj ) => obj is HPAINTBUFFER h && handle == h . handle ;
565-
566- /// <inheritdoc/>
567- public override int GetHashCode ( ) => handle . GetHashCode ( ) ;
568-
569- /// <inheritdoc/>
570- public IntPtr DangerousGetHandle ( ) => handle ;
571- }
572-
573477 /// <summary>Defines paint operation parameters for <c>BeginBufferedPaint</c>.</summary>
574478 // typedef struct _BP_PAINTPARAMS { DWORD cbSize; DWORD dwFlags; const RECT *prcExclude; const BLENDFUNCTION *pBlendFunction;}
575479 // BP_PAINTPARAMS, *PBP_PAINTPARAMS; https://msdn.microsoft.com/en-us/library/windows/desktop/bb773228(v=vs.85).aspx
@@ -665,52 +569,38 @@ public class BufferedPaintBlock : IDisposable
665569 }
666570
667571 /// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HANIMATIONBUFFER"/> that is disposed using <see cref="EndBufferedAnimation"/>.</summary>
668- public class SafeHANIMATIONBUFFER : SafeHANDLE
572+ /// <remarks>Initializes a new instance of the <see cref="SafeHANIMATIONBUFFER"/> class and assigns an existing handle.</remarks>
573+ /// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
574+ /// <param name="updateTargetDC">The value to pass <see cref="EndBufferedAnimation"/> when closing this handle.</param>
575+ /// <param name="ownsHandle">
576+ /// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
577+ /// </param>
578+ public class SafeHANIMATIONBUFFER ( IntPtr preexistingHandle , bool updateTargetDC = true , bool ownsHandle = true ) : SafeHANDLE ( preexistingHandle , ownsHandle )
669579 {
670- private readonly bool fUpdateTarget = true ;
671-
672- /// <summary>Initializes a new instance of the <see cref="SafeHANIMATIONBUFFER"/> class and assigns an existing handle.</summary>
673- /// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
674- /// <param name="updateTargetDC">The value to pass <see cref="EndBufferedAnimation"/> when closing this handle.</param>
675- /// <param name="ownsHandle">
676- /// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
677- /// </param>
678- public SafeHANIMATIONBUFFER ( IntPtr preexistingHandle , bool updateTargetDC = true , bool ownsHandle = true ) : base ( preexistingHandle , ownsHandle ) => fUpdateTarget = updateTargetDC ;
679-
680- /// <summary>Initializes a new instance of the <see cref="SafeHANIMATIONBUFFER"/> class.</summary>
681- private SafeHANIMATIONBUFFER ( ) : base ( ) { }
682-
683580 /// <summary>Performs an implicit conversion from <see cref="SafeHANIMATIONBUFFER"/> to <see cref="HANIMATIONBUFFER"/>.</summary>
684581 /// <param name="h">The safe handle instance.</param>
685582 /// <returns>The result of the conversion.</returns>
686583 public static implicit operator HANIMATIONBUFFER ( SafeHANIMATIONBUFFER h ) => h . handle ;
687584
688585 /// <inheritdoc/>
689- protected override bool InternalReleaseHandle ( ) => EndBufferedAnimation ( this , fUpdateTarget ) . Succeeded ;
586+ protected override bool InternalReleaseHandle ( ) => EndBufferedAnimation ( this , updateTargetDC ) . Succeeded ;
690587 }
691588
692589 /// <summary>Provides a <see cref="SafeHandle"/> for <see cref="HPAINTBUFFER"/> that is disposed using <see cref="EndBufferedPaint"/>.</summary>
693- public class SafeHPAINTBUFFER : SafeHANDLE
590+ /// <remarks>Initializes a new instance of the <see cref="SafeHPAINTBUFFER"/> class and assigns an existing handle.</remarks>
591+ /// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
592+ /// <param name="updateTargetDC">The value to pass <see cref="EndBufferedPaint"/> when closing this handle.</param>
593+ /// <param name="ownsHandle">
594+ /// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
595+ /// </param>
596+ public class SafeHPAINTBUFFER ( IntPtr preexistingHandle , bool updateTargetDC = true , bool ownsHandle = true ) : SafeHANDLE ( preexistingHandle , ownsHandle )
694597 {
695- private readonly bool fUpdateTarget = true ;
696-
697- /// <summary>Initializes a new instance of the <see cref="SafeHPAINTBUFFER"/> class and assigns an existing handle.</summary>
698- /// <param name="preexistingHandle">An <see cref="IntPtr"/> object that represents the pre-existing handle to use.</param>
699- /// <param name="updateTargetDC">The value to pass <see cref="EndBufferedPaint"/> when closing this handle.</param>
700- /// <param name="ownsHandle">
701- /// <see langword="true"/> to reliably release the handle during the finalization phase; otherwise, <see langword="false"/> (not recommended).
702- /// </param>
703- public SafeHPAINTBUFFER ( IntPtr preexistingHandle , bool updateTargetDC = true , bool ownsHandle = true ) : base ( preexistingHandle , ownsHandle ) => fUpdateTarget = updateTargetDC ;
704-
705- /// <summary>Initializes a new instance of the <see cref="SafeHPAINTBUFFER"/> class.</summary>
706- private SafeHPAINTBUFFER ( ) : base ( ) { }
707-
708598 /// <summary>Performs an implicit conversion from <see cref="SafeHPAINTBUFFER"/> to <see cref="HPAINTBUFFER"/>.</summary>
709599 /// <param name="h">The safe handle instance.</param>
710600 /// <returns>The result of the conversion.</returns>
711601 public static implicit operator HPAINTBUFFER ( SafeHPAINTBUFFER h ) => h . handle ;
712602
713603 /// <inheritdoc/>
714- protected override bool InternalReleaseHandle ( ) => EndBufferedPaint ( this , fUpdateTarget ) . Succeeded ;
604+ protected override bool InternalReleaseHandle ( ) => EndBufferedPaint ( this , updateTargetDC ) . Succeeded ;
715605 }
716606}
0 commit comments