FrontPage  Index  Search  Changes  RSS  Login

Shape

Brief

Shape is a abstract class which represent a kind of shapes. e.g. Line, Rectangle, Polygon, Ellipse, Letters, etc.

Methods

Override following methods to inherit Shape.

virtual Shape& draw(const Color &col, Drawable &target = *Drawable::prime)
virtual Shape& draw(const Stroke &strk, Drawable &target = *Drawable::prime)

Unique fill and stroke

Although the Shape instances are able to be specified their color and stroke when they are drawn, each of the them has its default fill and stroke. They are useful if the shape instance is grouped.

fill
available to substituted by Color.
stroke
Stroke.

Sample Code

#include <psychlops.h>
using namespace Psychlops;

void psychlops_main() {
	Canvas canvas(Canvas::window);

	Psychlops::Rectangle rect(100,100);
	rect.centering().shift( 100, 0);
	rect.stroke.set(Color::red, 5, Stroke::DOTTED);

	Psychlops::Ellipse ellipse;
	ellipse.set(rect);
	ellipse.centering().shift(-100, 0);
	ellipse.fill = Color::white;

	while(!Keyboard::esc.pushed()) {
		canvas.clear();
		ellipse.draw();
		rect.draw();
		canvas.flip();
	}
}
Last modified:2010/04/11 14:06:40
Keyword(s):[Shape] [Figure]
References:[Reference Manual]