Magpie icon indicating copy to clipboard operation
Magpie copied to clipboard

建议:截屏时隐藏光标 / Magpie自带忽略光标的截屏

Open hiroi-sora opened this issue 2 years ago • 3 comments

Expected behavior 预期的功能

win截屏(Win+PrtSc或Win+Shift+S)默认不会截到屏幕上的光标。而开启Magpie后,截屏始终能截到光标。

能否添加功能:系统截屏时隐藏光标。或者软件内自带截图功能:保存不含光标的当前全屏截图到指定路径。

您的项目非常好用。感谢!!

另:我尝试用AHK脚本来在截屏时隐藏光标。这段代码在别的场景中运行良好,可惜还是不能用在Magpie中;隐藏光标的ChangeCursor()不生效。 (若启用放大前光标是正常状态,则开启放大后,无法用ChangeCursor()将其设为隐藏。反之,放大前是隐藏状态,则放大后无法恢复光标显示。) AHK代码:

ChangeCursor(OnOff=1)  ; 隐藏 = 0  |  显示 = 1  |  切换 = -1
{
    static AndMask, XorMask, $, h_cursor
    ,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13 ; 系统指针
    , b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13 ; 空白指针
    , h1,h2,h3,h4,h5,h6,h7,h8,h9,h10,h11,h12,h13 ; 默认指针的句柄
    if (OnOff = "I" or $ = "") ; 在请求或首次调用时进行初始化
    {
        $ := "h" ; 活动的默认指针
        VarSetCapacity( h_cursor,4444, 1 )
        VarSetCapacity( AndMask, 32*4, 0xFF )
        VarSetCapacity( XorMask, 32*4, 0 )
        system_cursors := "32512,32513,32514,32515,32516,32642,32643,32644,32645,32646,32648,32649,32650"
        StringSplit c, system_cursors, `,
        Loop %c0%
        {
            h_cursor := DllCall( "LoadCursor", "Ptr",0, "Ptr",c%A_Index% )
            h%A_Index% := DllCall( "CopyImage", "Ptr",h_cursor, "UInt",2, "Int",0, "Int",0, "UInt",0 )
            b%A_Index% := DllCall( "CreateCursor", "Ptr",0, "Int",0, "Int",0
            , "Int",32, "Int",32, "Ptr",&AndMask, "Ptr",&XorMask )
        }
    }
    if (OnOff = 0 or $ = "h" and OnOff < 0)
        $ := "b" ; 使用空白指针
    else
        $ := "h" ; 使用保存的指针
    Loop %c0%
    {
        h_cursor := DllCall( "CopyImage", "Ptr",%$%%A_Index%, "UInt",2, "Int",0, "Int",0, "UInt",0 )
        DllCall( "SetSystemCursor", "Ptr",h_cursor, "UInt",c%A_Index% )
    }
}

Alternative behavior (optional) 近似的功能(可选)

No response

hiroi-sora avatar Jun 22 '22 15:06 hiroi-sora

Magpie 中的光标是自行绘制的,实际上是画面的一部分。在系统截屏时隐藏光标或许可行,只需监测 PrintScreen 键,我会调查一下。

你使用的 AHK 脚本将系统光标替换为透明,但这对 Magpie 不起作用。Magpie 不会检测系统光标的变化,这是出于性能考虑。

Blinue avatar Jun 23 '22 00:06 Blinue

经过测试,检测 PrintScreen 键是可行的。这个功能将在 v0.10 提供,谢谢建议!

Blinue avatar Jul 15 '22 10:07 Blinue

经过测试,检测 PrintScreen 键是可行的。这个功能将在 v0.10 提供,谢谢建议!

感谢你的开发。非常期待新功能~

hiroi-sora avatar Jul 15 '22 10:07 hiroi-sora

v0.10 已发布 🎉

Blinue avatar Mar 25 '23 11:03 Blinue