r = max($rgb[0] / 255.0, 0);
$this->g = max($rgb[1] / 255.0, 0);
$this->b = max($rgb[2] / 255.0, 0);
$this->transparent = $transparent;
}
function apply(&$viewport) {
$viewport->setrgbcolor($this->r, $this->g, $this->b);
}
function blend($color, $alpha) {
$this->r += ($color->r - $this->r)*$alpha;
$this->g += ($color->g - $this->g)*$alpha;
$this->b += ($color->b - $this->b)*$alpha;
}
function ©() {
$color =& new Color();
$color->r = $this->r;
$color->g = $this->g;
$color->b = $this->b;
$color->transparent = $this->transparent;
return $color;
}
function equals($rgb) {
return
$this->r == $rgb->r &&
$this->g == $rgb->g &&
$this->b == $rgb->b;
}
function isTransparent() {
return $this->transparent;
}
}
?>