X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/19e297c21b10b1b8a3acad5e73fc71dcb35db44a..6932310fd58ebef145fa01eb76edf7150284d8ea:/vendor/stil/gd-text/src/Color.php diff --git a/vendor/stil/gd-text/src/Color.php b/vendor/stil/gd-text/src/Color.php new file mode 100644 index 00000000..10238b98 --- /dev/null +++ b/vendor/stil/gd-text/src/Color.php @@ -0,0 +1,72 @@ +red = $red; + $this->green = $green; + $this->blue = $blue; + $this->alpha = $alpha; + } + + /** + * @param resource $image GD image resource + * @return int Returns the index of the specified color+alpha in the palette of the image, + * or -1 if the color does not exist in the image's palette. + */ + public function getIndex($image) + { + if ($this->hasAlphaChannel()) { + return imagecolorexactalpha( + $image, + $this->red, + $this->green, + $this->blue, + $this->alpha + ); + } else { + return imagecolorexact( + $image, + $this->red, + $this->green, + $this->blue + ); + } + } + + /** + * @return bool TRUE when alpha channel is specified, FALSE otherwise + */ + public function hasAlphaChannel() + { + return $this->alpha !== null; + } +} \ No newline at end of file