---
title: "setPixel(_:atX:y:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbitmapimagerep/setpixel(_:atx:y:)"
---

# setPixel(_:atX:y:)

Sets the bitmap image representation’s pixel at the specified coordinates to the specified raw pixel values.

## Declaration

```swift
func setPixel(_ p: UnsafeMutablePointer<Int>, atX x: Int, y: Int)
```

## Parameters

- `p`: An array of integers representing the raw pixel values. The values must be in an order appropriate to the object’s bitmap format. Small pixel sample values should be passed as an integer value. Floating point values should be cast int[].
- `x`: The x-axis coordinate of the pixel.
- `y`: The y-axis coordinate of the pixel.

## See Also

### Related Documentation

- [bitmapFormat](appkit/nsbitmapimagerep/bitmapformat.md)

### Managing Pixel Values

- [setColor(_:atX:y:)](appkit/nsbitmapimagerep/setcolor(_:atx:y:).md)
- [colorAt(x:y:)](appkit/nsbitmapimagerep/colorat(x:y:).md)
- [getPixel(_:atX:y:)](appkit/nsbitmapimagerep/getpixel(_:atx:y:).md)
