eXorithm – Execute Algorithm: View / Run Algorithm antialias_pixel

Logo Beta

function antialias_pixel ($image$x$y$color$weight

{

  $c = imagecolorsforindex$image$color);

  $r1 = $c'red'];

  $g1 = $c'green'];

  $b1 = $c'blue'];

  $t1 = $c'alpha'];

  

  $color2 = imagecolorat$image$x$y);

  $c = imagecolorsforindex$image$color2);

  $r2 = $c'red'];

  $g2 = $c'green'];

  $b2 = $c'blue'];

  $t2 = $c'alpha'];

  

  $cweight = $weight+($t1/127)*(1-$weight)-($t2/127)*(1-$weight);

  

  $r = round$r2$cweight + $r1*(1-$cweight));

  $g = round$g2$cweight + $g1*(1-$cweight));

  $b = round$b2$cweight + $b1*(1-$cweight));

  

  $t = round$t2$weight + $t1*(1-$weight));

  

  return imagecolorallocatealpha$image$r$g$b$t);