I wrote a Magnify window, but the quality wasn't as clear for some of the resized images I was using it for, so I decided to go at it another way...
I load a fullsize version of the image into memory, and when the "magnify" window passes over the resized smaller version of the image - I "GrabImage" from the fullsize version, but the image flickers on #WM_MOVE.
The following:
Code: Select all
SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, #WS_EX_LAYERED)
SetLayeredWindowAttributes_(WindowID(0), 0, #Null, #LWA_COLORKEY)
Code: Select all
Macro HIWORD(long)
(long >> 16) & $FFFF
EndMacro
Macro LOWORD(long)
long & $FFFF
EndMacro
Procedure MoveWindow(hWnd, uMsg, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_MOVE
xpos = LOWORD(lParam)
ypos = HIWORD(lParam)
newImage = GrabImage(1, #PB_Any, xpos, ypos, 200, 200)
SetGadgetState(0, ImageID(newImage))
FreeImage(newImage)
EndSelect
ProcedureReturn Result
EndProcedure
Procedure OpenWindowMagnify()
If OpenWindow(0, 0, 0, 200, 200, "Magnify", #PB_Window_ScreenCentered|#PB_Window_BorderLess)
; SetWindowLongPtr_(WindowID(0), #GWL_EXSTYLE, #WS_EX_LAYERED)
; SetLayeredWindowAttributes_(WindowID(0), 0, #Null, #LWA_COLORKEY)
ImageGadget(0, 0, 0, 200, 200, #Null)
StickyWindow(0, 1)
Region = CreateEllipticRgn_(0, 0, 200, 200)
SetWindowRgn_(WindowID(0), Region, #TRUE)
DeleteObject_(Region)
SetWindowCallback(@MoveWindow())
EndIf
EndProcedure
...
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
If #WM_LBUTTONDOWN : SendMessage_(WindowID(0), #WM_NCLBUTTONDOWN, #HTCAPTION, #Null) : EndIf
Select EventType()
Case #PB_EventType_LeftDoubleClick
CloseWindow(0)
FreeImage(1)
End
EndSelect
EndSelect
ForEver