PtEllipse

PtEllipse — An ellipse defined by a rectangular area.

Synopsis

class PtEllipse PtGraphic
{
}
		

Base Classes

PtWidget <-- PtBasic <-- PtGraphic <-- PtEllipse

Description

This widget is an ellipse defined by a bounding rectangle. The rectangle can be defined in one of two ways: as a dim variable, or as a points variable.

dim is set with a call to either of the SetDim or the SetArea methods. This is convenient for fast setup.

points is an array of two PhPoints. Thus, it needs to have two points defined before you can use it. However, this facilitates resizing the ellipse in code, by manipulating the points.

[Note]

For other information, please refer to PtEllipse in the Photon documentation.

Example

This example, ex_PtEllipse.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

/*
 * This example puts two PtEllipses in a window
 * and prints the dimensions of their defining
 * rectangles. The first one is defined by setting
 * its dim variable with SetArea, and the second by
 * defining points and setting its points variable. 
 */
require_lisp("PhotonWidgets.lsp");
PtInit(nil);

win = new(PtWindow);
win.SetDim (200,200);
win.fill_color = 0xffffbb;

el1 = new(PtEllipse);
el1.SetArea (25,40,120,50);

pt1 = new(PhPoint);
pt2 = new(PhPoint);
pt1.x = 65;
pt1.y = 50;
pt2.x = 110;
pt2.y = 140;

el2 = new(PtEllipse);
el2.points = array(pt1,pt2);

pretty_princ("Ellipse 1: ",el1.dim,"\n");
pretty_princ("Ellipse 2: ",el2.points,"\n");

ln = new(PtLine);
o = new(PhPoint);
o.x = 50;
o.y = 150;
s = new(PhPoint);
s.x = 0;
s.y = 0;
e = new(PhPoint);
e.x = -15;
e.y = -25;

PtRealizeWidget(win);
PtMainLoop();