// Import framework stuff
use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Traits\Template\CompileableTemplateTrait;
/**
* A general image class
*
* @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2020 Core Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2021 Core Developer Team
* @license GNU GPL 3.0 or any newer version
* @link http://www.shipsimu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseImage extends BaseFrameworkSystem implements Registerable {
+ // Load traits
+ use CompileableTemplateTrait;
+
/**
* Image type
*/
/**
* Width of the image
*/
- private $width = '';
+ private $width = 0;
/**
* Height of the image
*/
- private $height = '';
+ private $height = 0;
/**
* X/Y
*/
- private $x = '';
- private $y = '';
+ private $x = 0;
+ private $y = 0;
/**
* Font size
*/
- private $fontSize = '';
+ private $fontSize = 0;
/**
* Image string
/**
* Background color in RGB
*/
- private $backgroundColor = array(
+ private $backgroundColor = [
'red' => '',
'green' => '',
'blue' => ''
- );
+ ];
/**
* Foreground color in RGB
*/
- private $foregroundColor = array(
+ private $foregroundColor = [
'red' => '',
'green' => '',
'blue' => ''
- );
+ ];
/**
* Current choosen color array
* @param $colorChannel Red, green or blue channel?
* @param $colorValue Value to set
*/
- private final function setColor ($colorMode, $colorChannel, $colorValue) {
+ private final function setColor (string $colorMode, string $colorChannel, $colorValue) {
// Construct the eval() command
$eval = sprintf("\$this->%s['%s'] = \"%s\";",
$colorMode,
* @param $width Width of the image
* @return void
*/
- public final function setWidth ($width) {
+ public final function setWidth (int $width) {
$this->width = $width;
}
* @param $height Height of the image
* @return void
*/
- public final function setHeight ($height) {
+ public final function setHeight (int $height) {
$this->height = $height;
}
* @return void
* @todo Find something usefull for this method.
*/
- public function initImageString ($groupable = 'single') {
+ public function initImageString (string $groupable = 'single') {
$this->groupable = $groupable;
}
* @return void
*/
public final function setRed ($red) {
- // Get array name
- $arrayName = $this->colorMode;
-
// Set image color
- $this->setColor($arrayName, 'red', $red);
+ $this->setColor($this->colorMode, 'red', $red);
}
/**
* @return void
*/
public final function setGreen ($green) {
- // Get array name
- $arrayName = $this->colorMode;
-
// Set image color
- $this->setColor($arrayName, 'green', $green);
+ $this->setColor($this->colorMode, 'green', $green);
}
/**
* @return void
*/
public final function setBlue ($blue) {
- // Get array name
- $arrayName = $this->colorMode;
-
// Set image color
- $this->setColor($arrayName, 'blue', $blue);
+ $this->setColor($this->colorMode, 'blue', $blue);
}
/**
* @param $string String to set in image
* @return void
*/
- public final function setString ($string) {
- $this->imageString = (string) $string;
+ public final function setString (string $string) {
+ $this->imageString = $string;
}
/**
* @param $imageType Type to set in image
* @return void
*/
- protected final function setImageType ($imageType) {
- $this->imageType = (string) $imageType;
+ protected final function setImageType (string $imageType) {
+ $this->imageType = $imageType;
}
/**
* @param $name Name of the image
* @return void
*/
- public final function setImageName ($name) {
- $this->imageName = (string) $name;
+ public final function setImageName (string $name) {
+ $this->imageName = $name;
}
/**
* @param $x X coordinate
* @return void
*/
- public final function setX ($x) {
+ public final function setX (int $x) {
$this->x = $x;
}
* @param $y Y coordinate
* @return void
*/
- public final function setY ($y) {
+ public final function setY (int $y) {
$this->y = $y;
}
* @param $fontSize Font size for strings
* @return void
*/
- public final function setFontSize ($fontSize) {
+ public final function setFontSize (int $fontSize) {
$this->fontSize = $fontSize;
}
* @param $stringName String name to set
* @return void
*/
- public final function setStringName($stringName) {
+ public final function setStringName(string $stringName) {
$this->stringName = $stringName;
}
// Set the image string
//* DEBUG: */ print __METHOD__.": size={$size}, x={$x}, y={$y}, string={$imageString}<br />\n";
imagestring($this->getImageResource(), $size, $x, $y, $imageString, $foreColor);
- } // END - foreach
+ }
break;
}