class PtGraphic PtBasic { dash_list; // char array (Pt_ARG_DASH_LIST) dash_scale; // long (Pt_ARG_DASH_SCALE) graphic_flags; // flag (Pt_ARG_GRAPHIC_FLAGS) line_cap; // unsigned short (Pt_ARG_LINE_CAP) line_join; // unsigned short (Pt_ARG_LINE_JOIN) line_width; // long (Pt_ARG_LINE_WIDTH) origin; // PhPoint (Pt_ARG_ORIGIN) points; // PhPoint array (Pt_ARG_POINTS) }
This widget serves as a parent class of resources for graphic widgets, and is not normally instantiated. The variables here have to do mainly with line origins, thicknesses, joints and caps, as well as fill colors for closed shapes.
![]() | For detailed information, please refer to PtGraphic in the Photon documentation. |
An array of integers specifying in pixels the length of each dash and/or space for dashed lines. If there is more than one element in the array, each element applies to the next dash or space, and then the pattern repeats. An array with an odd number of elements will produce an alternating pattern of dashes and spaces (see the example below). The default is an empty array [ ], which gives a solid line.
A 32 bit number that specifies the scale of the dash_list. The top 16 bits correspond to numbers greater than one, the bottom 16 to fractions less than one. The number 0x00010000 is equal to one.
For example, to scale dashes 2 times larger, you would use the number 0x00020000; to make them half size, you would use 0x00008000 (because that is half of 0x00010000). See also the example below.
This instance variable controls the position and origin of the widget and the graphic with respect to the parent widget. It may be a combination of zero (the default) or more of the following flags:
A constant that determines the shape of line ends, which become visible when a line is fairly wide. The default is butted, which means the line ends squarely at the end point. You can put a round or square cap at the end, which overlaps the end point by a factor of half the line width.
This instance variable may have one of the following values:
This instance variable determines the shape of line joints (mainly visible for wide lines), and may have one of the following values:
A number specifying the width of a line, in pixels.
A PhPoint specifying the origin of the widget, which is the upper-left corner of its widget canvas.
An array of PhPoints defining the graphic. The number and purpose of the points depends on the type of graphic.
This example, ex_PtGraphics.g, is included in the gamma_ph_#_examples_1_QNX4.tgz file available on the Cogent Web Site.
#!/usr/cogent/bin/phgamma
/*
* This example illustrates dash variables for graphic lines.
*/
require_lisp("PhotonWidgets.lsp");
require_lisp("PhabTemplate.lsp");
PtInit(nil);
wfile = PhabReadWidgetFile ("WidgetFiles/wgt/graphics.wgtw");
window = PhabCreateWidgets(wfile, nil, nil);
win = PhabLookupWidget(window,#graphics,nil);
ln1 = PhabLookupWidget(window,#Line1,nil);
ln2 = PhabLookupWidget(window,#Line2,nil);
ln3 = PhabLookupWidget(window,#Line3,nil);
ln4 = PhabLookupWidget(window,#Line4,nil);
ln1.dash_list = array(20.5);
ln2.dash_list = array(20,5,20);
ln3.dash_list = array(20);
ln3.dash_scale = 0x00020000;
ln4.dash_list = array(20);
ln4.dash_scale = 0x00004000;
PtRealizeWidget(win);
PtMainLoop();