vczh-libraries / GacUI

GPU Accelerated C++ User Interface, with WYSIWYG developing tools, XML supports, built-in data binding and MVVM features.
Other
2.33k stars 296 forks source link

Guassian Blur(Win7 aeroglass, Mac/iOS UI blur) Feature #29

Open sekkit opened 6 years ago

sekkit commented 6 years ago

Built-in blur effect would be cool. With shader that can be achieved easily in Game Engines. But ordinary desktop's GUI depends on OS implementation. Is it possible to implement high performance - high quality Blur effect just can be easily enabled by a xml tag?

vczh commented 6 years ago

I have not looked into that yet. The default engine is Direct2D, and everything is writing to a render target. If Direct2D enable you to blur something that has already been rendered to a render target, then your idea is doable. Do you have any idea?

sekkit commented 6 years ago

How do you achieve crossplatform with D2D? Maybe you should reference NoesisGUI because it supports various render backend as well as Data-binding like WPF. I think if u implement the UI lib with a set of stable backend APIs then it's possible to be crossplatform with the same codebase. As for blur, if u get the render buffer and apply blur algorithm onto that bitmap, then it should be done. Shader might be a good way to go. I don't know the difference between NoesisGUI and GacUI, sorry for that because I am only familiar with limited Game GUIs.

As a developer, I would like to have a slim GUI library which can switch difference themes(2k, xp, win7) in one line of code, also plenty ui effects to choose.

vczh commented 6 years ago

@sekkit if you take a look at iGac repo you will find out that I achieve cross platform by writing different renderers and windowing provider for each platform I want to support. But unfortunately the maintainer of iGac are not working so the progress doesn't catch up. I get some idea from WPF actually.

So for the blur feature, I need to solve it for each platform if I want to add it.

GacUI are going to be able to switch between themes by calling one function but it is not done yet. The good news is, all fundamental building blocks are done, I just need to write a recursive function to tell the control tree to switch the theme. The bad news is that, I didn't create those 2k xp and win7 themes. Maybe someday I will do that, or maybe users will create by themselves.

vczh commented 6 years ago

@sekkit you can track my progress by reading this file

By the way, for the blur feature, are you really want the native aeroglass in Win7, or just simulating aeroglass?

sekkit commented 6 years ago

OS independent, 就是跨平台的aeroglass

sekkit commented 6 years ago

FlashGet 3可以一键切Xp主题(内置的),很漂亮。 Win的主题除了Win8,10,其它都好看。Win10之后微软的GUI已经没有审美了。 如果没有内置的话,我感觉跟wpf比没啥区别,不同平台做个UI现在已经不是个难事, 哪怕是Electron都有不错的效果。 NeosisGUI,这个也是c++/xaml的,你要不也扩展下游戏领域~~

vczh commented 6 years ago

@sekkit 皮肤可以慢慢做,Windows游戏开发的话,Direct2D跟Direct3D10以上都是兼容的,算燃气可以直接用,换个window provider就好了。aeroglass肯定还是尽量寻求操作系统支持,据说Win8之后已经没有这个功能了。

sekkit commented 6 years ago

glass8.eu -- AeroGlass Plugin for Win10 www.mactype.net -- freetype rendering for Windows

本质上就是个Gaussian Blur + 颜色混合吧,我觉得第三方能实现的话,其实就是个方法和效率的问题了。我都用QT实现过,有点卡。但是那个插件不卡。

如果装了Win7,那直接调DwmEnableComposition API好了,我说的是,在任何PC系统上,直接Show出Win7风格的效果~~~

因为本人做业余小项目一定会遇到这些问题,所以就提了下,当然这不是刚需。

image

顺便还可以加个TextShadow效果,这个用qt很容易实现,gac也可以弄一个。

image

image

MacOS like 磨砂效果~~QT弄的,GacUI也可以有。以上都是纯矢量的绘制,如果用位图来做性能应该会好点。

vczh commented 6 years ago

你怎么画的,真的是取背景图自己磨砂吗?说来这个算法还是Unity的面试题来着(逃

sekkit commented 6 years ago

Nope. http://doc.qt.io/qt-5/graphicaleffects.html GUI直接有。自己实现的效率不一定好~ 以前试过WPF在非Win7上实现磨砂效果,性能很差,这些消耗高的算法应该做在c++层吧

vczh commented 6 years ago

得用D3D写shader做,不能直接CPU坐的

vczh commented 4 years ago

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

roodkcab commented 1 year ago

maybe should use stackblur / boxblus instead of guassian blur