Hello,
the simplest and most efficient would be to prepare the image so that it has already rounded corners.
However, if the rounding should change dynamically at the runtime, use the Filter Image view. This view supports a mask filter. That means, the image is displayed through the mask.
The mask is an Alpha8 bitmap. Since the rounding should change dynamically, it will be necessary to render the Alpha8 bitmap at the runtime. For this purpose I would use the Filled Path Bitmap object. Assign the object to the property MaskBitmap of the Filter Image view.
To describe the content of the Alpha8 bitmap (in your case a rectangle with rounded corners), use the Path Data object. Assign this object to the property Path of the Filled Path Bitmap object.
This results in a chain of three object Path -> Filled Path Bitmap -> Filter Image. The Path describes the shape of the mask. Filled Path Bitmap renders this shape as Alpha8 bitmap. Filter Image displays your image by masking it with the rendered mask bitmap.
Important: in the Filled Path Bitmap configure the size of the bitmap by modifying the property FrameSize. This size should correspond to the desired size of the mask and thus to the size of your original bitmap.
Remaining part is the description of the shape in Path object (the description of a rectangle with rounded corners). Here you have to implement Chora code. Following could be an inspiration:
// Parameters for the rounded corners rectangle shape.
var float width = float( FillPath.FrameSize.x );
var float height = float( FillPath.FrameSize.y );
var float radius = 10.0;
// The quality of the rounded corners. The more edges the more smooth will they appear.
var int32 noOfEdges = 10;
// Create the shape composed of 4 arcs. The arcs are automatically connected by straight
// line segments.
Path.InitSubPath( 0, ( noOfEdges + 1 ) * 4 );
Path.AddArc( 0, width - radius, height - radius, radius, radius, 0.0, 90.0, noOfEdges );
Path.AddArc( 0, radius, height - radius, radius, radius, 90.0, 180.0, noOfEdges );
Path.AddArc( 0, radius, radius, radius, radius, 180.0, 270.0, noOfEdges );
Path.AddArc( 0, width - radius, radius, radius, radius, 270.0, 360.0, noOfEdges );
Path.Close( 0 );
I hope it helps you further.
Best regards
Paul Banach