Open sanmaodo opened 2 years ago
Is it possible to add shadows around the image? I can't figure out how to do it!
like this:
@skelet8801 look here: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=29117
@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.
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)
}
}
?
@sanmaodo can you explain what this will be used for?
@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.
@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
@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.
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.
@iseahound I'm looking forward to dynamic scaling
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?
@iseahound I respect your decision. It's really too complicated.
I'll keep this open as a future milestone
I want to perform zooming, rotating, mirroring on the already opened image. can it be achieved?