+
    6j                     *    R t R tR t ! R R4      tR# )a7  Recolour a palette by decomposing each pixel into a blend of two anchors.

The upstream assets antialias by blending between two theme colours rather than
by alpha alone -- a checkmark, for instance, fades from the accent fill to
white across two pixels. Mapping colours one at a time would leave those
gradients stranded between the old palette and the new.

So for each input colour we find the anchor pair (a, b) and the blend factor t
that best explain it, then emit the same blend of the mapped anchors (a', b').
Exact anchors fall out as the t=0 and t=1 cases.
c                     V ^ ,          V^ ,          ,
          V ^,          V^,          ,
          V ^,          V^,          ,
          3#      pqs   &&9/home/stevedylandev/Developer/Darkmatter/src/lib/remap.py_subr
      s3    aD1Q4K1!adQqTk22    c                     V ^ ,          V^ ,          ,          V ^,          V^,          ,          ,           V ^,          V^,          ,          ,           # r   r   r   s   &&r	   _dotr      s6    Q4!A$;1!$qtad{22r   c                   2   a  ] tR t^t o R tR tR tRtV tR# )Remapperc                4    \        V4      V n        / V n        R# )z1anchors: list of (source_rgb, target_rgb) tuples.N)listanchors_cache)selfr   s   &&r	   __init__Remapper.__init__   s    G}r   c                    V P                   P                  V4      pVf    V P                  V4      ;q P                   V&   V# N)r   get_solve)r   colorhits   && r	   __call__Remapper.__call__   s8    kkooe$;'+{{5'99C++e$
r   c                ,  aaa R pR p\        V P                  4       EF:  w  pw  poV P                  VR   EF  w  po\        We4      p\        Ww4      pV^ 8X  d   RoM0\        \        W4      V4      V,          oS^ 8  d   RM
S^8  d   RMSoV^ ,          SV^ ,          ,          ,           V^,          SV^,          ,          ,           V^,          SV^,          ,          ,           3p	\        W4      p
\        W4      pVe	   W8  g   K  Tp\        ;QJ d"    . VVV3R l\        ^4       4       F  NK  	  5M! VVV3R l\        ^4       4       4      pEK  	  EK=  	  \        ;QJ d    . R R V 4        4       F  NK  	  5# ! R R V 4        4       4      # )Ng        g      ?c              3   |   <"   T F1  pSV,          SSV,          SV,          ,
          ,          ,           x  K3  	  R # 5ir   r   ).0ka_dstb_dstts   & r	   	<genexpr>"Remapper._solve.<locals>.<genexpr>3   s2      !FNa1a58(;#<<<hs   9<c              3   J   "   T F  pV^ 8  d   ^ M
V^8  d   ^MTx  K  	  R# 5i)r   Nr   )r!   vs   & r	   r&   r'   6   s*      
2 QAAGS32   !#c              3   J   "   T F  p\        \        V4      4      x  K  	  R # 5ir   )intround)r!   xs   & r	   r&   r'   8   s     2Tc%(mmTr*   )	enumerater   r
   r   tuplerange)r   cbest_errbestia_srcb_srcr)   vvprojderrr#   r$   r%   s   &&          @@@r	   r   Remapper._solve"   s^   !*4<<!8A~u $QR 0u&!Z7AT!^Q/"4A 1u!a%3QAa1qt8+U1XAaD-@%(QQRSTQUXBUVM1j#s~"H 5 !FKAh!55 !FKAh! D !1 "9" u 
2T2
u 	
u 
2T2
 
 	
r   )r   r   N)	__name__
__module____qualname____firstlineno__r   r   r   __static_attributes____classdictcell__)__classdict__s   @r	   r   r      s     

 
r   r   N)__doc__r
   r   r   r   r   r	   <module>rE      s   
33#
 #
r   