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


PHP Rectangle::draw方法代码示例

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


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

示例1: draw

{
    public function draw()
    {
        print "Inside Rectangle::draw method.\n";
        // 'print' works too
    }
}
$we = new Employee('Bob', 'Diamond');
echo $we->greeting();
echo PHP_EOL;
$we->foo();
// overriding seems to work
$he->foo();
$rect = new Rectangle();
// or 'new Rectangle()'
$rect->draw();
echo empty("");
echo PHP_EOL;
echo null == NULL;
echo PHP_EOL;
// PHP Arrays are in fact associative arrays, i.e. Map and Dictionaries
$myArray = ["1" => "Hello", "2" => "How are you?", "3" => "Very well ty"];
$yourArray = [];
echo $myArray["1"] . PHP_EOL;
echo $myArray["2"] . PHP_EOL;
echo $myArray["3"] . PHP_EOL;
$myArray["4"] = "This is a new item";
echo $myArray["4"] . PHP_EOL;
echo $myArray["4"] . PHP_EOL;
var_dump($myArray);
$x = ["a", "b", "c"];
开发者ID:possientis,项目名称:Prog,代码行数:31,代码来源:wiki.php

示例2: __construct

    private $radius;
    public function __construct($x, $y, $radius)
    {
        parent::__construct($x, $y);
        $this->radius = $radius;
    }
    protected function drawShape()
    {
        return "Рисуем окружность с радиусом {$this->radius}";
    }
}
class Rectangle extends Shape
{
    private $width;
    private $height;
    public function __construct($x, $y, $width, $height)
    {
        parent::__construct($x, $y);
        $this->width = $width;
        $this->height = $height;
    }
    protected function drawShape()
    {
        return "Рисуем прямоугольник с шириной {$this->width} и высотой {$this->height}";
    }
}
$circle = new Circle(0, 0, 50);
$rectangle = new Rectangle(0, 0, 100, 50);
$circle->draw();
$rectangle->draw();
开发者ID:echmaster,项目名称:data,代码行数:30,代码来源:3-8+Абстрактные+классы.php

示例3: draw

 function draw($image)
 {
     $this->bound->normalize();
     $depth = $this->depth;
     if ($this->surfaces & self::SURFACE_BOTTOM) {
         $points = [$this->bound->left(), $this->bound->bottom(), $this->bound->left() + $depth, $this->bound->bottom() - $depth, $this->bound->right() + $depth, $this->bound->bottom() - $depth, $this->bound->right(), $this->bound->bottom()];
         imagefilledpolygon($image, $points, 4, $this->bgcolor->resolve($image));
         if ($this->fgcolor !== NULL) {
             imagepolygon($image, $points, 4, $this->fgcolor->resolve($image));
         }
     }
     if ($this->surfaces & self::SURFACE_BACK) {
         $points = [$this->bound->left() + $depth, $this->bound->bottom() - $depth, $this->bound->left() + $depth, $this->bound->top() - $depth, $this->bound->right() + $depth, $this->bound->top() - $depth, $this->bound->right() + $depth, $this->bound->bottom() - $depth];
         imagefilledpolygon($image, $points, 4, $this->bgcolor->resolve($image));
         if ($this->fgcolor !== NULL) {
             imagepolygon($image, $points, 4, $this->fgcolor->resolve($image));
         }
     }
     if ($this->surfaces & self::SURFACE_LEFT) {
         $points = [$this->bound->left(), $this->bound->bottom(), $this->bound->left(), $this->bound->top(), $this->bound->left() + $depth, $this->bound->top() - $depth, $this->bound->left() + $depth, $this->bound->bottom() - $depth];
         imagefilledpolygon($image, $points, 4, $this->bgcolor->resolve($image));
         if ($this->fgcolor !== NULL) {
             imagepolygon($image, $points, 4, $this->fgcolor->resolve($image));
         }
     }
     if ($this->surfaces & self::SURFACE_RIGHT) {
         $points = [$this->bound->right(), $this->bound->top(), $this->bound->right() + $depth, $this->bound->top() - $depth, $this->bound->right() + $depth, $this->bound->bottom() - $depth, $this->bound->right(), $this->bound->bottom()];
         imagefilledpolygon($image, $points, 4, $this->bgcolor->resolve($image));
         if ($this->fgcolor !== NULL) {
             imagepolygon($image, $points, 4, $this->fgcolor->resolve($image));
         }
     }
     if ($this->surfaces & self::SURFACE_TOP) {
         $points = [$this->bound->left(), $this->bound->top(), $this->bound->left() + $depth, $this->bound->top() - $depth, $this->bound->right() + $depth, $this->bound->top() - $depth, $this->bound->right(), $this->bound->top()];
         imagefilledpolygon($image, $points, 4, $this->bgcolor->resolve($image));
         if ($this->fgcolor !== NULL) {
             imagepolygon($image, $points, 4, $this->fgcolor->resolve($image));
         }
     }
     if ($this->surfaces & self::SURFACE_FRONT) {
         parent::draw($image);
     }
 }
开发者ID:shevtsov-s,项目名称:planetsbook,代码行数:43,代码来源:GDGraphicalObjects.php


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