RedEyeCorrection class
An Effect that corrects red eyes in the rectangles of a picture that a program names.
The effect works only inside the rectangles of its RedEyeCorrectionParams. The program, or the user, finds the eyes; the effect fixes their colour. The class mirrors the GDI+ RedEyeCorrection class and inherits the members of Effect.
Creating
Syntax: fx = RedEyeCorrection( )
Syntax: fx = RedEyeCorrection( params )
Each form is also available as New RedEyeCorrection( … ) with the same arguments.
- params
- required A RedEyeCorrectionParams: the number of areas and the memory that holds their rectangles.
A constructor that fails creates an unusable object whose LastResult tells why.
The effect created without arguments has no areas, and Bitmap.ApplyEffect refuses to apply it: the call returns 2 (InvalidParameter).
Warning 0.9.45.0
In a 64-bit program the form with params stops the program with an access violation. A 32-bit program is not affected. To work in both, create the effect without arguments and set Parameters, which works in both.
Parameters
Syntax: fx.Parameters [ = params ]
Syntax: params = fx.Parameters( size )
Gets or sets the RedEyeCorrectionParams. The setter creates the GDI+ effect again and sets the parameters on the new one, with the size LenB(Of RedEyeCorrectionParams) plus the size of the rectangles.
Warning 0.9.45.0
The getter returns zeros and sets LastResult to 2 (InvalidParameter) unless it is given size. On an effect that has areas it does so even with size, so the areas cannot be read back: keep the RedEyeCorrectionParams that was set. See Effect.
The areas are described by a structure whose methods allocate and fill the rectangles; the page of RedEyeCorrectionParams shows them.
Dim user As GdiPlusUser = GdiPlusUser()
Dim fx As RedEyeCorrection = RedEyeCorrection()
Debug.Print fx.LastResult
Dim bmp As Bitmap = Bitmap(10!, 10!)
Graphics(bmp).Clear(Color(255, 220, 20, 20))
Debug.Print bmp.ApplyEffect(fx, GpRect(0, 0, 10, 10))
' Output:
' 0
' 2
See Also
- RedEyeCorrection – Microsoft’s documentation of the GDI+ class
- Effect class
- RedEyeCorrectionParams type