i attach an applet example.
the thing that i really care about is - the line
drawing algorithm is faulty. which pixels get turned
on - that logic is flawed. this is supposed to be a
floating-point graphics package, yet it treats lines as
having integer endpoint coordinates. the example that i
attach draws a line segment, then a subsegment. you
will notice (when you run the applet) that the
subsegment does not lie completely over the original
segment. not even close, for that matter.
oh, and as a side matter, i wasn't able to change the
color of a line segment to anything but white. i must
have misread the documentation...
i am starting a very minimal graphics project of my own
-
http://grafx.sourceforge.net. its goal is not to
provide nearly the amount of functionality that this
package delivers - its goal is to provide very, very
low level rastorixation APIs. it does draw lines
correctly, though.
Logged In: YES
user_id=162478
here is the applet
Logged In: YES
user_id=162478
i'm having problem attaching the applet. here it is in the
comment field:
import java.applet.Applet;
import java.awt.*;
import go.*;
public class MyBadExample extends Applet
{
private static class Foo extends GoInterface
{
GoLines data;
Foo()
{
data = new GoLines(4);
data.rgb(2, 0.0d, 0.0d, 0.0d);
data.rgb(3, 0.0d, 0.0d, 0.0d); // BUG: these two lines
do nothing!
double x0 = -0.43d;
double y0 = -0.596d;
double x1 = 0.3167d;
double y1 = 0.647439d;
data.xyz(0, x0, y0, 0.0d);
data.xyz(1, x1, y1, 0.0);
data.xyz(2, x0 + (x1 - x0) * 0.498d, y0 + (y1 - y0) *
0.498d, 0.0);
data.xyz(3, x1, y1, 0.0);
// BUG: the second line segment does not completely
overlap the first!
}
public void render()
{
go.clear(Go.IMAGE);
go.render(data);
swap();
}
}
public void init()
{
setLayout(new GridLayout(1, 1));
add("Center", new Foo());
}
}