本文整理汇总了PHP中Graph::LoadBkgImage方法的典型用法代码示例。如果您正苦于以下问题:PHP Graph::LoadBkgImage方法的具体用法?PHP Graph::LoadBkgImage怎么用?PHP Graph::LoadBkgImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph::LoadBkgImage方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($aIcon, $aScale = 1)
{
global $_gPredefIcons;
if (is_string($aIcon)) {
$this->iGDImage = Graph::LoadBkgImage('', $aIcon);
} elseif (is_integer($aIcon)) {
// Builtin image
$this->iGDImage = $_gPredefIcons->GetImg($aIcon);
} else {
Util\JpGraphError::RaiseL(6011);
//('Argument to IconImage must be string or integer');
}
$this->iScale = $aScale;
$this->iWidth = Image::GetWidth($this->iGDImage);
$this->iHeight = Image::GetHeight($this->iGDImage);
}
示例2: Stroke
function Stroke($aImg)
{
if ($this->iFile != '' && $this->iCountryFlag != '') {
JpGraphError::Raise('It is not possible to specify both an image file and a country flag for the same icon.');
}
if ($this->iFile != '') {
$gdimg = Graph::LoadBkgImage('', $this->iFile);
} else {
if (!class_exists('FlagImages')) {
JpGraphError::Raise('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
}
$fobj = new FlagImages($this->iCountryStdSize);
$dummy = '';
$gdimg = $fobj->GetImgByName($this->iCountryFlag, $dummy);
}
if ($this->iX >= 0 && $this->iX <= 1.0) {
$w = imagesx($aImg->img);
$this->iX = round($w * $this->iX);
}
if ($this->iY >= 0 && $this->iY <= 1.0) {
$h = imagesy($aImg->img);
$this->iY = round($h * $this->iY);
}
$iconw = imagesx($gdimg);
$iconh = imagesy($gdimg);
if ($this->iHorAnchor == 'center') {
$this->iX -= round($iconw * $this->iScale / 2);
}
if ($this->iHorAnchor == 'right') {
$this->iX -= round($iconw * $this->iScale);
}
if ($this->iVertAnchor == 'center') {
$this->iY -= round($iconh * $this->iScale / 2);
}
if ($this->iVertAnchor == 'bottom') {
$this->iY -= round($iconh * $this->iScale);
}
$aImg->CopyMerge($gdimg, $this->iX, $this->iY, 0, 0, round($iconw * $this->iScale), round($iconh * $this->iScale), $iconw, $iconh, $this->iMix);
}
示例3: _strokeBackgroundImage
function _strokeBackgroundImage()
{
if ($this->background_image == '') {
return;
}
$bkgimg = Graph::LoadBkgImage('', $this->background_image);
// Background width & Heoght
$bw = imagesx($bkgimg);
$bh = imagesy($bkgimg);
// Canvas width and height
$cw = imagesx($this->img);
$ch = imagesy($this->img);
if ($this->doshadow) {
$cw -= $this->shadow_width;
$ch -= $this->shadow_width;
}
if ($this->background_image_x === NULL || $this->background_image_y === NULL) {
if ($this->background_image_center) {
// Center original image in the plot area
$x = round($cw / 2 - $bw / 2);
$y = round($ch / 2 - $bh / 2);
} else {
// Just copy the image from left corner, no resizing
$x = 0;
$y = 0;
}
} else {
$x = $this->background_image_x;
$y = $this->background_image_y;
}
imagecopymerge($this->img, $bkgimg, $x, $y, 0, 0, $bw, $bh, $this->background_image_mix);
}
示例4: Stroke
function Stroke($img, $x, $y)
{
if (!$this->show) {
return;
}
if ($this->iFormatCallback != '' || $this->iFormatCallback2 != '') {
if ($this->iFormatCallback != '') {
$f = $this->iFormatCallback;
list($width, $color, $fcolor) = call_user_func($f, $this->yvalue);
$filename = $this->iFileName;
$imgscale = $this->iScale;
} else {
$f = $this->iFormatCallback2;
list($width, $color, $fcolor, $filename, $imgscale) = call_user_func($f, $this->yvalue, $this->xvalue);
if ($filename == "") {
$filename = $this->iFileName;
}
if ($imgscale == "") {
$imgscale = $this->iScale;
}
}
if ($width == "") {
$width = $this->width;
}
if ($color == "") {
$color = $this->color;
}
if ($fcolor == "") {
$fcolor = $this->fill_color;
}
} else {
$fcolor = $this->fill_color;
$color = $this->color;
$width = $this->width;
$filename = $this->iFileName;
$imgscale = $this->iScale;
}
if ($this->type == MARK_IMG || $this->type >= MARK_FLAG1 && $this->type <= MARK_FLAG4 || $this->type >= MARK_IMG_PUSHPIN) {
// Note: For the builtin images we use the "filename" parameter
// to denote the color
$anchor_x = 0.5;
$anchor_y = 0.5;
switch ($this->type) {
case MARK_FLAG1:
case MARK_FLAG2:
case MARK_FLAG3:
case MARK_FLAG4:
$this->markimg = FlagCache::GetFlagImgByName($this->type - MARK_FLAG1 + 1, $filename);
break;
case MARK_IMG:
// Load an image and use that as a marker
// Small optimization, if we have already read an image don't
// waste time reading it again.
if ($this->markimg == '' || !($this->oldfilename === $filename)) {
$this->markimg = Graph::LoadBkgImage('', $filename);
$this->oldfilename = $filename;
}
break;
case MARK_IMG_PUSHPIN:
case MARK_IMG_SPUSHPIN:
case MARK_IMG_LPUSHPIN:
if ($this->imgdata_pushpins == null) {
require_once 'imgdata_pushpins.inc.php';
$this->imgdata_pushpins = new ImgData_PushPins();
}
$this->markimg = $this->imgdata_pushpins->GetImg($this->type, $filename);
list($anchor_x, $anchor_y) = $this->imgdata_pushpins->GetAnchor();
break;
case MARK_IMG_SQUARE:
if ($this->imgdata_squares == null) {
require_once 'imgdata_squares.inc.php';
$this->imgdata_squares = new ImgData_Squares();
}
$this->markimg = $this->imgdata_squares->GetImg($this->type, $filename);
list($anchor_x, $anchor_y) = $this->imgdata_squares->GetAnchor();
break;
case MARK_IMG_STAR:
if ($this->imgdata_stars == null) {
require_once 'imgdata_stars.inc.php';
$this->imgdata_stars = new ImgData_Stars();
}
$this->markimg = $this->imgdata_stars->GetImg($this->type, $filename);
list($anchor_x, $anchor_y) = $this->imgdata_stars->GetAnchor();
break;
case MARK_IMG_BEVEL:
if ($this->imgdata_bevels == null) {
require_once 'imgdata_bevels.inc.php';
$this->imgdata_bevels = new ImgData_Bevels();
}
$this->markimg = $this->imgdata_bevels->GetImg($this->type, $filename);
list($anchor_x, $anchor_y) = $this->imgdata_bevels->GetAnchor();
break;
case MARK_IMG_DIAMOND:
if ($this->imgdata_diamonds == null) {
require_once 'imgdata_diamonds.inc.php';
$this->imgdata_diamonds = new ImgData_Diamonds();
}
$this->markimg = $this->imgdata_diamonds->GetImg($this->type, $filename);
list($anchor_x, $anchor_y) = $this->imgdata_diamonds->GetAnchor();
break;
//.........这里部分代码省略.........
示例5: _Stroke
function _Stroke($aImg, $x = null, $y = null, $aReturnWidthHeight = false)
{
if ($this->iFile != '' && $this->iCountryFlag != '') {
JpGraphError::RaiseL(8003);
//('It is not possible to specify both an image file and a country flag for the same icon.');
}
if ($this->iFile != '') {
$gdimg = Graph::LoadBkgImage('', $this->iFile);
} elseif ($this->iImgString != '') {
$gdimg = Image::CreateFromString($this->iImgString);
} else {
if (!class_exists('FlagImages', false)) {
JpGraphError::RaiseL(8004);
//('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
}
$fobj = new FlagImages($this->iCountryStdSize);
$dummy = '';
$gdimg = $fobj->GetImgByName($this->iCountryFlag, $dummy);
}
$iconw = imagesx($gdimg);
$iconh = imagesy($gdimg);
if ($aReturnWidthHeight) {
return array(round($iconw * $this->iScale), round($iconh * $this->iScale));
}
if ($x !== null && $y !== null) {
$this->iX = $x;
$this->iY = $y;
}
if ($this->iX >= 0 && $this->iX <= 1.0) {
$w = imagesx($aImg->img);
$this->iX = round($w * $this->iX);
}
if ($this->iY >= 0 && $this->iY <= 1.0) {
$h = imagesy($aImg->img);
$this->iY = round($h * $this->iY);
}
if ($this->iHorAnchor == 'center') {
$this->iX -= round($iconw * $this->iScale / 2);
}
if ($this->iHorAnchor == 'right') {
$this->iX -= round($iconw * $this->iScale);
}
if ($this->iVertAnchor == 'center') {
$this->iY -= round($iconh * $this->iScale / 2);
}
if ($this->iVertAnchor == 'bottom') {
$this->iY -= round($iconh * $this->iScale);
}
$aImg->CopyMerge($gdimg, $this->iX, $this->iY, 0, 0, round($iconw * $this->iScale), round($iconh * $this->iScale), $iconw, $iconh, $this->iMix);
}
示例6: IconImage
function IconImage($aIcon, $aScale = 1)
{
global $_gPredefIcons;
if (is_string($aIcon)) {
$this->iGDImage = Graph::LoadBkgImage('', $aIcon);
} elseif (is_integer($aIcon)) {
$this->iGDImage = $_gPredefIcons->GetImg($aIcon);
} else {
JpGraphError::RaiseL(6011);
}
$this->iScale = $aScale;
$this->iWidth = Image::GetWidth($this->iGDImage);
$this->iHeight = Image::GetHeight($this->iGDImage);
}
示例7: _Stroke
function _Stroke(&$aImg, $x = null, $y = null, $aReturnWidthHeight = false)
{
if ($this->iFile != '' && $this->iCountryFlag != '') {
JpGraphError::RaiseL(8003);
}
if ($this->iFile != '') {
$gdimg = Graph::LoadBkgImage('', $this->iFile);
} elseif ($this->iImgString != '') {
$gdimg = Image::CreateFromString($this->iImgString);
} else {
if (!class_exists('FlagImages')) {
JpGraphError::RaiseL(8004);
}
$fobj = new FlagImages($this->iCountryStdSize);
$dummy = '';
$gdimg = $fobj->GetImgByName($this->iCountryFlag, $dummy);
}
$iconw = imagesx($gdimg);
$iconh = imagesy($gdimg);
if ($aReturnWidthHeight) {
return array(round($iconw * $this->iScale), round($iconh * $this->iScale));
}
if ($x !== null && $y !== null) {
$this->iX = $x;
$this->iY = $y;
}
if ($this->iX >= 0 && $this->iX <= 1.0) {
$w = imagesx($aImg->img);
$this->iX = round($w * $this->iX);
}
if ($this->iY >= 0 && $this->iY <= 1.0) {
$h = imagesy($aImg->img);
$this->iY = round($h * $this->iY);
}
if ($this->iHorAnchor == 'center') {
$this->iX -= round($iconw * $this->iScale / 2);
}
if ($this->iHorAnchor == 'right') {
$this->iX -= round($iconw * $this->iScale);
}
if ($this->iVertAnchor == 'center') {
$this->iY -= round($iconh * $this->iScale / 2);
}
if ($this->iVertAnchor == 'bottom') {
$this->iY -= round($iconh * $this->iScale);
}
$aImg->CopyMerge($gdimg, $this->iX, $this->iY, 0, 0, round($iconw * $this->iScale), round($iconh * $this->iScale), $iconw, $iconh, $this->iMix);
}
示例8: IconImage
function IconImage($aIcon,$aScale=1) {
GLOBAL $_gPredefIcons ;
if( is_string($aIcon) ) {
$this->iGDImage = Graph::LoadBkgImage('',$aIcon);
}
elseif( is_integer($aIcon) ) {
// Builtin image
$this->iGDImage = $_gPredefIcons->GetImg($aIcon);
}
else {
JpGraphError::Raise('Argument to IconImage must be string or integer');
}
$this->iScale = $aScale;
$this->iWidth = Image::GetWidth($this->iGDImage);
$this->iHeight = Image::GetHeight($this->iGDImage);
}