---
title: "init(width:height:points:resolvedColors:background:smoothsColors:colorSpace:)"
framework: swiftui
role: symbol
role_heading: Initializer
path: "swiftui/meshgradient/init(width:height:points:resolvedcolors:background:smoothscolors:colorspace:)"
---

# init(width:height:points:resolvedColors:background:smoothsColors:colorSpace:)

Creates a new gradient mesh specified as a 2D grid of colored points, with already-resolved sRGB colors.

## Declaration

```swift
nonisolated init(width: Int, height: Int, points: [SIMD2<Float>], resolvedColors: [Color.Resolved], background: Color = .clear, smoothsColors: Bool = true, colorSpace: Gradient.ColorSpace = .device)
```

## Parameters

- `width`: The width of the mesh, i.e. the number of vertices per row.
- `height`: The height of the mesh, i.e. the number of vertices per column.
- `points`: The array of points, containing width x height elements.
- `resolvedColors`: The array of colors, containing width x height elements.
- `background`: The background color, this fills any points outside the defined vertex mesh.
- `smoothsColors`: Whether cubic (smooth) interpolation should be used for the colors in the mesh (rather than only for the shape of the mesh).
- `colorSpace`: The color space in which to interpolate vertex colors.
