當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Imagick::newPseudoImage方法代碼示例

本文整理匯總了PHP中Imagick::newPseudoImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP Imagick::newPseudoImage方法的具體用法?PHP Imagick::newPseudoImage怎麽用?PHP Imagick::newPseudoImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Imagick的用法示例。


在下文中一共展示了Imagick::newPseudoImage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: renderDistanceEuclidian

 private function renderDistanceEuclidian()
 {
     $canvas = new \Imagick();
     $canvas->newPseudoImage(500, 300, "canvas:none");
     $canvas->setImageFormat('png');
     $shadow = clone $canvas;
     $text = clone $canvas;
     $this->drawText($text);
     $this->drawText($shadow, true);
     if (false) {
         $highlight = $this->getSilhouette($text);
         $kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_EUCLIDEAN, "1");
         $highlight->morphology(\Imagick::MORPHOLOGY_DISTANCE, 1, $kernel);
         $highlight->autoLevelImage();
         $highlight->evaluateimage(\Imagick::EVALUATE_MULTIPLY, 0.6);
         $highlight->evaluateimage(\Imagick::EVALUATE_ADD, 0.2 * \Imagick::getQuantum());
         $highlight->levelImage(0.2, 1.4, 0.6);
         $text->compositeimage($highlight, \Imagick::COMPOSITE_MODULATE, 0, 0);
     }
     if (true) {
         $edge = $this->getSilhouette($text);
         $kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_OCTAGON, "2");
         $edge->morphology(\Imagick::MORPHOLOGY_EDGE_IN, 1, $kernel);
         $edge->compositeImage($text, \Imagick::COMPOSITE_ATOP, 0, 0);
     }
     $canvas->compositeImage($shadow, \Imagick::COMPOSITE_COPY, 0, 0);
     $canvas->compositeImage($text, \Imagick::COMPOSITE_ATOP, 0, 0);
     header("Content-Type: image/png");
     echo $canvas->getImageBlob();
 }
開發者ID:sdmmember,項目名稱:Imagick-demos,代碼行數:30,代碼來源:fontEffect.php

示例2: fx

 /**
  *
  * @param mixed color
  * @param float opacity
  */
 public function fx($color = 'black', $opacity = 0.3)
 {
     $this->im->setImageFormat('png');
     $reflection = $this->im->clone();
     $reflection->flipImage();
     $gradient = new Imagick();
     $gradient->newPseudoImage($reflection->getImageWidth(), $reflection->getImageHeight(), "gradient:transparent-{$color}");
     $reflection->compositeImage($gradient, imagick::COMPOSITE_OVER, 0, 0);
     $reflection->setImageOpacity($opacity);
     $canvas = new Imagick();
     $canvas->newImage($this->im->getImageWidth(), $this->im->getImageHeight() * 2, $color, "png");
     $canvas->compositeImage($this->im, imagick::COMPOSITE_OVER, 0, 0);
     $canvas->compositeImage($reflection, imagick::COMPOSITE_OVER, 0, $this->im->getImageHeight());
     return $canvas;
 }
開發者ID:raspi,項目名稱:iMagickFx,代碼行數:20,代碼來源:reflection.php

示例3: gradientRight

function gradientRight($width, $height)
{
    $imagick = new Imagick();
    $imagick->newPseudoImage($width, $height, 'gradient:white-black');
    $imagick->rotateImage('none', 90);
    return $imagick;
}
開發者ID:atawsports2,項目名稱:Imagick-demos,代碼行數:7,代碼來源:createSourceImages.php

示例4: renderImage3

 public function renderImage3()
 {
     $gradient = new \Imagick();
     $gradient->newPseudoImage(1, 256, "gradient:white-black");
     $newImage = $gradient->fxImage("floor(u*10+0.5)/10");
     $newImage->setimageformat('jpg');
     header("Content-Type: image/jpg");
     echo $newImage;
 }
開發者ID:finelinePG,項目名稱:imagick,代碼行數:9,代碼來源:fxImage.php

示例5: example4

 public function example4()
 {
     $graphWidth = 256;
     $imagick = new \Imagick();
     $imagick->newPseudoImage($graphWidth, 1, 'gradient:black-white');
     $arguments = array(9, -90);
     $imagick->functionImage(\Imagick::FUNCTION_SINUSOID, $arguments);
     $fx = "(1.0/(1.0+exp(10.0*(0.5-u)))-0.006693)*1.0092503";
     $fxImage = $imagick->fxImage($fx);
     fxAnalyzeImage($fxImage);
 }
開發者ID:finelinePG,項目名稱:imagick,代碼行數:11,代碼來源:fxAnalyzeImage.php

示例6: render

 public function render()
 {
     //Example ImagickPixel::getColorCount
     $imagick = new \Imagick();
     $imagick->newPseudoImage(640, 480, "magick:logo");
     $histogramElements = $imagick->getImageHistogram();
     $lastColor = array_pop($histogramElements);
     $color = $lastColor->getColor();
     $output = sprintf("ColorCount last pixel = %d\nColor is R %d G %d B %d", $lastColor->getColorCount(), $color['r'], $color['g'], $color['b']);
     return nl2br($output);
     //Example end
 }
開發者ID:danack,項目名稱:imagick-demos,代碼行數:12,代碼來源:getColorCount.php

示例7: draw

 public function draw(OsuSignature $signature)
 {
     if (empty($this->hexColour)) {
         $this->hexColour = $signature->getHexColour();
     }
     $composite = new Imagick();
     $composite->newPseudoImage($this->getWidth(), $this->getHeight(), "canvas:transparent");
     // Background
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel("#555555"));
     $draw->rectangle(0, 0, $this->getWidth(), $this->getHeight());
     $composite->drawImage($draw);
     // Main bar
     $level = $signature->getUser()['level'];
     $xp = $level - floor($level);
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel($this->hexColour));
     $draw->rectangle(0, 0, $this->getWidth() * $xp, $this->getHeight());
     $composite->drawImage($draw);
     // Bar end glow
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel('#ffffff'));
     $draw->setFillOpacity(0.35);
     $draw->rectangle($this->getWidth() * $xp - $this->getHeight(), 0, $this->getWidth() * $xp, $this->getHeight());
     $composite->drawImage($draw);
     // Text draw & metrics
     $textDraw = new ImagickDraw();
     $textDraw->setFillColor(new ImagickPixel('#555555'));
     $textDraw->setFontSize(12);
     $textDraw->setFont(ComponentLabel::FONT_DIRECTORY . ComponentLabel::FONT_REGULAR);
     $textDraw->setGravity(Imagick::GRAVITY_NORTHWEST);
     $metrics = $composite->queryFontMetrics($textDraw, 'lv' . floor($level));
     // Text white bg
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel('#ffffff'));
     $draw->rectangle(($this->getWidth() - $metrics['textWidth']) / 2 - 2, 0, ($this->getWidth() + $metrics['textWidth']) / 2 + 1, $this->getHeight());
     $composite->drawImage($draw);
     // Rounding
     $roundMask = new Imagick();
     $roundMask->newPseudoImage($this->getWidth(), $this->getHeight(), "canvas:transparent");
     $draw = new ImagickDraw();
     $draw->setFillColor(new ImagickPixel("black"));
     $draw->roundRectangle(0, 0, $this->getWidth() - 1, $this->getHeight() - 1, $this->rounding, $this->rounding);
     $roundMask->drawImage($draw);
     $roundMask->setImageFormat('png');
     $composite->compositeImage($roundMask, Imagick::COMPOSITE_DSTIN, 0, 0, Imagick::CHANNEL_ALPHA);
     $signature->getCanvas()->compositeImage($composite, Imagick::COMPOSITE_DEFAULT, $this->x, $this->y);
     // Level text
     $signature->getCanvas()->annotateImage($textDraw, $this->x + ($this->getWidth() - $metrics['textWidth']) / 2, $this->y + ($this->getHeight() - $metrics['textHeight']) / 2 - 2, 0, 'lv' . floor($level));
 }
開發者ID:BTCTaras,項目名稱:osusig,代碼行數:50,代碼來源:ComponentXPBar.php

示例8: renderCustomImage

 function renderCustomImage()
 {
     $size = 400;
     $imagick1 = new \Imagick();
     //$imagick1->newPseudoImage($size, $size, 'gradient:black-white');
     $imagick1->setColorspace(\Imagick::COLORSPACE_GRAY);
     //$imagick1->setColorspace(\Imagick::COLORSPACE_RGB);
     //$imagick1->setColorspace(\Imagick::COLORSPACE_SRGB);
     $imagick1->setColorspace(\Imagick::COLORSPACE_CMYK);
     $imagick1->newPseudoImage($size, $size, 'gradient:gray(100%)-gray(0%)');
     $imagick1->setFormat('png');
     //analyzeImage($imagick1);
     header("Content-Type: image/png");
     echo $imagick1->getImageBlob();
 }
開發者ID:sdmmember,項目名稱:Imagick-demos,代碼行數:15,代碼來源:colorspaceLinearity.php

示例9: renderCustomImage

 public function renderCustomImage()
 {
     $size = 200;
     $imagick1 = new \Imagick();
     $imagick1->newPseudoImage($size, $size, 'gradient:black-white');
     $arguments = array(9, -90);
     $imagick1->functionImage(\Imagick::FUNCTION_SINUSOID, $arguments);
     $imagick2 = new \Imagick();
     $imagick2->newPseudoImage($size, $size, 'gradient:black-white');
     $arguments = array(0.5, 0);
     $imagick2->functionImage(\Imagick::FUNCTION_SINUSOID, $arguments);
     $imagick1->compositeimage($imagick2, \Imagick::COMPOSITE_MULTIPLY, 0, 0);
     $imagick1->setimageformat('png');
     header("Content-Type: image/png");
     echo $imagick1->getImageBlob();
 }
開發者ID:atawsports2,項目名稱:Imagick-demos,代碼行數:16,代碼來源:functionImage.php

示例10: gameSummary

function gameSummary(&$canvas, $o)
{
    $maxHeight = 910;
    $width = 980;
    $height = $maxHeight;
    $plays = new Imagick();
    $plays->newPseudoImage($width, $height, 'xc:none');
    $teams = array();
    $teams['V'] = fetchTeam($o['vTeam']);
    $teams['H'] = fetchTeam($o['hTeam']);
    $bodyHeight = 200;
    $path = "http://www.sidearmstats.com/rpi/mhockey/1.xml";
    $path = "sidearm.xml";
    $path = $o['liveStatsXML'];
    $scores = getGameSummaryInfo($path);
    $vOffset = 0;
    $lastPeriod = 0;
    $playIndex = 0;
    foreach ($scores->score as $score) {
        $playIndex++;
        if ($vOffset + 150 > $maxHeight && $o["numPlays"] == "auto") {
            break;
        } else {
            if ($o["numPlays"] != "auto" && $o["numPlays"] + $o["startIndex"] < $playIndex) {
                break;
            }
        }
        if ($o["startIndex"] + 1 > $playIndex) {
            continue;
        }
        if ($vOffset > 0) {
            $plays->compositeImage(fillRectangle(960, 2, '#FFF'), imagick::COMPOSITE_OVER, 0, $vOffset);
        }
        if ($score['prd'] + 0 != $lastPeriod) {
            $lastPeriod = $score['prd'] + 0;
            $plays->compositeImage(periodLabel($lastPeriod), imagick::COMPOSITE_OVER, 0, $vOffset);
            $vOffset += 50;
            $plays->compositeImage(fillRectangle(960, 2, '#FFF'), imagick::COMPOSITE_OVER, 0, $vOffset);
        }
        $plays->compositeImage(scoringPlay($score, $teams), imagick::COMPOSITE_OVER, 0, $vOffset);
        $vOffset += 100;
        //print_r($score);
    }
    addGeoToCanvas($canvas, array('type' => 'flexBox', 'w' => 1920, 'h' => 1080, 'x' => 0, 'y' => 0, 'bodyText' => '', 'boxHeight' => $vOffset, 'boxWidth' => 1000, 'boxOffset' => 'auto', 'boxPadding' => 10, 'titleColor' => $o['barColor'], 'titleHeight' => '70', 'titleText' => $o['titleText'], 'titleGravity' => 'center', 'logoHeight' => 100, 'logoLeft' => $teams['H']['logo'], 'logoRight' => $teams['V']['logo']));
    $canvas->compositeImage($plays, imagick::COMPOSITE_OVER, (1920 - 980) / 2, 1080 - 50 - $vOffset - 10);
}
開發者ID:rpitv,項目名稱:rpits,代碼行數:46,代碼來源:gameSummary.php

示例11: a0nCRQ

function a0nCRQ($msg, $padx, $pady, $bc, $fc, $tc)
{
    $im = new Imagick();
    $idraw = new ImagickDraw();
    $idraw->setFontSize(30);
    $idraw->setFont('MyriadPro-Regular.otf');
    $idraw->setGravity(Imagick::GRAVITY_CENTER);
    $metrics = $im->queryFontMetrics($idraw, $msg);
    $im->newPseudoImage($metrics["textWidth"] + $padx * 2, $metrics["textHeight"] + $pady * 2, "xc:none");
    $idraw->setFillColor($fc);
    $idraw->setStrokeColor($bc);
    $idraw->roundrectangle(0, 0, $metrics["textWidth"] + $padx * 2 - 1, $metrics["textHeight"] + $pady * 2 - 1, 10, 10);
    $idraw->setFillColor($tc);
    $idraw->setStrokeColor($tc);
    $idraw->annotation(0, 0, $msg);
    $im->drawImage($idraw);
    return $im;
}
開發者ID:udonchan,項目名稱:ritskougabu_photos,代碼行數:18,代碼來源:photos.php

示例12: renderFontEffect

function renderFontEffect()
{
    $canvas = new \Imagick();
    $canvas->newPseudoImage(500, 300, "canvas:none");
    $canvas->setImageFormat('png');
    $shadow = clone $canvas;
    $text = clone $canvas;
    drawText($text);
    drawText($shadow, true);
    $edge = getSilhouette($text);
    $kernel = \ImagickKernel::fromBuiltIn(\Imagick::KERNEL_OCTAGON, "2");
    $edge->morphology(\Imagick::MORPHOLOGY_EDGE_IN, 1, $kernel);
    $edge->compositeImage($text, \Imagick::COMPOSITE_ATOP, 0, 0);
    $canvas->compositeImage($shadow, \Imagick::COMPOSITE_COPY, 0, 0);
    $canvas->compositeImage($text, \Imagick::COMPOSITE_ATOP, 0, 0);
    header("Content-Type: image/png");
    echo $canvas->getImageBlob();
}
開發者ID:atawsports2,項目名稱:Imagick-demos,代碼行數:18,代碼來源:fontEffect.php

示例13: generateFavicon

 public function generateFavicon()
 {
     $faviconConfigList = $this->_getFaviconConfigList();
     $this->_getStreamOutput()->writeln('Generating favicons');
     $themeDirStructList = Functional\map(CM_Site_Abstract::getAll(), function (CM_Site_Abstract $site) {
         $render = new CM_Frontend_Render(new CM_Frontend_Environment($site));
         return ['render' => $render, 'themeDir' => new CM_File($render->getThemeDir(true))];
     });
     $themeDirStructList = Functional\unique($themeDirStructList, function (array $themeDirStruct) {
         /** @var CM_File $themeDir */
         $themeDir = $themeDirStruct['themeDir'];
         return $themeDir->getPath();
     });
     //filter site aliases
     foreach ($themeDirStructList as $themeDirStruct) {
         /** @var CM_Frontend_Render $render */
         $render = $themeDirStruct['render'];
         /** @var CM_File $themeDir */
         $themeDir = $themeDirStruct['themeDir'];
         $svgFile = $themeDir->joinPath('resource', 'img', self::FAVICON_SVG_FILENAME);
         if ($svgFile->exists()) {
             foreach ($faviconConfigList as $outputFilename => $config) {
                 $backgroundWidth = (int) $config['width'];
                 $backgroundHeight = (int) $config['height'];
                 $backgroundColor = false === $config['transparent'] ? $render->getLessVariable(self::FAVICON_BACKGROUND_LESS_VARIABLE) : 'transparent';
                 $background = new Imagick();
                 $background->newPseudoImage($backgroundWidth, $backgroundHeight, 'canvas:' . $backgroundColor);
                 $backgroundImage = new CM_Image_Image($background);
                 $iconSize = (int) (min($backgroundWidth, $backgroundHeight) * (double) $config['iconSize']);
                 $iconImage = CM_Image_Image::createFromSVGWithSize($svgFile->read(), $iconSize, $iconSize);
                 $backgroundImage->compositeImage($iconImage, ($backgroundWidth - $iconSize) / 2, ($backgroundHeight - $iconSize) / 2);
                 $backgroundImage->setFormat(CM_Image_Image::FORMAT_PNG);
                 $targetFile = $themeDir->joinPath('resource', 'img', 'meta', $outputFilename);
                 $targetFile->ensureParentDirectory();
                 $targetFile->write($backgroundImage->getBlob());
                 $this->_getStreamOutput()->writeln('Generated ' . $targetFile->getPath());
             }
         }
     }
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:40,代碼來源:Cli.php

示例14: Imagick

<?php

$im = new Imagick();
$im->newPseudoImage(100, 100, "XC:red");
$im->setImageFormat("png");
echo $im->width . "x" . $im->height . "\n";
echo $im->format;
開發者ID:badlamer,項目名稱:hhvm,代碼行數:7,代碼來源:009_properties.php

示例15: Imagick

<?php

$im = new Imagick();
$im->newPseudoImage(100, 100, "XC:red");
var_dump($im->getImageGeometry());
$im->newPseudoImage(0, 0, "magick:logo");
var_dump($im->getImageGeometry());
$im->readImage("magick:logo");
var_dump($im->getImageGeometry());
$im->newPseudoImage(0, 0, "rose:");
var_dump($im->getImageGeometry());
try {
    $im->newPseudoImage(0, 0, "png:");
    var_dump($im->getImageGeometry());
} catch (Exception $e) {
    echo "fail\n";
}
開發者ID:badlamer,項目名稱:hhvm,代碼行數:17,代碼來源:008_newpseudoimage.php


注:本文中的Imagick::newPseudoImage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。