InvertRgn Function

Declare Function InvertRgn Lib "gdi32.dll" (ByVal hdc As Long, ByVal hRgn As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

InvertRgn inverts the colors of all the pixels inside a region on a given device. The inverse of the pixels is calculated by doing a binary NOT operation on the RGB color value of each pixel. The function returns 0 if an error occured, or a non-zero value if successful.

hdc
A device context to the device to invert the pixels within a region of.
hRgn
A handle to the region on the device to invert.

Example:

' Invert the pixels within an elliptical region on window Form1.  The
' elliptical region has a bounding rectangle of (20,30)-(150,110).
Dim hrgn As Long  ' handle to the region to invert
Dim retval As Long  ' return value

' Create the elliptical region to invert and get a handle to it.
hrgn = CreateEllipticRgn(20,30,150,110)
' Invert that region in window Form1.
retval = InvertRgn(Form1.hDC, hrgn)
' Delete the region to free up resources.
retval = DeleteObject(hrgn)

See Also: InvertRect
Category: Regions

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/i/invertrgn.html