 Poly - Maple Help

ImageTools[Draw]

 Poly
 ImageTools:-Draw Poly Primitive Calling Sequence Poly( image, points, color, thickness, round, pattern, fill_color, fill_pattern ) Parameters

 image - ImageTools:-Image points - {list(list(numeric)), Array, Matrix} color - (optional) see description thickness - (optional) numeric := 1.0 round - (optional) truefalse := false pattern - (optional) identical("none", "solid", "dash", "dot", "dashdot", "dashdotdot") := "solid" fill_color - (optional) see description; default is 0.5 (50% gray) fill_pattern - (optional) identical("none", "solid", "horizontal", "vertical", "cross", "forward", "backward", "diagonalCross", "horizontalCylinder", "verticalCylinder", "sphere") := "none" Description

 • After first creating an image using ImageTools:-Create, or loading an image with ImageTools:-Read, drawing operations can be performed on it using a number of primitives (functions that draw one kind of object). The first argument to each primitive is the image itself, as returned by Create or Read.
 • The Poly primitive draws a multi-segment line (polyline) or closed shape (polygon) given a list, Array, or Matrix of points.
 • The points of the polyline or polygon are specified by the points argument, which must be a list of lists where each sublist contains two numeric values, or an N×2 numeric Array or Matrix. If the first and last points are coincident, then a polygon is drawn, otherwise a polyline is drawn (the distinction is only relevant if a fill pattern is specified).
 • The color argument controls the polygon's line color and is also used for the color of the lines in the specified pattern.  For the "cylindrical" and "spherical" patterns, the line color is used as the most distant color.
 The color and fill_color arguments can be specified in one of several forms:

 gray A numeric value between 0 and 1 specifying a shade of gray. The value 0 corresponds to black, and 1 to white. [r,g,b] A list of three numeric values between 0 and 1 specifying the red, green, and blue components separately. [r,g,b,α] A list of four numeric values between 0 and 1 specifying the red, green, blue, and opacity (alpha) separately. When the opacity is less than 1, the color will be blended with the existing content of the image. A value of type ColorTools:-Color. ColorTools:-Color argument(s) Any form accepted by the ColorTools:-Color constructor, such as a string giving a color name (e.g. "red", palette and color name (e.g. "Niagara DarkOrchid"), or palette and color number (e.g. "Nautical 1"). Two argument forms are accepted as well, but then it is necessary to always use the keyword form of the color argument, since otherwise the two arguments will be interpreted as two separate arguments to the drawing primitive. For example, color=("HSV",[0.5,0.6,0.6]).

 • The thickness argument specifies the apparent thickness of the line, measured in pixels. Because of anti-aliasing, the number of pixels used to render the line at any point may be more than this, but the line will appear to be of the specified thickness.
 Line segments are drawn from point to point, with half of the thickness falling on either side of the zero-width mathematical line between the two points.
 • If the round argument is specified as true, then the segment ends will be rounded, and the specified end-points will be the centers of those rounded ends, i.e., the segment will extend by half its thickness in all directions from the end-points.  By default, each line segment ends exactly at the specified coordinates, and for a thickness noticeably larger than 1, the ends of the segment will be perpendicular to the segment itself.
 • The pattern argument can be used to draw lines with one of a fixed number of patterns. The default pattern, solid, draws solid lines. The other available patterns are:
 "dash" "dot" "dashdot" "dashdotdot" "none"
 • The fill_pattern argument specifies how a polygon is to be filled. The default is "none", indicating that only the outline will be drawn. If "solid" is specified, then the polygon will be completely filled with the color specified by fill_color. The other possible fill patterns are: "horizontal" - horizontal lines "vertical" - vertical lines "cross" - horizontal and vertical lines "forward" - forward diagonal lines "backward" - backward diagonal lines "diagonalCross" - forward and backward diagonal lines "horizontalCylinder" - shading giving a horizontal cylindrical appearance "verticalCylinder" - shading giving a vertical cylindrical appearance "sphere" - shading giving a spherical appearance
 • When drawing a polygon that is to be filled (as specified by fill_pattern), then the fill_color argument specifies the color it is to be filled with. In the case of a non-solid fill pattern, this will be the background color of the pattern.
 • The options beginning with color are best provided as keyword equations, but can also be provided as positional arguments starting in the 3rd position as declared in the calling sequence above. Package Usage

 • This function is part of the ImageTools:-Draw package, so it can be used in the short form Poly(..) only after executing the command with(ImageTools:-Draw). However, it can always be accessed through the long form of the command by using ImageTools:-Draw:-Poly(..). Examples

 > $\mathrm{with}\left(\mathrm{ImageTools}\right):$
 > $\mathrm{with}\left(\mathrm{ImageTools}:-\mathrm{Draw}\right):$

Thin polyline.

 > $\mathrm{img}≔\mathrm{Create}\left(240,320,\mathrm{channels}=3,\mathrm{background}=\mathrm{white}\right):$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[32,32\right],\left[100,180\right],\left[220,60\right],\left[288,208\right]\right],\mathrm{color}=0.25\right)$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$ Filled polygon.

 > $\mathrm{img}≔\mathrm{Create}\left(240,320,\mathrm{channels}=3,\mathrm{background}=\mathrm{white}\right):$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[32,32\right],\left[100,180\right],\left[288,208\right],\left[220,60\right],\left[126,86\right],\left[32,32\right]\right],\mathrm{color}=0.25,\mathrm{thickness}=1,\mathrm{round}=\mathrm{true},\mathrm{pattern}="solid",\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="solid"\right)$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$ Very thin and thick polylines.

 > $\mathrm{img}≔\mathrm{Create}\left(240,320,\mathrm{channels}=3,\mathrm{background}=\mathrm{white}\right):$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[32,32\right],\left[68,180\right],\left[188,60\right],\left[256,208\right]\right],\mathrm{color}=0.25,\mathrm{thickness}=0.5,\mathrm{round}=\mathrm{true}\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[64,32\right],\left[100,180\right],\left[220,60\right],\left[288,208\right]\right],\mathrm{color}=0.25,\mathrm{thickness}=4,\mathrm{round}=\mathrm{true}\right)$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$ Round vs. square segment ends, and color transparency.

 > $\mathrm{img}≔\mathrm{Create}\left(240,320,\mathrm{channels}=3,\mathrm{background}=\mathrm{white}\right):$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[32,32\right],\left[68,180\right],\left[188,60\right],\left[256,208\right]\right],\mathrm{color}=\left[1,0,0,0.9\right],\mathrm{thickness}=8,\mathrm{round}=\mathrm{false}\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[64,32\right],\left[100,180\right],\left[220,60\right],\left[288,208\right]\right],\mathrm{color}=\left[0,0.66,0,0.9\right],\mathrm{thickness}=8,\mathrm{round}=\mathrm{true}\right)$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$ Polyline pattern examples.

 > $\mathrm{img}≔\mathrm{Create}\left(100,200,\mathrm{channels}=3,\mathrm{background}=\mathrm{white}\right):$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[5,10\right],\left[195,12.5\right],\left[195,25\right]\right],\mathrm{color}=0,\mathrm{thickness}=2,\mathrm{pattern}="dash"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[195,25\right],\left[195,25\right],\left[20,25\right]\right],\mathrm{color}=0,\mathrm{thickness}=2,\mathrm{pattern}="dot"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[20,25\right],\left[50,40\right],\left[195,40\right],\left[195,55\right]\right],\mathrm{color}=0,\mathrm{thickness}=2,\mathrm{pattern}="dashdot"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[195,55\right],\left[5,55\right],\left[5,10\right]\right],\mathrm{color}=0,\mathrm{thickness}=2,\mathrm{pattern}="dashdotdot"\right)$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$ Fill pattern examples.

 > $\mathrm{img}≔\mathrm{Create}\left(240,180,\mathrm{channels}=3,\mathrm{background}=\mathrm{white}\right):$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[5,5\right],\left[55,5\right],\left[55,55\right],\left[5,55\right],\left[5,5\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="horizontal"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[65,5\right],\left[115,5\right],\left[115,55\right],\left[65,55\right],\left[65,5\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="vertical"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[125,5\right],\left[175,5\right],\left[175,55\right],\left[125,55\right],\left[125,5\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="cross"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[5,65\right],\left[55,65\right],\left[55,115\right],\left[5,115\right],\left[5,65\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="forward"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[65,65\right],\left[115,65\right],\left[115,115\right],\left[65,115\right],\left[65,65\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="backward"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[125,65\right],\left[175,65\right],\left[175,115\right],\left[125,115\right],\left[125,65\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="diagonalCross"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[5,125\right],\left[55,125\right],\left[55,175\right],\left[5,175\right],\left[5,125\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="horizontalCylinder"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[65,125\right],\left[115,125\right],\left[115,175\right],\left[65,175\right],\left[65,125\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="verticalCylinder"\right)$
 > $\mathrm{Poly}\left(\mathrm{img},\left[\left[125,125\right],\left[175,125\right],\left[175,175\right],\left[125,175\right],\left[125,125\right]\right],\mathrm{color}=0,\mathrm{fill_color}=\left[0.9,1,0.8\right],\mathrm{fill_pattern}="sphere"\right)$
 > $\mathrm{Embed}\left(\mathrm{img}\right)$  Compatibility

 • The ImageTools[Draw][Poly] command was introduced in Maple 2018.