当前位置: 首页>>代码示例>>PHP>>正文


PHP Color::getColor方法代码示例

本文整理汇总了PHP中Color::getColor方法的典型用法代码示例。如果您正苦于以下问题:PHP Color::getColor方法的具体用法?PHP Color::getColor怎么用?PHP Color::getColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Color的用法示例。


在下文中一共展示了Color::getColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testInvalidColor

 public function testInvalidColor()
 {
     $strColor = '-invalid-';
     $color = new Color($strColor);
     $this->assertEquals($strColor, $color->getColor());
     $this->assertEquals(255, $color->getRed());
     $this->assertEquals(255, $color->getGreen());
     $this->assertEquals(255, $color->getBlue());
     $this->assertEquals(0, $color->getAlpha());
 }
开发者ID:nimetu,项目名称:ryzom_bmaker,代码行数:10,代码来源:ColorTest.php

示例2: _displayPagina

 public static function _displayPagina($accion)
 {
     $colorCookie = new Color();
     if ($accion == "probarColor") {
         $colorCookie->probarColor();
         self::$_estilo = $colorCookie->getEstilo();
     } else {
         $colorCookie->ponerColor();
         self::$_enlacesColores = "Cambio de color: <a href='./index.php?color=rojo'>Rojo</a>\n<a href='./index.php?color=azul'>Azul</a>\n<a href='./index.php?color=verde'>Verde</a>\n<a href='./index.php?color=ninguno'>Ninguno</a>";
         self::$_enlace = "<a href='./index.php?accion=probarColor'>Comprobar la cookie</a>";
     }
     self::$_color = $colorCookie->getColor();
     if (isset($_COOKIE["cookieColor"]) && self::$_color != "ninguno") {
         self::$_mensaje = "Se ha elegido el color " . self::$_color;
     } else {
         self::$_mensaje = "No se ha elegido color";
     }
     self::$_operacion = $colorCookie->getOperacion();
     self::_retornarVista();
 }
开发者ID:cancelajavi,项目名称:2-DAW,代码行数:20,代码来源:colorVista.php

示例3: resize

 /**
  * @brief Resize the image to the specified width and height
  *
  * optionally keeping the aspect ratio and pads or crops the resulting 
  * image to the desired dimensions.
  *
  * @param Integer $width The desired width
  * @param Integer $height The desired height
  * @param Integer $keepaspect One of KEEP_NONE, KEEP_CROP, and KEEP_FILL
  * @param Color $fillcolor The color to fill with (if KEEP_FILL)
  */
 function resize($width, $height, $keepaspect = Canvas::KEEP_NONE, Color $fillcolor = null)
 {
     $this->checkImage();
     $this->checkMeta();
     $cw = imageSX($this->himage);
     $ch = imageSY($this->himage);
     $nr = (double) ($width / $height);
     // Get new aspect ratio
     $cr = (double) ($cw / $ch);
     // Get current aspect ratio
     switch ($keepaspect) {
         case Canvas::KEEP_NONE:
             $n = imagecreatetruecolor($width, $height);
             imagecopyresampled($n, $this->himage, 0, 0, 0, 0, $width, $height, $cw, $ch);
             break;
         case Canvas::KEEP_CROP:
             $ratio = $cw / $ch;
             if ($width / $height > $ratio) {
                 $nh = round($width / $ratio);
                 $nw = $width;
             } else {
                 $nw = round($height * $ratio);
                 $nh = $height;
             }
             $m = imagecreatetruecolor($nw, $nh);
             imagecopyresampled($m, $this->himage, 0, 0, 0, 0, $nw, $nh, $cw, $ch);
             $n = imagecreatetruecolor($width, $height);
             imagecopyresampled($n, $m, 0, 0, ($nw - $width) / 2, ($nh - $height) / 2, $width, $height, $width, $height);
             imagedestroy($m);
             break;
         case Canvas::KEEP_FILL:
             $ratio = $cw / $ch;
             $cw <= $width ? $nw = $cw : ($nw = $width);
             $nh = round($ch * $nw / $cw);
             if ($nh > $height) {
                 $nw = $cw * $height / $ch;
                 $nh = $height;
             }
             $n = imagecreatetruecolor($width, $height);
             imagefilledrectangle($n, 0, 0, $width, $height, $fillcolor->getColor($this->himage));
             imagecopyresampled($n, $this->himage, round(($width - $nw) / 2), round(($height - $nh) / 2), 0, 0, $nw, $nh, $cw, $ch);
             break;
     }
     imagedestroy($this->himage);
     $this->himage = $n;
     $this->width = imageSX($this->himage);
     $this->height = imageSY($this->himage);
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:59,代码来源:canvas.php

示例4: testAddingHash

 public function testAddingHash()
 {
     $color = new Color('000000');
     $this->assertEquals('#000000', $color->getColor());
     $this->assertEquals('000000', $color->getColor(false));
 }
开发者ID:bitheater,项目名称:dummy-image,代码行数:6,代码来源:ColorTest.php

示例5: drawCircle

 function drawCircle($x, $y, $radius, Color $fillcolor, Color $linecolor = null)
 {
     $cf = $fillcolor->getColor($this->himage);
     imagefilledarc($this->himage, $x, $y, $radius * 2, $radius * 2, 0, 360, $cf, IMG_ARC_PIE);
     if ($linecolor) {
         $cl = $linecolor->getColor($this->himage);
         imagefilledarc($this->himage, $x, $y, $radius * 2, $radius * 2, 0, 360, $cl, IMG_ARC_PIE | IMG_ARC_NOFILL);
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:9,代码来源:canvaspainter.php


注:本文中的Color::getColor方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。