---
title: CGContextAddLines
framework: coregraphics
role: symbol
role_heading: Function
path: coregraphics/cgcontextaddlines
---

# CGContextAddLines

Adds a sequence of connected straight-line segments to the current path.

## Declaration

```occ
extern void CGContextAddLines(CGContextRef c, const CGPoint *points, size_t count);
```

## Parameters

- `c`: A graphics context .
- `points`: An array of values that specify the start and end points of the line segments to draw. Each point in the array specifies a position in user space. The first point in the array specifies the initial starting point.
- `count`: The number of elements in the points array.

## Discussion

Discussion This is a convenience function that moves to the first point in the sequence and then adds a line to each of the other points, sequentially.

## See Also

### Constructing a Current Graphics Path

- [beginPath()](coregraphics/cgcontext/beginpath().md)
- [CGContextMoveToPoint](coregraphics/cgcontextmovetopoint.md)
- [CGContextAddLineToPoint](coregraphics/cgcontextaddlinetopoint.md)
- [addRect(_:)](coregraphics/cgcontext/addrect(_:).md)
- [CGContextAddRects](coregraphics/cgcontextaddrects.md)
- [addEllipse(in:)](coregraphics/cgcontext/addellipse(in:).md)
- [CGContextAddArc](coregraphics/cgcontextaddarc.md)
- [CGContextAddArcToPoint](coregraphics/cgcontextaddarctopoint.md)
- [CGContextAddCurveToPoint](coregraphics/cgcontextaddcurvetopoint.md)
- [CGContextAddQuadCurveToPoint](coregraphics/cgcontextaddquadcurvetopoint.md)
- [addPath(_:)](coregraphics/cgcontext/addpath(_:).md)
- [closePath()](coregraphics/cgcontext/closepath().md)
- [path](coregraphics/cgcontext/path.md)
- [replacePathWithStrokedPath()](coregraphics/cgcontext/replacepathwithstrokedpath().md)
