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)

Related Call: InvertRect
Category: Regions
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/i/invertrgn.html