Sgss_Graphics_Bounds
Represents a bounding rectangle

Description

Implements:
Sgss_Graphics_Imagick_Draw_Interface
Author:
Matsuda Shota
Copyright:
(c) 2007-2008 Matsuda Shota
License:
http://creativecommons.org/licenses/GPL/2.0/
Located in:
/Graphics/Bounds.php (line 63)

Direct descendant

Sgss_Graphics_Bounds_Integer An integer wrapper class of the Sgss_Graphics_Bounds

Class overview

Accessors

number $x

X coordinate of upper left corner

number $y

Y coordinate of upper left corner

number $width

Width of the bounds

number $height

Height of the bounds

number $x1

X coordinate of upper left corner

number $y1

Y coordinate of upper left corner

number $x2

X coordinate of lower right corner

number $y2

Y coordinate of lower right corner

Variables

protected number $_height

Height of the bounds

protected number $_width

Width of the bounds

protected number $_x

X coordinate of upper left corner

protected number $_y

Y coordinate of upper left corner

Methods

__construct ([number|array|Sgss_Graphics_Bounds $x = 0], [number $y = 0], [number $width = 0], [number $height = 0])

The constructor

Sgss_Graphics_Bounds add (number|array|Sgss_Graphics_Location $x, [number|null $y = null])

Adds a location in this bounds

boolean drawImagick (Imagick|ImagickDraw $imagick, [number $x = 0], [number $y = 0])

Draws this bounds to the specified ImagickDraw instance

Sgss_Graphics_Bounds getBounds ()

Returns another object representing this bounds

Sgss_Graphics_Dimension getDimension ()

Returns the dimension of this bounds

number getHeight ()

Returns the height of this bounds

Sgss_Graphics_Location getLocation ()

Returns the location of the upper left corner

number getWidth ()

Returns the width of this bounds

number getX ()

Returns the x coordinate of the upper left corner

number getY ()

Returns the y coordinate of the upper left corner

Sgss_Graphics_Bounds grow (number $h, number $v)

Resizes the edges of this bounds by the specified length

Sgss_Graphics_Bounds_Integer integer ()

Returns the integer wrapper object of this bounds

Sgss_Graphics_Bounds intersect (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])

Intersects this bounds with another

Sgss_Graphics_Bounds intersection (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])

Returns the intersected bounds with another

Sgss_Graphics_Bounds move (number $x, number $y)

Moves this bounds to the specified location

Sgss_Graphics_Bounds reshape (number $x, number $y, number $width, number $height)

Sets the location and dimension of the bounds

Sgss_Graphics_Bounds resize (number $width, number $height)

Resizes this bounds to the specified dimension

Sgss_Graphics_Bounds scale (number $w, number $h)

Scales this bounds by the specified dimension

void setBounds (Sgss_Graphics_Bounds $b)

Sets this bounds to the specified value

void setDimension (Sgss_Graphics_Dimension $d)

Sets the dimension of this bounds to the specified value

void setHeight (number $height)

Sets the height of this bounds to the specified value

void setLocation (Sgss_Graphics_Location $l)

Sets the location of the upper left corner to the specified value

void setWidth (number $width)

Sets the width of this bounds to the specified value

void setX (number $x)

Sets the x coordinate of the upper left corner to the specified value

void setY (number $y)

Sets the y coordinate of the upper left corner to the specified value

array toArray ()

Converts this bounds to an array

Sgss_Graphics_Bounds transform (Sgss_Graphics_Transform $trans)

Applies the specified transformation to this bounds

Sgss_Graphics_Bounds translate (number $dx, number $dy)

Translates this bounds by the specified distance

Sgss_Graphics_Bounds union (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])

Returns the united bounds with another

Sgss_Graphics_Bounds unite (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])

Unites this bounds with another

mixed __get (mixed $name)
mixed __set (mixed $name, mixed $value)
string __toString ()

Variable detail

$_height 

Height of the bounds

Signature:
protected number $_height


$_width 

Width of the bounds

Signature:
protected number $_width


$_x 

X coordinate of upper left corner

Signature:
protected number $_x


$_y 

Y coordinate of upper left corner

Signature:
protected number $_y


Method detail

__construct

The constructor

Parameters:
  • number|array|Sgss_Graphics_Bounds $x

    X coordinate of the upper left corner, or a bounds

  • number $y

    Y coordinate of the upper left corner

  • number $width

    Width of the bounds

  • number $height

    Height of the bounds

Signature:
public __construct ([number|array|Sgss_Graphics_Bounds $x = 0], [number $y = 0], [number $width = 0], [number $height = 0])


add

Adds a location in this bounds

Parameters:
  • number|array|Sgss_Graphics_Location $x

    X coordinate of the location, or a location to be added

  • number|null $y

    Y coordinate of the location

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds add (number|array|Sgss_Graphics_Location $x, [number|null $y = null])


drawImagick

Draws this bounds to the specified ImagickDraw instance

Parameters:
  • Imagick|ImagickDraw $imagick

    ImagickDraw instance

  • number $x

    Offset x

  • number $y

    Offset y

Returns:
boolean -- True when this operation succeeded
Specified by:
Related subject:
Sgss_Graphics_Imagick_Draw_Interface::drawImagick()
Signature:
public boolean drawImagick (Imagick|ImagickDraw $imagick, [number $x = 0], [number $y = 0])


getBounds

Returns another object representing this bounds

Returns:
Sgss_Graphics_Bounds -- Another object representing this bounds
Signature:
public Sgss_Graphics_Bounds getBounds ()


getDimension

Returns the dimension of this bounds

Returns:
Sgss_Graphics_Dimension -- Dimension of this bounds
Signature:
public Sgss_Graphics_Dimension getDimension ()


getHeight

Returns the height of this bounds

Returns:
number -- Height of this bounds
Signature:
public number getHeight ()


getLocation

Returns the location of the upper left corner

Returns:
Sgss_Graphics_Location -- Location of the upper left corner
Signature:
public Sgss_Graphics_Location getLocation ()


getWidth

Returns the width of this bounds

Returns:
number -- Width of this bounds
Signature:
public number getWidth ()


getX

Returns the x coordinate of the upper left corner

Returns:
number -- X coordinate of the upper left corner
Signature:
public number getX ()


getY

Returns the y coordinate of the upper left corner

Returns:
number -- Y coordinate of the upper left corner
Signature:
public number getY ()


grow

Resizes the edges of this bounds by the specified length

Parameters:
  • number $h

    Horizontal length

  • number $v

    Vertical length

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds grow (number $h, number $v)


integer

Returns the integer wrapper object of this bounds

Returns:
Sgss_Graphics_Bounds_Integer -- Integer bounds representing this bounds
Signature:
public Sgss_Graphics_Bounds_Integer integer ()


intersect

Intersects this bounds with another

Parameters:
  • number|array|Sgss_Graphics_Bounds $x

    X coordinate of the upper left corner, or a bounds to be intersected with

  • number|null $y

    Y coordinate of the upper left corner

  • number|null $width

    Width of the bounds

  • number|null $height

    Height of the bounds

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds intersect (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])


intersection

Returns the intersected bounds with another

Parameters:
  • number|array|Sgss_Graphics_Bounds $x

    X coordinate of the upper left corner, or a bounds to be intersected with

  • number|null $y

    Y coordinate of the upper left corner

  • number|null $width

    Width of the bounds

  • number|null $height

    Height of the bounds

Returns:
Sgss_Graphics_Bounds -- Intersected bounds
Signature:
public Sgss_Graphics_Bounds intersection (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])


move

Moves this bounds to the specified location

Parameters:
  • number $x

    X coordinate of the location

  • number $y

    Y coordinate of the location

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds move (number $x, number $y)


reshape

Sets the location and dimension of the bounds

Parameters:
  • number $x

    X coodinate of the upper left corner

  • number $y

    Y coodinate of the upper left corner

  • number $width

    Width of the bounds

  • number $height

    Height of the bounds

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds reshape (number $x, number $y, number $width, number $height)


resize

Resizes this bounds to the specified dimension

Parameters:
  • number $width

    Width of the dimension

  • number $height

    Height of the dimension

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds resize (number $width, number $height)


scale

Scales this bounds by the specified dimension

Parameters:
  • number $w

    Width of the dimension

  • number $h

    Height of the dimension

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds scale (number $w, number $h)


setBounds

Sets this bounds to the specified value

Parameters:
Signature:
public void setBounds (Sgss_Graphics_Bounds $b)


setDimension

Sets the dimension of this bounds to the specified value

Parameters:
Signature:
public void setDimension (Sgss_Graphics_Dimension $d)


setHeight

Sets the height of this bounds to the specified value

Parameters:
  • number $height

    Height of the bounds to set

Signature:
public void setHeight (number $height)


setLocation

Sets the location of the upper left corner to the specified value

Parameters:
Signature:
public void setLocation (Sgss_Graphics_Location $l)


setWidth

Sets the width of this bounds to the specified value

Parameters:
  • number $width

    Width of the bounds to set

Signature:
public void setWidth (number $width)


setX

Sets the x coordinate of the upper left corner to the specified value

Parameters:
  • number $x

    X coordinate of the upper left corner to set

Signature:
public void setX (number $x)


setY

Sets the y coordinate of the upper left corner to the specified value

Parameters:
  • number $y

    Y coordinate of the upper left corner to set

Signature:
public void setY (number $y)


toArray

Converts this bounds to an array

Returned array takes the following form:

  1.  array($x$y$width$height)

Returns:
array -- Array representing this bounds
Signature:
public array toArray ()


transform

Applies the specified transformation to this bounds

Parameters:
Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds transform (Sgss_Graphics_Transform $trans)


translate

Translates this bounds by the specified distance

Parameters:
  • number $dx

    Distance along the x axis

  • number $dy

    Distance along the y axis

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds translate (number $dx, number $dy)


union

Returns the united bounds with another

Parameters:
  • number|array|Sgss_Graphics_Bounds $x

    X coordinate of the upper left corner, or a bounds to be united with

  • number|null $y

    Y coordinate of the upper left corner

  • number|null $width

    Width of the bounds

  • number|null $height

    Height of the bounds

Returns:
Sgss_Graphics_Bounds -- United bounds
Signature:
public Sgss_Graphics_Bounds union (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])


unite

Unites this bounds with another

Parameters:
  • number|array|Sgss_Graphics_Bounds $x

    X coordinate of the upper left corner, or a bounds to be united with

  • number|null $y

    Y coordinate of the upper left corner

  • number|null $width

    Width of the bounds

  • number|null $height

    Height of the bounds

Returns:
Sgss_Graphics_Bounds -- This object for convenience
Signature:
public Sgss_Graphics_Bounds unite (number|array|Sgss_Graphics_Bounds $x, [number|null $y = null], [number|null $width = null], [number|null $height = null])


__get

Parameters:
  • mixed $name
Overridden by:
Signature:
public mixed __get (mixed $name)


__set

Parameters:
  • mixed $name
  • mixed $value
Signature:
public mixed __set (mixed $name, mixed $value)


__toString

Signature:
public string __toString ()