You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
866 B

  1. /**
  2. * Posterise the source image and save the result in the target image.
  3. * Restrict the amount of used brightness levels to four equidistant values.
  4. *
  5. * @param x The x coordinate of the pixel to posterise
  6. * @param y The y coordinate of the pixel to posterise
  7. * @param source The source image data
  8. * @param target The image data to save the converted color information to
  9. * @param width The width of the canvas
  10. * @param height The height of the canvas
  11. */
  12. export function quantisegrayscale(x: number, y: number, source: Uint8ClampedArray, target: Uint8ClampedArray, width: number, height: number) {
  13. // TODO: Convert the pixel at position (x, y) in the source array from RGB to XYZ. Limit the
  14. // TODO: Limit the brightness to the set of 4 different values 0, 85, 170, 255.
  15. // TODO: Set the RGBA values in the target array to this brightness.
  16. }