Type Function
Library display.*
Return value ShapeObject
Revision Current Public Release (2014.2189)
Keywords shape, polygon, vector
See also Shapes — Paths, Fills, Strokes


Draw a polygon shape by providing the outline (contour) of the shape. This includes convex or concave shapes. Self-intersecting shapes, however, are not supported and will result in undefined behavior.


display.newPolygon( x, y, vertices )
display.newPolygon( parent, x, y, vertices )
parent (optional)

GroupObject. An optional display group in which to insert the polygon.

x / y (required)

Numbers. The location of the object relative to its parent.

vertices (required)

Array. An array of x and y coordinates. These coordinates will automatically be re-centered about the center of the polygon.


Star with image fill and solid stroke

Star with image fill and solid stroke

local halfW = display.contentWidth * 0.5
local halfH = display.contentHeight * 0.5

local vertices = { 0,-110, 27,-35, 105,-35, 43,16, 65,90, 0,45, -65,90, -43,15, -105,-35, -27,-35, }

local o = display.newPolygon( halfW, halfH, vertices )
o.fill = { type="image", filename="aquariumbackgroundIPhone.jpg" }
o.strokeWidth = 10
o:setStrokeColor( 0, 1, 1 )