GNOME Bugzilla – Bug 656877
Add rounded properties to ClutterActor
Last modified: 2014-12-14 19:29:47 UTC
Would be nice if it was possible to create a rectangle with rounded corners without having to create your own actor. ClutterRectangle has this comment: /* FIXME: Add gradient, rounded corner props etc */ It should be done using Cairo since Cogl isn't antialiased. I'm not sure if it would be possible to draw with Cairo without making ClutterRectangle a ClutterCairoTexture, which would presumably break the ABI.
Created attachment 194200 [details] EmpathyRoundedRectangle This is a rounded rectangle actor implemented by subclassing ClutterCairoTexture, just as an example. This isn't generic enough (e.g. it only implements painting the rectangle border as that's what I needed) but might serve as an example.
Created attachment 194201 [details] EmpathyRoundedRectangle header
if we ever added rounded corners support to the Rectangle class then they would by necessity use the Cogl API, which is not anti-aliased. right now, I suggest going down the same route you took, and create a class that uses Cairo internally.
btw, there is a bug open on bugzilla.clutter-project.org about this: http://bugzilla.clutter-project.org/show_bug.cgi?id=2224 but it had issues that we discussed on IRC and I now noticed we never wrote down on bugzilla. bad developers, no cookie for us.
ClutterRectangle is deprecated in master (1.10), so it won't get new features.
(In reply to comment #5) > ClutterRectangle is deprecated in master (1.10), so it won't get new features. Ok, I guess we should use ClutterActor instead right? Does it provide a way to have a rounded corners?
no, it doesn't. and there's still the issue of the Cogl API not being a high quality drawing API: you'll get ragged edges, unless you start doing tricks with MSAA or FSAA and shaders.
That's something we'd need then. Actually that would allow us to remove 2 files: http://git.gnome.org/browse/empathy/tree/src/empathy-rounded-actor.c http://git.gnome.org/browse/empathy/tree/src/empathy-rounded-rectangle.c Even if it's with cogl (used in the former) that would be better than nothing.
(In reply to comment #8) > Even if it's with cogl (used in the former) that would be better than nothing. no: aliased edges are actively worse than nothing. this is not 1997.
as a side note, it's possible to use a ClutterCanvas to draw a rounded rectangle background for an actor: http://git.gnome.org/browse/clutter/tree/examples/rounded-rectangle.c
*** Bug 656879 has been marked as a duplicate of this bug. ***
I don't think we want to add these properties to ClutterActor directly. you can use ClutterCanvas with a custom rounded rectangle drawing path.