preserve import { AbstractDistanceCalculator } from './distanceCalculator' ; /**
 * TODO: Name it: http://www.compuphase.com/cmetric.htm
 */ export class CMetric extends AbstractDistanceCalculator { calculateRaw ( r1 , g1 , b1 , a1 , r2 , g2 , b2 , a2 ) { const rmean = ( ( r1 + r2 ) / 2 ) * this . _whitePoint . r ; const r = ( r1 - r2 ) * this . _whitePoint . r ; const g = ( g1 - g2 ) * this . _whitePoint . g ; const b = ( b1 - b2 ) * this . _whitePoint . b ; const dE = ( ( ( 512 + rmean ) * r * r ) >> 8 ) + 4 * g * g + ( ( ( 767 - rmean ) * b * b ) >> 8 ) ; const dA = ( a2 - a1 ) * this . _whitePoint . a ; return Math . sqrt ( dE + dA * dA ) ; } protected _setDefaults ( ) { } }