本文整理汇总了PHP中FlagImages::GetImgByName方法的典型用法代码示例。如果您正苦于以下问题:PHP FlagImages::GetImgByName方法的具体用法?PHP FlagImages::GetImgByName怎么用?PHP FlagImages::GetImgByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlagImages
的用法示例。
在下文中一共展示了FlagImages::GetImgByName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: StrokeFrameBackground
function StrokeFrameBackground()
{
if ($this->background_image != "" && $this->background_cflag != "") {
JpGraphError::Raise('It is not possible to specify both a background image and a background country flag.');
}
if ($this->background_image != "") {
$bkgimg = $this->LoadBkgImage($this->background_image_format);
$this->img->_AdjBrightContrast($bkgimg, $this->background_image_bright, $this->background_image_contr);
$this->img->_AdjSat($bkgimg, $this->background_image_sat);
} elseif ($this->background_cflag != "") {
if (!class_exists('FlagImages')) {
JpGraphError::Raise('In order to use Country flags as
backgrounds you must include the "jpgraph_flags.php" file.');
}
$fobj = new FlagImages(FLAGSIZE4);
$dummy = '';
$bkgimg = $fobj->GetImgByName($this->background_cflag, $dummy);
$this->background_image_mix = $this->background_cflag_mix;
$this->background_image_type = $this->background_cflag_type;
} else {
return;
}
$bw = ImageSX($bkgimg);
$bh = ImageSY($bkgimg);
// No matter what the angle is we always stroke the image and frame
// assuming it is 0 degree
$aa = $this->img->SetAngle(0);
switch ($this->background_image_type) {
case BGIMG_FILLPLOT:
// Resize to just fill the plotarea
$this->FillMarginArea();
$this->StrokeFrame();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, $this->img->left_margin, $this->img->top_margin, 0, 0, $this->img->plotwidth + 1, $this->img->plotheight, $bw, $bh, $this->background_image_mix);
break;
case BGIMG_FILLFRAME:
// Fill the whole area from upper left corner, resize to just fit
$hadj = 0;
$vadj = 0;
if ($this->doshadow) {
$hadj = $this->shadow_width;
$vadj = $this->shadow_width;
}
$this->FillMarginArea();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, 0, 0, 0, 0, $this->img->width - $hadj, $this->img->height - $vadj, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_COPY:
// Just copy the image from left corner, no resizing
$this->FillMarginArea();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, 0, 0, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_CENTER:
// Center original image in the plot area
$this->FillMarginArea();
$this->FillPlotArea();
$centerx = round($this->img->plotwidth / 2 + $this->img->left_margin - $bw / 2);
$centery = round($this->img->plotheight / 2 + $this->img->top_margin - $bh / 2);
$this->img->CopyMerge($bkgimg, $centerx, $centery, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
default:
JpGraphError::Raise(" Unknown background image layout");
}
$this->img->SetAngle($aa);
}
示例3: elseif
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);
}
示例4: StrokeFrameBackground
public function StrokeFrameBackground()
{
if ($this->background_image != '' && $this->background_cflag != '') {
Util\JpGraphError::RaiseL(25040);
//('It is not possible to specify both a background image and a background country flag.');
}
if ($this->background_image != '') {
$bkgimg = $this->LoadBkgImage($this->background_image_format, $this->background_image);
} elseif ($this->background_cflag != '') {
if (!class_exists('FlagImages', false)) {
Util\JpGraphError::RaiseL(25041);
//('In order to use Country flags as backgrounds you must include the "jpgraph_flags.php" file.');
}
$fobj = new FlagImages(FLAGSIZE4);
$dummy = '';
$bkgimg = $fobj->GetImgByName($this->background_cflag, $dummy);
$this->background_image_mix = $this->background_cflag_mix;
$this->background_image_type = $this->background_cflag_type;
} else {
return;
}
$bw = ImageSX($bkgimg);
$bh = ImageSY($bkgimg);
// No matter what the angle is we always stroke the image and frame
// assuming it is 0 degree
$aa = $this->img->SetAngle(0);
switch ($this->background_image_type) {
case BGIMG_FILLPLOT:
// Resize to just fill the plotarea
$this->FillMarginArea();
$this->StrokeFrame();
// Special case to hande 90 degree rotated graph corectly
if ($aa == 90) {
$this->img->SetAngle(90);
$this->FillPlotArea();
$aa = $this->img->SetAngle(0);
$adj = ($this->img->height - $this->img->width) / 2;
$this->img->CopyMerge($bkgimg, $this->img->bottom_margin - $adj, $this->img->left_margin + $adj, 0, 0, $this->img->plotheight + 1, $this->img->plotwidth, $bw, $bh, $this->background_image_mix);
} else {
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, $this->img->left_margin, $this->img->top_margin + 1, 0, 0, $this->img->plotwidth + 1, $this->img->plotheight, $bw, $bh, $this->background_image_mix);
}
break;
case BGIMG_FILLFRAME:
// Fill the whole area from upper left corner, resize to just fit
$hadj = 0;
$vadj = 0;
if ($this->doshadow) {
$hadj = $this->shadow_width;
$vadj = $this->shadow_width;
}
$this->FillMarginArea();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, 0, 0, 0, 0, $this->img->width - $hadj, $this->img->height - $vadj, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_COPY:
// Just copy the image from left corner, no resizing
$this->FillMarginArea();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, 0, 0, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_CENTER:
// Center original image in the plot area
$this->FillMarginArea();
$this->FillPlotArea();
$centerx = round($this->img->plotwidth / 2 + $this->img->left_margin - $bw / 2);
$centery = round($this->img->plotheight / 2 + $this->img->top_margin - $bh / 2);
$this->img->CopyMerge($bkgimg, $centerx, $centery, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_FREE:
// Just copy the image to the specified location
$this->img->CopyMerge($bkgimg, $this->background_image_xpos, $this->background_image_ypos, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
// New
break;
default:
Util\JpGraphError::RaiseL(25042);
//(" Unknown background image layout");
}
$this->img->SetAngle($aa);
}
示例5: StrokeFrameBackground
function StrokeFrameBackground()
{
if ($this->background_image != "" && $this->background_cflag != "") {
JpGraphError::RaiseL(25040);
}
if ($this->background_image != "") {
$bkgimg = $this->LoadBkgImage($this->background_image_format, $this->background_image);
} elseif ($this->background_cflag != "") {
if (!class_exists('FlagImages')) {
JpGraphError::RaiseL(25041);
}
$fobj = new FlagImages(FLAGSIZE4);
$dummy = '';
$bkgimg = $fobj->GetImgByName($this->background_cflag, $dummy);
$this->background_image_mix = $this->background_cflag_mix;
$this->background_image_type = $this->background_cflag_type;
} else {
return;
}
$bw = ImageSX($bkgimg);
$bh = ImageSY($bkgimg);
$aa = $this->img->SetAngle(0);
switch ($this->background_image_type) {
case BGIMG_FILLPLOT:
$this->FillMarginArea();
$this->StrokeFrame();
if ($aa == 90) {
$this->img->SetAngle(90);
$this->FillPlotArea();
$aa = $this->img->SetAngle(0);
$adj = ($this->img->height - $this->img->width) / 2;
$this->img->CopyMerge($bkgimg, $this->img->bottom_margin - $adj, $this->img->left_margin + $adj, 0, 0, $this->img->plotheight + 1, $this->img->plotwidth, $bw, $bh, $this->background_image_mix);
} else {
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, $this->img->left_margin, $this->img->top_margin, 0, 0, $this->img->plotwidth + 1, $this->img->plotheight, $bw, $bh, $this->background_image_mix);
}
break;
case BGIMG_FILLFRAME:
$hadj = 0;
$vadj = 0;
if ($this->doshadow) {
$hadj = $this->shadow_width;
$vadj = $this->shadow_width;
}
$this->FillMarginArea();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, 0, 0, 0, 0, $this->img->width - $hadj, $this->img->height - $vadj, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_COPY:
$this->FillMarginArea();
$this->FillPlotArea();
$this->img->CopyMerge($bkgimg, 0, 0, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
case BGIMG_CENTER:
$this->FillMarginArea();
$this->FillPlotArea();
$centerx = round($this->img->plotwidth / 2 + $this->img->left_margin - $bw / 2);
$centery = round($this->img->plotheight / 2 + $this->img->top_margin - $bh / 2);
$this->img->CopyMerge($bkgimg, $centerx, $centery, 0, 0, $bw, $bh, $bw, $bh, $this->background_image_mix);
$this->StrokeFrame();
break;
default:
JpGraphError::RaiseL(25042);
}
$this->img->SetAngle($aa);
}
示例6: elseif
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);
}