Line
ClassA Line
object contains the coordinates for a line graphics
shape. Line
objects use Pen
objects to
specify the width and color of the line. If an application
doesn’t specify a Pen
object, the default width is
one pixel and the default color is black. See Pen.
Here is an example of how to draw a line on a X11Pane
window.
int main () { X11Pane new xPane; InputEvent new e; Pen new bluePen; Line new basicLine; xPane initialize 10, 10, 100, 100; xPane map; xPane raiseWindow; xPane openEventStream; bluePen width = 10; bluePen colorName = "blue"; while (TRUE) { xPane inputStream queueInput; if (xPane inputStream eventPending) { e become xPane inputStream inputQueue unshift; switch (e eventClass value) { case WINDELETE: xPane deleteAndClose; exit (0); break; case EXPOSE: case RESIZENOTIFY: basicLine start x = 90; basicLine start y = 10; basicLine end x = 10; basicLine end y = 90; basicLine drawWithPen xPane, bluePen; break; default: break; } } } }
start
A Point
object that contains the receiver’s starting x
and y
coordinates.
end
A Point
object that contains the receiver’s ending x
and y
coordinates.
draw (X11Pane
paneObject)
Draw a line on the paneObject’s visible area at the receiver’s
start
and end
coordinates, using a default pen
width of one pixel and default color of black.
This method is mainly used for drawing on a buffer already attached to
a X11Pane
object. To draw offscreen to a separate
X11Bitmap
object, use drawLine
in class X11Bitmap
.
See X11Bitmap.
drawWithPen (X11Pane
paneObject, Pen
penObject)
Draw a line on the paneObject’s visible area at the receiver’s
start
and end
coordinates. The penObject argument
contains the width and color of the line. See Pen.
This method is also used mainly for drawing on a buffer already attached to
a X11Pane
object. To draw offscreen to a separate
X11Bitmap
object, use drawLine
in class X11Bitmap
.
See X11Bitmap.