Skip to content

03 Shapes

Milton Mamani Torres edited this page May 14, 2020 · 10 revisions

Shapes

Roassal3 has some predefined shapes that can be used by developers.

Bounding Shapes.

Instances of RSBoundingShapes has a transformation matrix AthensAffineTransform and a base Rectangle. Bounding shapes have their position on center, then the origin and the corner of this rectangle must be at the same distance.

Box

Instances of RSBox can create a basic rectangle.

canvas := RSCanvas new.
canvas add: (RSBox new
	width: 100;
	height: 100;
	color: Color blue;
	position: 100@100).
"size sets the extent for red box"
canvas add: (RSBox new
	size: 100;
	color: Color red;
	position: 0@0).	
canvas

Use border: to set the stroke for the shape, you will need to create an instance of RSBorder.

canvas := RSCanvas new.
canvas add: (RSBox new
	size: 100;
	color: Color red;
	border: (RSBorder new
		color: Color blue;
		width: 5);
	position: 0@0).	
canvas

Use cornerRadius: and create corners around the box, you can use an instance of RSCornerRadius or a number.

canvas := RSCanvas new.
canvas add: (RSBox new
	extent: 300@200;
	color: (Color blue alpha: 0.3);
	border: (RSBorder new
		color: (Color red alpha: 0.3);
		width: 5);
	cornerRadius: 20;
	position: 0@0).	
canvas

With an instance of RSCornerRadius you can modify the size of each corner.

...
	cornerRadius: (RSCornerRadius new 
		topLeft: 50;
		bottomRight:50);
...

Check examples of RSCornerRadius for more combinations.

Ellipse

Polygon

Bitmap

PieSlice

Label

SVG

Composite

Custom shapes

Clone this wiki locally