How to achieve Fuzzy masking effect!
-
my view is how to make the photo by code !
thank you!
[quote author="pkj__" date="1376988327"]Background image of a widget, qml or graphics scene??
for a widget you can do something like this:
myWidget->setStyleSheet("background-image: url(./image.png)")
[/quote] -
The fuzzy effect is called "bokeh".
Normally, people don't use code. People use cameras or Photoshop: http://www.youtube.com/watch?v=bvCZy3zRHAU
-
thank you very much ,how to achieve by code!
[quote author="JKSH" date="1377005079"]The fuzzy effect is called "bokeh".Normally, people don't use code. People use cameras or Photoshop: http://www.youtube.com/watch?v=bvCZy3zRHAU[/quote]
-
Oh, do you mean: "How to blur the photo edges?"
You can use QML code: http://qt-project.org/doc/qt-5.1/qtgraphicaleffects/qml-qtgraphicaleffects1-maskedblur.html
It is hard to use C++ code.
-
thank you,but my program is gui !
[quote author="JKSH" date="1377048353"]Oh, do you mean: "How to blur the photo edges?"You can use QML code: http://qt-project.org/doc/qt-5.1/qtgraphicaleffects/qml-qtgraphicaleffects1-maskedblur.html
It is hard to use C++ code.
[/quote]
-
[quote author="hk520590" date="1377049309"]thank you,but my program is gui ![/quote]It is hard to achieve the effect with C++ code.
It is better if you use an image editing program to make it blur. Then, save the blurred image.
-
thank you ,my way is get two image by 'photoshop'!
but I think it is not good !
[quote author="JKSH" date="1377050466"][quote author="hk520590" date="1377049309"]thank you,but my program is gui ![/quote]It is hard to achieve the effect with C++ code.It is better if you use an image editing program to make it blur. Then, save the blurred image.[/quote]
-
[quote author="hk520590" date="1377075638"]thank you ,my way is get two image by 'photoshop'!
but I think it is not good ![/quote]It is the best way.There are 3 possible solutions:
Write image processing code in C++ to make the blur
Convert your GUI from C++ to QML, and then use the QML blur feature
Use Photoshop
(1) and (2) both take a long time. (3) is the fastest.
-
thank you, but I want to the user self define, how to achieve it?
sorry my English is poor!
[quote author="JKSH" date="1377079071"][quote author="hk520590" date="1377075638"]thank you ,my way is get two image by 'photoshop'!
but I think it is not good ![/quote]It is the best way.There are 3 possible solutions:
Write image processing code in C++ to make the blur
Convert your GUI from C++ to QML, and then use the QML blur feature
Use Photoshop
(1) and (2) both take a long time. (3) is the fastest.[/quote]
-
Choose (1) or (2)
If you want, you can post in a subforum with other languages like http://qt-project.org/forums/viewforum/39/
-
thank you!
I have solved!
my way is:
@ QPainter p(this);QRect rc(0,0,300,this->height()); p.drawImage(rc,image); QLinearGradient linearGradient(280,0,300, 0); linearGradient.setColorAt(0,QColor(255,255,255,0)); linearGradient.setColorAt(1.0,image.pixel(150,50)); p.setBrush(QBrush(linearGradient)); p.setPen(QColor(255,255,255,0)); p.drawRect(0,0,this->width(),this->height());@
[quote author="JKSH" date="1377134599"]Choose (1) or (2)
If you want, you can post in a subforum with other languages like http://qt-project.org/forums/viewforum/39/[/quote]