Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style question: Gradient #4495

Closed
AbbyIOM opened this issue Aug 29, 2021 · 7 comments
Closed

Style question: Gradient #4495

AbbyIOM opened this issue Aug 29, 2021 · 7 comments

Comments

@AbbyIOM
Copy link

AbbyIOM commented Aug 29, 2021

My Issue/Question:

Is it possible in current ImGui version to achieve some good looking glow around widgets?
Maybe a two color gradient, but what about circles? and is gradient from the center even possible?

@AbbyIOM
Copy link
Author

AbbyIOM commented Aug 29, 2021

Also, i've got another question, if i want to modify a widget and i want to animate the widget like opacitiy fade or changing the position once clicked, how am i supposed to do that? If i change the opacity or the position of the rectangle all widgets will get affected after i press one. I've been trying to recreate the windows 10 checkbox (the moving circle from left to right) but after i move the circle on pressed all checkboxes will move too.

@MartinBspheroid
Copy link

You might want to check out #1537 for the checkbox.
For glow... I'm not entirely sure I'm one who could help out with this one.

@rokups
Copy link
Contributor

rokups commented Aug 30, 2021

It is possible to customize rendering by setting ImDrawCmd::UserCallback/ImDrawCmd::UserCallbackData. This function is called by the backend and you can handle rendering any way you want. In this case you probably want to create a custom shader that implements glow and apply it to rendered geometry.

@ocornut
Copy link
Owner

ocornut commented Aug 30, 2021

A gradient can be created using AddRectFilledMultiColor() or reworking it into a custom version that takes 4 different points. There's no AddQuadFilledMultiColor() because not-axis aligned would require anti-aliasing edge (possible to add but generally once you are creating those graphics shapes manually you can use low-level function).

Your questions are generally a bit too vague and open-ended while also suggesting unfamiliarity with some concepts so it's going to be not easy to lay out simple answers. Everything is possible is to put the work to it.

@AbbyIOM
Copy link
Author

AbbyIOM commented Aug 30, 2021

So like, what would you recommend to do to make something that looks like glow/shadow, or possibly the easiest way to achieve that.

@ocornut
Copy link
Owner

ocornut commented Aug 30, 2021

There's on "easy" way to achieve that. You have all cards in hands to draw custom elements.

There's a features/shadow branch (#1329) which has some fancy primitives.
I think we went overboard with the polygon clipping and going to strip some features out for simplicity before this has a chance to settle. It's also reliant on texture update (#3761) being finished otherwise hard to configure.

@AbbyIOM
Copy link
Author

AbbyIOM commented Aug 30, 2021

That's actually absolutely perfect!

Thanks and enjoy the rest of the day.

@AbbyIOM AbbyIOM closed this as completed Aug 30, 2021
@AbbyIOM AbbyIOM changed the title Style question: Glow Style question: Gradient Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants