You are here

function pChart::loadColorPalette in Visitors 8

Same name and namespace in other branches
  1. 7.0 pchart/pChart.inc \pChart::loadColorPalette()

File

pchart/pChart.inc, line 187

Class

pChart

Code

function loadColorPalette($FileName, $Delimiter = ",") {
  $handle = @fopen($FileName, "r");
  $ColorID = 0;
  if ($handle) {
    while (!feof($handle)) {
      $buffer = fgets($handle, 4096);
      $buffer = str_replace(chr(10), "", $buffer);
      $buffer = str_replace(chr(13), "", $buffer);
      $Values = split($Delimiter, $buffer);
      if (count($Values) == 3) {
        $this->Palette[$ColorID]["R"] = $Values[0];
        $this->Palette[$ColorID]["G"] = $Values[1];
        $this->Palette[$ColorID]["B"] = $Values[2];
        $ColorID++;
      }
    }
  }
}