| Extracted from Pike v7.8 release 866 at 2018-02-09.

[Top]
Image
Image.Image

# Method Image.Image()->distancesq()

Method distancesq

  `object distancesq()`
  `object distancesq(int r, int g, int b)`

Description

  Makes an grey-scale image, for alpha-channel use.

  The given value (or current color) are used for coordinates in the color cube. Each resulting pixel is the distance from this point to the source pixel color, in the color cube, squared, rightshifted 8 steps:

      p = pixel color
      o = given color
      d = destination pixel
      d.red=d.blue=d.green=
          ((o.red-p.red)²+(o.green-p.green)²+(o.blue-p.blue)²)>>8

  original | distance² to cyan | ...to purple | ...to yellow

Parameter `r`
Parameter `g`
Parameter `b`

  red, green, blue coordinates

Returns

  the new image object

See also

  select_from