Git Product home page Git Product logo

Comments (6)

vczh avatar vczh commented on September 26, 2024 1

@TonyDragonlake 我学习一下,不过我记得你可以直接设置窗口的透明色吧,D2D渲染上去什么都可以,感觉不需要在D2D的这一层做。不过这样可能不支持磨砂玻璃效果。

from gacui.

vczh avatar vczh commented on September 26, 2024 1

@TonyDragonlake 这篇文章是给D2D渲染用的,GDI的话从vista开始就支持设置图片作为背景的同时用alpha通道作为每一个像素的透明度的

from gacui.

vczh avatar vczh commented on September 26, 2024

没有直接支持,你可以用GacUIWindows.h里面的vl::presentation::windows::GetWindowsForm,拿到HWND然后调用API来做。

from gacui.

TonyDragonlake avatar TonyDragonlake commented on September 26, 2024

Direct2DWindowsNativeWindowListener_1_0里Alpha通道是可以通过设置D2D1_RENDER_TARGET_PROPERTIES属性设置的(GacUI/Source/NativeWindow/Windows/Direct2D/WinDirect2DApplication.cpp,第97行),然后只要用DwmEnableBlurBehindWindow就可以把底色去掉;
Direct2DWindowsNativeWindowListener_1_1里设置的交换链,即使在D2D1::BitmapProperties1设置允许Alpha通道(GacUI/Source/NativeWindow/Windows/Direct2D/WinDirect2DApplication.cpp,第242行),貌似也没办法把窗口变透明(试了一下,d2d的bitmap是透明了,但是后面有底色,应该是D3D的);然后尝试在交换链中设置透明,但是报错了,提示说只能在CreateSwapChainForCoreWindow或者WindowCompition才能设置AlphaMode,其两者都是要有窗口扩展样式WS_EX_NOREDIRECTIONBITMAP,该样式不支持win7系统。

from gacui.

vczh avatar vczh commented on September 26, 2024

https://docs.microsoft.com/en-us/archive/msdn-magazine/2014/june/windows-with-c-high-performance-window-layering-using-the-windows-composition-engine

from gacui.

TonyDragonlake avatar TonyDragonlake commented on September 26, 2024

非常感谢。
尽管使用DirectComposition可以透明,但是仍然需要win8及以上版本,且要有窗口扩展样式WS_EX_NOREDIRECTIONBITMAP用来设定不使用重定向表面。
这篇文章中 “Window Layering” 似乎容易令人误解。似乎文中没有提到DirectComposition与LayeredWindow的交互方式,且DirectComposition似乎没办法做到和gdi中UpdateLayeredWindow函数所能做到的 “鼠标穿透Alpha为0的区域”的功能。

from gacui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.