ForTest Posted August 31, 2016 Report Posted August 31, 2016 Hi folks! Does someone wants to share their widgets rendering functions? Graphically I'm not very good so if anyone has some nice graphical effects (for example on the buttons) to share it would be really appreciated I would be very interested to know how you can achieve gradient effects Thank you!
Joel Bodenmann Posted August 31, 2016 Report Posted August 31, 2016 Sadly we are having the same problem: We are engineers, not designers. Both @inmarket and I are not very good when it comes to making visually appealing designs. This is why there is no set of fancy/nicer looking default rendering routines for GWIN that could be used on more powerful systems. @chrisjn52 is currently writing a set of minimal, old-school styled 3D rendering routines. I'm not sure what the progress is on that. You can create gradients by using gdispBlendColors(). You can find an example in the default rendering routine of the pushbutton widget which uses a gradient background/fill unless GWIN_NEED_FLAT has been set to TRUE: // Fill the box blended from variants of the fill color tcol = gdispBlendColor(White, pcol->fill, BTN_TOP_FADE); bcol = gdispBlendColor(Black, pcol->fill, BTN_BOTTOM_FADE); dalpha = FIXED(255)/gw->g.height; for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha) { gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha))); }
ForTest Posted September 1, 2016 Author Report Posted September 1, 2016 Thank you very much! This example is very clear Do you have other routines example for make round buttons or something similar?
Joel Bodenmann Posted September 1, 2016 Report Posted September 1, 2016 As listed in the corresponding documentation the PushButton widget already comes with a rounded-rectangles and ellipse (along with others) rendering routines. Just have a look at their implementation that you can find in /src/gwin/gwin_button.c to get some inspirations.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now