Zoom-In the image in VFB


#1

The task is to zoom-in the bitmap in the Virtual frame buffer. The code that I have so far is this:

(
	function MakeParam LoWord HiWord = 
	(
		bit.or (bit.shift HiWord 16) (bit.and LoWord 0xFFFF)
    )
	
	function MouseButtonClick pos viewHWND = 
	(
		WM_MOUSEHWHEEL = 0x020A
		pp = makeParam (pos.x as integer) (pos.y as integer)
		windows.postmessage viewHWND WM_MOUSEHWHEEL 0 pp
-- 		windows.postmessage viewHWND WM_MOUSEHWHEEL -1 pp
	)
	
	
	function GetVFBbuttons = 
	(				
		childArr = UIAccessor.getChildWindows 0
		maxVFB = undefined	
		stopLoop = false
		for chld in childArr while stopLoop == false do 
		(		
			dialogTitle = UIAccessor.getWindowText chld		
			if (matchpattern dialogTitle pattern:"*, frame * (*:*)") do 
			(		
				maxVFB = chld
				stopLoop = true
			)			
		)	
			
		maxVFB	
	)
	
	maxVFB = GetVFBbuttons()
	
	screenPos = [500,500]
	mouseButtonClick screenPos maxVFB
)
	

To test it just render some objects and while the VFB is visible execute the code.
It simulates mouse wheel rotation over the VFB window. On each rotation the zoom level is changed(level up or level down).
The problem is that this code actually performs zoom-out. When I use the same code(slightly modified) for the active viewport this
windows.postmessage viewHWND WM_MOUSEHWHEEL 0 pp
performs zoom-in
and this:
windows.postmessage viewHWND WM_MOUSEHWHEEL -1 pp
performs zoom-out.
But for the VFB both parameters(0 and -1) performs zoom-out.

Is there are any solution?


#2

windows.postmessage viewHWND WM_MOUSEHWHEEL 0x10000 pp – vfb zoom-in
windows.postmessage viewHWND WM_MOUSEHWHEEL 0x00000 pp – vfb zoom-out


#3

Thank you. Works as it should.


#4

WM_MOUSEHWHEEL message

wParam

The high-order word indicates the distance the wheel is rotated, expressed in multiples or factors of WHEEL_DELTA, which is set to 120. A positive value indicates that the wheel was rotated to the right; a negative value indicates that the wheel was rotated to the left.


#5

Denis, I read all this before to creat the thread here but I did not found how to properly use(set) the WHEEL_DELTA with windows.postmessage.


#6

ha-ha-ha…


#7

Is there a problem with the name of the function and the arguments?

Most probably I have taken this fn from some of your posts:


#8

No! the function is exactly right, and it’s how to set HiWord. the wParam has the delta in its hiword. you have to do same what you do for position of mouse click. :smile:

bit.shift delta 16

wParam : The high-order word indicates the distance the wheel is rotated, expressed in multiples or factors of WHEEL_DELTA, which is set to 120