* Returns the hex color value of a pixel * @param x the x coordinate * @param y the y coordinate * @returns the color of the pixel * @example * ```ts * import { Jimp } from "jimp"; * * const image = new Jimp({ width: 3, height: 3, color: 0xffffffff }); *
(x: number, y: number)
| 619 | * ``` |
| 620 | */ |
| 621 | getPixelColor(x: number, y: number) { |
| 622 | if (typeof x !== "number" || typeof y !== "number") { |
| 623 | throw new Error("x and y must be numbers"); |
| 624 | } |
| 625 | |
| 626 | const idx = this.getPixelIndex(x, y); |
| 627 | return this.bitmap.data.readUInt32BE(idx); |
| 628 | } |
| 629 | |
| 630 | /** |
| 631 | * Sets the hex colour value of a pixel |
no test coverage detected