Is it possible to draw rectangles with rounded corners? The canvas api in guix seems to only support normal rectangles, I might be wrong since this is such a basic shape.
For rounded rectangles, it does take some forethought to keep the resources from getting out of hand. I usually define 8 tiny png images, one for each corner and one for each straight side segment. Then write a custom drawing routine that positions the 4 corner pngs at the calling widget's corners, and fills the space between with the vertical and horizontal segment images. This makes it possible to use any size widget and even resize the widgets at runtime without adding any additional resources. This is a bit of work I grant you that, but drawing smooth anti-aliased rounded rectangles in a reasonable amount of compute cycles isn't trivial either.
Regarding text alignment, I think the necessary functionality is there although it may not be obvious. The function gx_system_string_width_get_ext(font, string, return_width) is used to calculate the width of the string, and you can use this value to calculate the top-left starting position for left/right/center aligned text drawing using some simple calculation.
I can see an ease-of-use benefit to something like:
gx_canvas_aligned_text_draw(string, rectangle, alignment)
Is this what you had in mind? If you want the text aligned within some calling widget, you could simply use the widget->gx_widget_size for the rectangle parameter, or you could specify your own rectangle for alignment. I will add this request to our roadmap for the next release if this would meet your needs.
It's not a built-in shape. You would have to piece this together using lines and arcs, or alternatively using PNGs. We can add it to our roadmap requests, but I haven't seen any other requests for this and we try to keep the library as small as we can to allow it to be used on lots of small devices.
5 people are following this question.