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.
Setting this variable to an array of length 0 with a Gamma statement like this: GraphicInstance.dash_list = array(0); will cause undefined behavior. To reset the default, use array(). |
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:
Constant | Description |
---|---|
Pt_FLOAT_POS | Allow the position and origin of the widget to change, leaving the graphic fixed to the parent. |
Pt_FLOAT_ORIGIN | Allow the origin of the graphic to change, leaving the position of the widget fixed to the parent. |
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:
Constant | Description |
---|---|
Pg_BUTT_CAP | The default, leaves line capless, with square-cut ends. |
Pg_ROUND_CAP | Puts a round cap on thick lines. |
Pg_SQUARE_CAP | Puts a square cap on thick lines. |
This instance variable determines the shape of line joints (mainly visible for wide lines), and may have one of the following values:
Constant | Description |
---|---|
Pg_MITER_JOIN | Makes a squared-off joint. |
Pg_ROUND_JOIN | Makes a small-radius rounded joint. |
Pg_BEVEL_JOIN | Makes a beveled joint. |
Pg_QROUND_JOIN | Makes a large-radius rounded joint. |
Pg_BUTT_JOIN | Makes a butt joint (outside line edges don't join). |
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 product distribution.
#!/usr/cogent/bin/phgamma /* * This example illustrates dash variables for graphic lines. */ require_lisp("PhotonWidgets.lsp"); require_lisp("PhabTemplate.lsp"); PtInit(nil); wfile = PhabReadWidgetFile (string(_os_, "-WidgetFiles/wgt/graphics.wgtw")); window = PhabCreateWidgets(wfile, nil, nil); win = PhabLookupWidget(window,#graphics,nil); ln0 = PhabLookupWidget(window,#Line0,nil); ln1 = PhabLookupWidget(window,#Line1,nil); ln2 = PhabLookupWidget(window,#Line2,nil); ln3 = PhabLookupWidget(window,#Line3,nil); ln4 = PhabLookupWidget(window,#Line4,nil); ln5 = PhabLookupWidget(window,#Line5,nil); ebut = PhabLookupWidget(window,#ExitButton,nil); PtAttachCallback(ebut, Pt_CB_ACTIVATE, #exit_program(1)); ln0.dash_list = array(); ln1.dash_list = array(20); ln2.dash_list = array(20,5); ln3.dash_list = array(20,5,20); ln4.dash_list = array(20); ln4.dash_scale = 0x00020000; ln5.dash_list = array(20); ln5.dash_scale = 0x00004000; PtRealizeWidget(win); PtMainLoop();
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.