You are here

function pChart::drawAntialiasPixel in Visitors 8

Same name and namespace in other branches
  1. 7.0 pchart/pChart.inc \pChart::drawAntialiasPixel()
7 calls to pChart::drawAntialiasPixel()
pChart::drawCircle in pchart/pChart.inc
pChart::drawDottedLine in pchart/pChart.inc
pChart::drawFilledCircle in pchart/pChart.inc
pChart::drawFilledRoundedRectangle in pchart/pChart.inc
pChart::drawLine in pchart/pChart.inc

... See full list

File

pchart/pChart.inc, line 2468

Class

pChart

Code

function drawAntialiasPixel($X, $Y, $R, $G, $B) {
  if ($R < 0) {
    $R = 0;
  }
  if ($R > 255) {
    $R = 255;
  }
  if ($G < 0) {
    $G = 0;
  }
  if ($G > 255) {
    $G = 255;
  }
  if ($B < 0) {
    $B = 0;
  }
  if ($B > 255) {
    $B = 255;
  }
  $Plot = "";
  $Xi = floor($X);
  $Yi = floor($Y);
  if ($Xi == $X && $Yi == $Y) {

    /* $this->drawAlphaPixel($Xi,$Yi,0,$R,$G,$B); */
    $C_Aliased = imagecolorallocate($this->Picture, $R, $G, $B);
    imagesetpixel($this->Picture, $X, $Y, $C_Aliased);
  }
  else {
    $Alpha1 = (1 - ($X - floor($X))) * (1 - ($Y - floor($Y))) * 100;
    if ($Alpha1 > $this->AntialiasQuality) {
      $this
        ->drawAlphaPixel($Xi, $Yi, $Alpha1, $R, $G, $B);
    }
    $Alpha2 = ($X - floor($X)) * (1 - ($Y - floor($Y))) * 100;
    if ($Alpha2 > $this->AntialiasQuality) {
      $this
        ->drawAlphaPixel($Xi + 1, $Yi, $Alpha2, $R, $G, $B);
    }
    $Alpha3 = (1 - ($X - floor($X))) * ($Y - floor($Y)) * 100;
    if ($Alpha3 > $this->AntialiasQuality) {
      $this
        ->drawAlphaPixel($Xi, $Yi + 1, $Alpha3, $R, $G, $B);
    }
    $Alpha4 = ($X - floor($X)) * ($Y - floor($Y)) * 100;
    if ($Alpha4 > $this->AntialiasQuality) {
      $this
        ->drawAlphaPixel($Xi + 1, $Yi + 1, $Alpha4, $R, $G, $B);
    }
  }
}