' ########################################################################################
' Microsoft Windows
' File: Magnification.inc
' Contents: Magnification Control API
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_magnification_PBI)
#DEFINE PBX_magnification_PBI
%EQUATE `MAGNIFICATION_INC = 1
#INCLUDE ONCE "Legacy/Platform/wincodec.inc"
'#ifdef _WIN32
'// Magnifier Class Name
$WC_MAGNIFIERA = "Magnifier"
$$WC_MAGNIFIERW = "Magnifier"$$
#IF %DEF(%UNICODE)
 MACRO WC_MAGNIFIER = $WC_MAGNIFIERA
#ELSE
 MACRO WC_MAGNIFIER = $$WC_MAGNIFIERW
#ENDIF
'// Magnifier Window Styles
%EQUATE `MS_SHOWMAGNIFIEDCURSOR = &H0001&
%EQUATE `MS_CLIPAROUNDCURSOR = &H0002&
%EQUATE `MS_INVERTCOLORS = &H0004&
'// Filter Modes
%EQUATE `MW_FILTERMODE_EXCLUDE = 0
%EQUATE `MW_FILTERMODE_INCLUDE = 1
' // Size = 36 bytes
TYPE MAGTRANSFORM DWORD
 v (2, 2) AS SINGLE ' float v[3][3]
END TYPE
' // Size = 36 bytes
TYPE MAGIMAGEHEADER DWORD
 width AS DWORD ' UINT
 height AS DWORD ' UINT
 format AS GUID ' WICPixelFormatGUID
 stride AS DWORD ' UINT
 offset AS DWORD ' UINT
 cbSize AS DWORD ' SIZE_T
END TYPE
' // Size = 100 bytes
TYPE MAGCOLOREFFECT DWORD
 transform (4, 4) AS SINGLE ' float transform[5][5]
END TYPE
'typedef BOOL (CALLBACK* MagImageScalingCallback)(HWND hwnd, void * srcdata, MAGIMAGEHEADER srcheader, void * destdata, MAGIMAGEHEADER destheader, RECT unclipped, RECT clipped, HRGN dirty );
'FUNCTION MagImageScalingCallback ( ' BYVAL hwnd AS DWORD ' HWND hwnd
' , BYVAL srcdata AS DWORD ' void * srcdata
' , BYREF srcheader AS MAGIMAGEHEADER ' MAGIMAGEHEADER srcheader
' , BYVAL destdata AS DWORD ' void * destdata
' , BYREF destheader AS MAGIMAGEHEADER ' MAGIMAGEHEADER destheader
' , BYREF unclipped AS RECT ' RECT unclipped
' , BYREF clipped AS RECT ' RECT clipped
' , BYVAL dirty AS DWORD ' HRGN dirty
' ) AS LONG
'// Public Functions
DECLARE FUNCTION MagInitialize LIB "magnification.dll" ALIAS "MagInitialize" ( ) AS LONG
DECLARE FUNCTION MagUninitialize LIB "magnification.dll" ALIAS "MagUninitialize" ( ) AS LONG
DECLARE FUNCTION MagSetWindowSource LIB "magnification.dll" ALIAS "MagSetWindowSource" ( BYVAL hwnd AS QUAD , BYVAL rect AS RECT
 ) AS LONG
DECLARE FUNCTION MagGetWindowSource LIB "magnification.dll" ALIAS "MagGetWindowSource" ( BYVAL hwnd AS DWORD
 , BYREF pRect AS RECT
 ) AS LONG
DECLARE FUNCTION MagSetWindowTransform LIB "magnification.dll" ALIAS "MagSetWindowTransform" ( BYVAL hwnd AS DWORD
 , BYREF pTransform AS MAGTRANSFORM
 ) AS LONG
DECLARE FUNCTION MagGetWindowTransform LIB "magnification.dll" ALIAS "MagGetWindowTransform" ( BYVAL hwnd AS DWORD
 , BYREF pTransform AS MAGTRANSFORM
 ) AS LONG
DECLARE FUNCTION MagSetWindowFilterList LIB "magnification.dll" ALIAS "MagSetWindowFilterList" ( BYVAL hwnd AS DWORD
 , BYVAL dwFilterMode AS DWORD
 , BYVAL count AS LONG
 , BYREF pHWND AS DWORD
 ) AS LONG
DECLARE FUNCTION MagGetWindowFilterList LIB "magnification.dll" ALIAS "MagGetWindowFilterList" ( BYVAL hwnd AS DWORD
 , BYREF pdwFilterMode AS DWORD
 , BYVAL count AS LONG
 , BYREF pHWND AS DWORD
 ) AS LONG ' int
DECLARE FUNCTION MagSetImageScalingCallback LIB "magnification.dll" ALIAS "MagSetImageScalingCallback" ( BYVAL hwnd AS QUAD , BYVAL callback AS QUAD ) AS LONG
DECLARE FUNCTION MagGetImageScalingCallback LIB "magnification.dll" ALIAS "MagGetImageScalingCallback" ( BYVAL hwnd AS QUAD
 ) AS DWORD ' MagImageScalingCallback
DECLARE FUNCTION MagSetColorEffect LIB "magnification.dll" ALIAS "MagSetColorEffect" ( BYVAL hwnd AS QUAD , BYREF pEffect AS MAGCOLOREFFECT ) AS LONG
DECLARE FUNCTION MagGetColorEffect LIB "magnification.dll" ALIAS "MagGetColorEffect" ( BYVAL hwnd AS QUAD
 , BYREF pEffect AS MAGCOLOREFFECT
 ) AS LONG
#ENDIF
