Function Reference


_WinAPI_InvertANDBitmap

Inverts the specified AND bitmask bitmap by performing a logical NOT operation

#include <WinAPIGdi.au3>
_WinAPI_InvertANDBitmap ( $hBitmap [, $bDelete = False] )

Parameters

$hBitmap Handle to the source bitmap that must be inverted.
$bDelete [optional] Specifies whether to delete the source bitmap after the function is successful, valid values:
    True - The bitmap will be destroyed when the function succeeds.
    False - Do not delete, you must destroy a bitmap when it no longer needed (Default).

Return Value

Success: Handle to the inverted bitmap.
Failure: 0.

Remarks

The _WinAPI_InvertANDBitmap() creates a 1 bits-per-pixel inverted bitmask DIB from the 1 bits-per-pixel AND bitmask bitmap.
If the source bitmap is not a 1 bits-per-pixel bitmap, the function fails.

When you are finished using the bitmap, destroy it using the _WinAPI_DeleteObject() function.

Related

_WinAPI_DeleteObject

Example

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
#include <WinAPIShellEx.au3>

; Extracts icon and create AND bitmask bitmap
Local $hIcon = _WinAPI_ShellExtractIcon(@ScriptDir & '\Extras\Script.ico', 0, 128, 128)
Local $aInfo = _WinAPI_GetIconInfo($hIcon)
_WinAPI_DeleteObject($aInfo[5])
_WinAPI_DestroyIcon($hIcon)

; Create inverted bitmask bitmap
$aInfo[5] = _WinAPI_InvertANDBitmap($aInfo[4])

; Create GUI
Local $hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 256, 128)
Local $aidPic[2], $ahPic[2]
$aidPic[0] = GUICtrlCreatePic('', 0, 0, 128, 128)
$aidPic[1] = GUICtrlCreatePic('', 128, 0, 128, 128)
For $i = 0 To 1
    $ahPic[$i] = GUICtrlGetHandle($aidPic[$i])
Next

; Set both bitmaps to controls
For $i = 0 To 1
    _SendMessage($ahPic[$i], $STM_SETIMAGE, 0, $aInfo[$i + 4])
    Local $hObj = _SendMessage($ahPic[$i], $STM_GETIMAGE)
    If $hObj <> $aInfo[$i + 4] Then
        _WinAPI_DeleteObject($aInfo[$i + 4])
    EndIf
Next

GUISetState(@SW_SHOW)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE