Documentation | InterfaceKit | Shape
SYNOPSIS
Perl
Python
use HaikuR1::Shape;
my $shape = HaikuR1::Shape->new();
$shape->LineTo($x,$y);
$view->StrokeShape($shape);
DESCRIPTION
Exposes the BShape
object.
For more information on Shape, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a Shape.
Perl
Python
HaikuR1::Shape->new(); HaikuR1::Shape->new($other); HaikuR1::Shape->new($archive);
other
A Shape to copy.
archive
A Message, contains an archived version of the Shape.
copy
Copies the contents of another object into this object.
Perl
Python
$rect->copy($copy_from);
copy_from
A Shape to copy.
AddShape
Adds another Shape to this Shape.
Perl
Python
$shape->AddShape($other);
other
A Shape to add.
ArcTo
Draw an arc from the current point to the given point, along the ellipse defined by the parameters.
Perl
Python
$shape->ArcTo(
rx => $rx,
ry => $ry,
angle => $angle,
largeArc => $largeArc,
counterClockWise => $counterClockWise,
point => $point,
);
rx
,ry
Floating point numbers, the radii of the ellipse that defines the arc.
angle
A floating point number, the angle of the arc.
largeArc
A boolean; if true, use the larger of the two possible arcs.
counterClockWise
A boolean; if true, the arc will go counterclockwise.
point
A Point; the center of the ellipse.
BezierTo
Draw a curve from the current point to the given endpoint, using the control points to define the curve.
Perl
Python
$shape->BezierTo($control1, $control2, $endPoint);
control1
,control2
,endPoint
The Points that define the Bezier curve.
Bounds
Returns the smallest rectangle that contains the shape.
However, this is a simplistic calculation with two shortcomings. First, it
does not take Bezier curves into account; the rectangle will contain the
points used to define the curve, but the curve itself may fall outside the
rectangle. Second, when an arc is added (see ArcTo), the coordinate
pair angle,0
is stored internally with the points, and the Bounds
calculation does not take this into account, treating it the same as any other
point; this may cause a distorted bounds rectangle.
Perl
Python
$shape->Bounds();
Clear
Empties the shape.
Perl
Python
$shape->Clear();
Close
Closes the shape.
Perl
Python
$shape->Close();
CurrentPosition
Returns the current position of the shape; that is, the point the next line, curve, or arc will start from.
Perl
Python
$shape->CurrentPosition();
LineTo
Draws a line from the current point to the given point.
Perl
Python
$shape->LineTo($linePoint);
linePoint
A Point, the endpoint of the line.
MoveTo
Changes the current point without drawing a line.
Perl
Python
$shape->MoveTo($point);
point
The new current Point.
OPERATORS
==
Returns true if the Shape objects contain the same shape.
!=
Returns true if the Shape objects do not contain the same shape.
ARCHIVABLE INTERFACE
Shape
inherits the methods and hooks of Archivable.