Hi!
I want get color pixel when i click in QML. But i don’t know that the work fucntion.
Please help me!
Hi!
I want get color pixel when i click in QML. But i don’t know that the work fucntion.
Please help me!
tanthinh1510 (25th October 2014)
Hi wysota! thanks for your reply.
I have Rectangle with color animation, and then a put small circle in Rectangle. I want get color of pixel center circle when color animation changed.
I show you in the picture!
Untitled.png
Do you mean you want to fill the circle with the color corresponding to the color of the gradient underneath? Then either:
1. calculate the color manually (shouldn't be that hard)
2. implement a ShaderEffect to probe the texture of the gradient element and fill the circle with that color
3. put a ShaderEffectSource of the gradient element in the circle and stretch it so much that a single texel spans across the whole circle diameter (which might be hardest of the three approaches).
Hi wysota!
Can you for me simple example "implement a ShaderEffect to probe the texture of the gradient element and fill the circle with that color"?
Because I don't know how to get color of pixel in gradient color animation by ShaderEffect!
thanks wysota!
Added after 7 minutes:
Hi wysota!
I wan to create the software similar this video, have any idea wysota?
Last edited by tanthinh1510; 26th October 2014 at 06:22.
Please tell me, what I need to learn to do as the video above by QT?
Thanks wysota so much!
You need to calculate the color of the linear gradient under cursor using a simple linear equation. The difference between start and stop point of the gradient divided by the width of the gradient gives you the "speed" of colour change over one unit of width (e.g. one pixel). Knowing that you can interpolate the colour over the whole gradient.
Hi wysota!
I just get color of pixel center circle when color animation changed.
Circle below shows the color of the cursor.
results shows in this video!
Congratulations. You can post your solution here in case someone else encounters a similar problem.
Bookmarks