cdCanvasLine
| Definition: |
include pGUI.e
cdCanvasLine(cdCanvas canvas, atom x1, y1, x2, y2) -- or -- wdCanvasLine(cdCanvas canvas, atom x1, y1, x2, y2) |
| Description: |
Draws a line from (x1,y1) to (x2,y2) using the current foreground color and line width and style. Both points are included in the line.
The cdLine(x1,y1,x2,y2) procedure that did not require an explicit canvas to be passed ceased to be available in 3.25. When translating to Phix, the C function cdfCanvasLine() should simply have the 'f' deleted. |
| pwa/p2js: | Supported, but not the world coordinates version, or cdCanvasGetLine(Style|Width), cdCanvasLineStyleDashes, or cdCanvas(S|G)etLine(Join|Cap). |
| Attributes: |
These also apply to cdCanvasArc(),
cdCanvasBegin/End(), and
cdCanvasRect(). Aside: Inserting "Set"/"Get" into the C function names might be tedious, but then again so would prefixing with "{} =". cdCanvasSetLineStyle(cdCanvas canvas, integer style) -- or -- integer prev = cdCanvasGetLineStyle(cdCanvas canvas) Configures or retrieves the style of the current line. Valid settings for style are: CD_CONTINUOUS, CD_DASHED, CD_DOTTED, CD_DASH_DOT, CD_DASH_DOT_DOT, or CD_CUSTOM. Default value: CD_CONTINUOUS. When translating C code, cdCanvasLineStyle() needs Set/Get inserted, and for the latter CD_QUERY removed. When CD_CUSTOM is used the cdCanvasLineStyleDashes() function must be called before to initialize the custom dashes. The spaces are drawn with the background color, except when back opacity is transparent then the background is left unchanged. See cdCanvas[Get/Set]BackOpacity. Line Styles cdCanvasLineStyleDashes(cdCanvas canvas, sequence dashes) Defines the custom line style dashes. The first value is the length of the first dash, the second value is the length of the first space, and so on. For example: {10,2,5,2} means dash size 10, space size 2, dash size 5, space size 2, and repeats the pattern. Sizes are in pixels. In Phix, the final count parameter of the C function is assumed from length(dashes). cdCanvasSetLineWidth(cdCanvas canvas, atom width) -- or -- wdCanvasSetLineWidth(cdCanvas canvas, atom width_mm) -- and -- integer prev = cdCanvasGetLineWidth(cdCanvas canvas) -- or -- atom prev = wdCanvasGetLineWidth(cdCanvas canvas) Configures or retrieves the width of the current line in pixels or (for wd) millimeters. Default value: 1. When translating C code, c/wdCanvasLineWidth() needs Set/Get inserted, and for the latter CD_QUERY removed. cdCanvasSetLineJoin(cdCanvas canvas, integer join_style) -- or -- integer prev = cdCanvasGetLineJoin(cdCanvas canvas) Configures or retrieves the current line style for CD_MITER, CD_BEVEL or CD_ROUND. Default value: CD_MITER. When translating C code, cdCanvasLineJoin() needs Set/Get inserted, and for the latter CD_QUERY removed. Line Joins cdCanvasSetLineCap(cdCanvas canvas, integer cap_style) -- or -- integer cap_style = cdCanvasGetLineCap(cdCanvas canvas) Configures or retrieves the current line style for CD_CAPFLAT, CD_CAPSQUARE or CD_CAPROUND. Default value: CD_CAPFLAT. When translating C code, cdCanvasLineCap() needs Set/Get inserted, and for the latter CD_QUERY removed. Line Caps |


