#import "Rectangle.h"
#import <dpsclient/wraps.h>

@implementation Rectangle : Graphic
/*
 * This is the canonical Graphic.
 * It doesn't get much simpler than this.
 */

/* Methods overridden from superclass */

- (float)naturalAspectRatio
/*
 * The natural aspect ratio of a rectangle is 1.0 (a square).
 */
{
    return 1.0;
}

- draw
{
    if (bounds.size.width < 1.0 || bounds.size.height < 1.0) return self;

    if (!NXEqualColor([self fillColor], NX_COLORCLEAR)) {
	[self setFillColor];
	NXRectFill(&bounds);
    }
    if (!NXEqualColor([self lineColor], NX_COLORCLEAR)) {
	[self setLineColor];
	PSrectstroke(bounds.origin.x, bounds.origin.y, bounds.size.width, bounds.size.height);
    }

    return self;
}

@end
