[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How do I Draw a rectangle, not a square!
From: |
William S. Shu |
Subject: |
How do I Draw a rectangle, not a square! |
Date: |
Tue, 21 Sep 1999 19:28:13 +0100 |
I may be missing something, but the following code (swarm 1.4.1) to draw
a rectangle seems to ignore my y1 coordinate, and computes another so I
obtain a square with size (x1-x0), with top-left positioned at (x0,y0).
(x1,y1) is supposed to be bottom-right.
I suspect some default has been set (to maintain aspect ratio?) which I
can't trace.
Thanks
William.
---[ code
- drawSelfOn: (id <Raster>)r
{
int x0, y0, x1, y1;
int xMax, yMax;
...
{
x0 = bLeft.x;
y0 = bLeft.y;
x1 = (bLeft.x > tRight.x) ? xMax : tRight.x; // bRight beyond
xMax?
y1 = (bLeft.y > tRight.y) ? yMax : tRight.y; // tLeft beyond yMax?
[r rectangleX0: x0 Y0: y0 X1: x1 Y1: y1
Width: 1 Color: [allModelSwarms[CLST] getAgentSmlColor]];
}
...
}
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- How do I Draw a rectangle, not a square!,
William S. Shu <=