Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunnycapturer/acrylicwindow
QtWidget uses Acrylic Material to blur windows | Qt 使用亚克力的透明磨砂效果的窗口思路和解决方案 | 跨平台方案
https://github.com/sunnycapturer/acrylicwindow
acrylic qt
Last synced: about 1 month ago
JSON representation
QtWidget uses Acrylic Material to blur windows | Qt 使用亚克力的透明磨砂效果的窗口思路和解决方案 | 跨平台方案
- Host: GitHub
- URL: https://github.com/sunnycapturer/acrylicwindow
- Owner: SunnyCapturer
- License: mit
- Created: 2022-06-30T14:07:55.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T11:59:02.000Z (about 2 years ago)
- Last Synced: 2024-12-18T16:26:01.585Z (about 2 months ago)
- Topics: acrylic, qt
- Language: C++
- Homepage:
- Size: 5.5 MB
- Stars: 29
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AcrylicWindow
> Win10 Acrylic(亚克力)、Win11 mica(云母)、Win7 Aero Glass(毛玻璃);也就是通常说的 **透明磨砂** 效果;
### Acrylic Material Document
| OS VERSION | APPELLATION | SDK | EXPLAIN |
| ---------- | ------------------------------ | --------------------------------- | ------------------------------------------------------------ |
| Windows 7 | Aero Glass / 毛玻璃 / 磨砂玻璃 | `extendFrameIntoClientArea()` | only Windows 7 / Vista |
| Windows 10 | Acrylic Material / 亚克力 材质 | `SetWindowCompositionAttribute()` | [MSDN DOC](https://docs.microsoft.com/en-us/windows/apps/design/style/acrylic) |
| Windows 11 | Mica / 云母 | `SetWindowCompositionAttribute()` | [MSDN DOC](https://docs.microsoft.com/en-us/windows/apps/design/signature-experiences/materials) |
### Project
- **『BlurEffect』** 属奇思妙想,实现简单且跨平台,属 **等效** 跨平台透明磨砂效果;**原理: ** 在显示窗口的底层放一个 "QWidget + 图片 + QGraphicsBlurEffect" 作为铺垫
- **『AcrylicMaterial + Demo』** 生成 `AcrylicMaterial.dll`, `Demo.exe` 调用上面 `AcrylicMaterial.dll` 的接口,显示一个 QWidget 窗口。**原理: ** 调用 Windows 10/7 SDK 不公开的 API
- 矩阵逐个点去磨砂
- qss?
### Show
### Aero Glass
```cpp
// 仅支持 windows 7 的毛玻璃 磨砂 透明 Aero Glass 效果
#ifdef Q_OS_WIN
// 添加 winextras
#include
this->setAttribute(Qt::WA_TranslucentBackground);
QtWin::enableBlurBehindWindow(this);
QtWin::extendFrameIntoClientArea(this, -1, -1, -1, -1);
#endif
```
### Note
If the running background images does not load, please check
- `.dll` Path
- `Image` Path
### Acrylic Material
1. [https://github.com/wangwenx190/Win32Acrylic](https://github.com/wangwenx190/Win32Acrylic)
2. [https://github.com/Qt-Widgets/qtacrylicmaterial](https://github.com/Qt-Widgets/qtacrylicmaterial)
3. [https://github.com/zhiyiYo/PyQt-Frameless-Window](https://github.com/zhiyiYo/PyQt-Frameless-Window)
### Refecnces
1. [亚克力效果的实现思路](https://www.cnblogs.com/zhiyiYo/p/14644609.html) 『本项目主要参考此文,后略作修改』
2. [使用 SetWindowCompositionAttribute 来控制程序的窗口边框和背景](https://blog.walterlv.com/post/set-window-composition-attribute.html)
3. DDE 透明磨砂效果原理: [deepin-wm 的动态背景模糊实现](https://github.com/linuxdeepin/deepin-mutter/blob/release/3.20/src/compositor/meta-blur-actor.c)