Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smooth zoom, rotate, mirror #13

Open
sanmaodo opened this issue Jan 14, 2022 · 13 comments
Open

Smooth zoom, rotate, mirror #13

sanmaodo opened this issue Jan 14, 2022 · 13 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@sanmaodo
Copy link

I want to perform zooming, rotating, mirroring on the already opened image.
can it be achieved?

@skelet8801
Copy link

Is it possible to add shadows around the image? I can't figure out how to do it!

like this:
20220115_160237

@sanmaodo
Copy link
Author

@skelet8801
Copy link

@skelet8801 look here: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=29117

Actually I want to add shadow to LayeredWindow. Earlier I posted a help thread on the forum:
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=90369

At first I wanted to zoom image smoothly and used LayeredWindow.
Then I wanted to add a shadow to the LayeredWindow, and I got stuck and couldn't solve it.

@iseahound
Copy link
Owner

hwnd := ImagePutWindow([400, 400, 200, 200],,, style := 0x82080000, styleEx := 0x8)
FrameShadow(hwnd)

FrameShadow(HGui) {
	DllCall("dwmapi\DwmIsCompositionEnabled","IntP",_ISENABLED) ; Get if DWM Manager is Enabled
	if !_ISENABLED ; if DWM is not enabled, Make Basic Shadow
		DllCall("SetClassLong","UInt",HGui,"Int",-26,"Int",DllCall("GetClassLong","UInt",HGui,"Int",-26)|0x20000)
	else {
		VarSetCapacity(_MARGINS,16)
		NumPut(1,&_MARGINS,0,"UInt")
		NumPut(1,&_MARGINS,4,"UInt")
		NumPut(1,&_MARGINS,8,"UInt")
		NumPut(1,&_MARGINS,12,"UInt")
		DllCall("dwmapi\DwmSetWindowAttribute", "Ptr", HGui, "UInt", 2, "Int*", 2, "UInt", 4)
		DllCall("dwmapi\DwmExtendFrameIntoClientArea", "Ptr", HGui, "Ptr", &_MARGINS)
	}
}

?

@iseahound
Copy link
Owner

@sanmaodo can you explain what this will be used for?

@skelet8801
Copy link

@iseahound @sanmaodo
Dynamic scaling of images is useful, almost all software that displays images supports dynamic scaling (using WheelUp/Down).

Let me explain the shadow problem again:
1 You can use the FrameShadow function to add shadows to ordinary windows.
But it does not work for the LayeredWindow(UpdateLayeredWindow) window,
The shadow can only be generated at the beginning, and it will be invalid when the LayeredWindow is activated again.

2 To achieve fast and smooth zooming of images, the best way I found is to use LayeredWindow.
If the normal window(with image) is quickly zoomed, it will cause obvious stuttering.

@sanmaodo
Copy link
Author

@iseahound
I wanted to build my own image browser with ImagePut
I know there are many similar programs on the Internet
But none of them work the way I expect them to

@iseahound
Copy link
Owner

@skelet8801 Please run the code it has been solved.

@sanmaodo I can add rotation and reflection in addition to the already existing crop and scale.

@iseahound
Copy link
Owner

Suggestions:

Rotation - 90° Is this clockwise or counterclockwise? In math, a 90° rotation is counterclockwise. It remains to be seen what the defaults in other programs are. I intend to only support 90, 180, 270.

Use the term reflect, flip, or mirror? For example: {image: "cats.jpg", reflect: "x"} to flip over the x-axis.

@sanmaodo
Copy link
Author

@iseahound I'm looking forward to dynamic scaling

@iseahound
Copy link
Owner

This project was developed to be simple, fast, and efficient. Adding extra features that are very specific increases code size and complexity. Any dynamic scaling as you suggested sounds very difficult to code, perhaps you could try?

@sanmaodo
Copy link
Author

@iseahound I respect your decision. It's really too complicated.

@iseahound
Copy link
Owner

I'll keep this open as a future milestone

@iseahound iseahound added enhancement New feature or request help wanted Extra attention is needed labels Nov 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants