PHP Класс Pop\Image\Svg

Автор: Nick Sagona, III ([email protected])
Наследование: extends AbstractImage
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$allowed array Array of allowed file types.
$allowedUnits array Array of allowed units.
$backgroundColor mixed SVG image background color
$clippingPaths array SVG image available clipping paths
$curClippingPath integer Current clipping path to use.
$curGradient integer Current gradient to use.
$fillColor mixed SVG image fill color
$gradients array SVG image available gradients
$height integer SVG image height
$opacity float SVG image color opacity
$resource SimpleXMLElement SVG image resource
$strokeColor mixed SVG image stroke color
$strokeDashGap integer Stroke dash gap
$strokeDashLength integer Stroke dash length
$strokeWidth array SVG image stroke width
$units string SVG image units
$width integer SVG image width

Открытые методы

Метод Описание
__construct ( string $svg, integer | string $w = null, integer | string $h = null, Pop\Color\Space\ColorInterface $color = null ) : Svg Constructor
__toString ( ) : string To string method to output the image
addGradient ( Pop\Color\Space\ColorInterface $color1, Pop\Color\Space\ColorInterface $color2, integer $type = Svg::HORIZONTAL ) : Svg Add a gradient.
border ( integer $w ) : Svg Method to add a border to the image.
drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null ) : Svg Method to add an arc to the image.
drawCircle ( integer $x, integer $y, integer $w ) : Svg Method to add a circle to the image.
drawClippingCircle ( integer $x, integer $y, integer $w ) : Svg Add a clipping circle.
drawClippingEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Svg Add a clipping ellipse.
drawClippingPolygon ( array $points ) : Svg Add a clipping polygon.
drawClippingRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : Svg Add a clipping rectangle.
drawClippingSquare ( integer $x, integer $y, integer $w ) : Svg Add a clipping square.
drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Svg Method to add an ellipse to the image.
drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : void Method to add a line to the image.
drawPolygon ( array $points ) : Svg Method to add a polygon to the image.
drawRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : void Method to add a rectangle to the image.
drawSquare ( integer $x, integer $y, integer $w ) : Svg Method to add a square to the image.
getHeight ( ) : integer Get the SVG image height.
getUnits ( ) : string Get the SVG image units.
getWidth ( ) : integer Get the SVG image width.
output ( boolean $download = false ) : void Method to output the SVG image.
setBackgroundColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg Set the background color.
setClippingPath ( integer $index = null ) : Svg Set the clipping path to use.
setFillColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg Set the fill color.
setGradient ( integer $index = null ) : Svg Set the gradient to use.
setOpacity ( float $opac ) : Svg Set the opacity.
setStrokeColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg Set the stroke color.
setStrokeWidth ( integer $wid = null, integer $dash_len = null, integer $dash_gap = null ) : Svg Set the stroke width.
text ( string $str, integer | string $size, integer | string $x, integer | string $y, string $font = 'Arial', integer | string $rotate = null, boolean $bold = false ) : Svg Create text within the an SVG image object.

Защищенные методы

Метод Описание
getQuadrant ( array $point, array $center ) : integer Method to calculate which quadrant a point is in.
setStyles ( SimpleXMLElement $obj ) : SimpleXMLElement Method to set the styles.

Описание методов

__construct() публичный Метод

Instantiate an SVG image object based on either a pre-existing SVG image file on disk, or a new SVG image file.
public __construct ( string $svg, integer | string $w = null, integer | string $h = null, Pop\Color\Space\ColorInterface $color = null ) : Svg
$svg string
$w integer | string
$h integer | string
$color Pop\Color\Space\ColorInterface
Результат Svg

__toString() публичный Метод

To string method to output the image
public __toString ( ) : string
Результат string

addGradient() публичный Метод

Add a gradient.
public addGradient ( Pop\Color\Space\ColorInterface $color1, Pop\Color\Space\ColorInterface $color2, integer $type = Svg::HORIZONTAL ) : Svg
$color1 Pop\Color\Space\ColorInterface
$color2 Pop\Color\Space\ColorInterface
$type integer
Результат Svg

border() публичный Метод

Method to add a border to the image.
public border ( integer $w ) : Svg
$w integer
Результат Svg

drawArc() публичный Метод

Method to add an arc to the image.
public drawArc ( integer $x, integer $y, integer $start, integer $end, integer $w, integer $h = null ) : Svg
$x integer
$y integer
$start integer
$end integer
$w integer
$h integer
Результат Svg

drawCircle() публичный Метод

Method to add a circle to the image.
public drawCircle ( integer $x, integer $y, integer $w ) : Svg
$x integer
$y integer
$w integer
Результат Svg

drawClippingCircle() публичный Метод

Add a clipping circle.
public drawClippingCircle ( integer $x, integer $y, integer $w ) : Svg
$x integer
$y integer
$w integer
Результат Svg

drawClippingEllipse() публичный Метод

Add a clipping ellipse.
public drawClippingEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Svg
$x integer
$y integer
$w integer
$h integer
Результат Svg

drawClippingPolygon() публичный Метод

Add a clipping polygon.
public drawClippingPolygon ( array $points ) : Svg
$points array
Результат Svg

drawClippingRectangle() публичный Метод

Add a clipping rectangle.
public drawClippingRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : Svg
$x integer
$y integer
$w integer
$h integer
Результат Svg

drawClippingSquare() публичный Метод

Add a clipping square.
public drawClippingSquare ( integer $x, integer $y, integer $w ) : Svg
$x integer
$y integer
$w integer
Результат Svg

drawEllipse() публичный Метод

Method to add an ellipse to the image.
public drawEllipse ( integer $x, integer $y, integer $w, integer $h = null ) : Svg
$x integer
$y integer
$w integer
$h integer
Результат Svg

drawLine() публичный Метод

Method to add a line to the image.
public drawLine ( integer $x1, integer $y1, integer $x2, integer $y2 ) : void
$x1 integer
$y1 integer
$x2 integer
$y2 integer
Результат void

drawPolygon() публичный Метод

Method to add a polygon to the image.
public drawPolygon ( array $points ) : Svg
$points array
Результат Svg

drawRectangle() публичный Метод

Method to add a rectangle to the image.
public drawRectangle ( integer $x, integer $y, integer $w, integer $h = null ) : void
$x integer
$y integer
$w integer
$h integer
Результат void

drawSquare() публичный Метод

Method to add a square to the image.
public drawSquare ( integer $x, integer $y, integer $w ) : Svg
$x integer
$y integer
$w integer
Результат Svg

getHeight() публичный Метод

Get the SVG image height.
public getHeight ( ) : integer
Результат integer

getQuadrant() защищенный Метод

Method to calculate which quadrant a point is in.
protected getQuadrant ( array $point, array $center ) : integer
$point array
$center array
Результат integer

getUnits() публичный Метод

Get the SVG image units.
public getUnits ( ) : string
Результат string

getWidth() публичный Метод

Get the SVG image width.
public getWidth ( ) : integer
Результат integer

output() публичный Метод

Method to output the SVG image.
public output ( boolean $download = false ) : void
$download boolean
Результат void

setBackgroundColor() публичный Метод

Set the background color.
public setBackgroundColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg
$color Pop\Color\Space\ColorInterface
Результат Svg

setClippingPath() публичный Метод

Set the clipping path to use.
public setClippingPath ( integer $index = null ) : Svg
$index integer
Результат Svg

setFillColor() публичный Метод

Set the fill color.
public setFillColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg
$color Pop\Color\Space\ColorInterface
Результат Svg

setGradient() публичный Метод

Set the gradient to use.
public setGradient ( integer $index = null ) : Svg
$index integer
Результат Svg

setOpacity() публичный Метод

Set the opacity.
public setOpacity ( float $opac ) : Svg
$opac float
Результат Svg

setStrokeColor() публичный Метод

Set the stroke color.
public setStrokeColor ( Pop\Color\Space\ColorInterface $color = null ) : Svg
$color Pop\Color\Space\ColorInterface
Результат Svg

setStrokeWidth() публичный Метод

Set the stroke width.
public setStrokeWidth ( integer $wid = null, integer $dash_len = null, integer $dash_gap = null ) : Svg
$wid integer
$dash_len integer
$dash_gap integer
Результат Svg

setStyles() защищенный Метод

Method to set the styles.
protected setStyles ( SimpleXMLElement $obj ) : SimpleXMLElement
$obj SimpleXMLElement
Результат SimpleXMLElement

text() публичный Метод

Create text within the an SVG image object.
public text ( string $str, integer | string $size, integer | string $x, integer | string $y, string $font = 'Arial', integer | string $rotate = null, boolean $bold = false ) : Svg
$str string
$size integer | string
$x integer | string
$y integer | string
$font string
$rotate integer | string
$bold boolean
Результат Svg

Описание свойств

$allowed защищенное свойство

Array of allowed file types.
protected array $allowed
Результат array

$allowedUnits защищенное свойство

Array of allowed units.
protected array $allowedUnits
Результат array

$backgroundColor защищенное свойство

SVG image background color
protected mixed $backgroundColor
Результат mixed

$clippingPaths защищенное свойство

SVG image available clipping paths
protected array $clippingPaths
Результат array

$curClippingPath защищенное свойство

Current clipping path to use.
protected int $curClippingPath
Результат integer

$curGradient защищенное свойство

Current gradient to use.
protected int $curGradient
Результат integer

$fillColor защищенное свойство

SVG image fill color
protected mixed $fillColor
Результат mixed

$gradients защищенное свойство

SVG image available gradients
protected array $gradients
Результат array

$height защищенное свойство

SVG image height
protected int $height
Результат integer

$opacity защищенное свойство

SVG image color opacity
protected float $opacity
Результат float

$resource защищенное свойство

SVG image resource
protected SimpleXMLElement $resource
Результат SimpleXMLElement

$strokeColor защищенное свойство

SVG image stroke color
protected mixed $strokeColor
Результат mixed

$strokeDashGap защищенное свойство

Stroke dash gap
protected int $strokeDashGap
Результат integer

$strokeDashLength защищенное свойство

Stroke dash length
protected int $strokeDashLength
Результат integer

$strokeWidth защищенное свойство

SVG image stroke width
protected array $strokeWidth
Результат array

$units защищенное свойство

SVG image units
protected string $units
Результат string

$width защищенное свойство

SVG image width
protected int $width
Результат integer