yana

phpDocumentor v 1.4.0

Class Brush

Description

Brush wrapper class
This class is meant as an add-on to the framework's Image class. It is intended to handle predefined brushes in PNG format, which reside in the directory "common_files/brush/*.png" to ease work with images.
Brush images need to be 2-colored black/white images with color index 0 being black and index 1 being the transparent color and width == height.
  • see: Image
  • since: 2.8.7
  • access: public
Object
   |
   --Brush
Method Summary

Methods

create a new instance of this class
Brush Brush (
[string $brushname = null]
)
List of parameters:
Name Type Description
$brushname string see list
Description:
The argument $brushname determines wich brush to take the input from. If $brushname is not provided, a 1px square is used.
The brush name can be any name of an existing PNG image (without the file extension), that must reside in the "common_files/brush/*.png" directory.
Here are some examples:
  • airbrush
  • small circle
  • circle
  • dot
  • small star
  • star
  • square
  • point (default)
clone this object
Object cloneObject ()
Description:
Creates a copy of this object. You are encouraged to reimplement this for each subclass.
  • access: public

Redefinition of: Object::cloneObject()

compare with another object
bool equals (
object $anotherObject
)
List of parameters:
Name Type Description
$anotherObject object any var to compare this object with
Description:
Returns bool(true) if this object and $anotherObject are the booth object which have an image resource that is the same, or $anotherObject is an image resource and identical to the one of this object.
Returns bool(false) otherwise.
  • access: public

Redefinition of: Object::equals()

get the color of this brush
array getColor ()
Description:
Returns an associative array of the red, green and blue values of the current brush color. Returns bool(false) on error.
  • access: public
get name of this brush
string getName ()
Description:
Returns bool(false) on error.
  • access: public
get brush size
int|bool(false) getSize ()
Description:
Returns the brush's dimension in pixel or bool(false) on error.
  • access: public
set the color of this brush
string setColor (
int $r, int $g, int $b
)
List of parameters:
Name Type Description
$r int red value
$g int green value
$b int blue value
Description:
This function sets the color of the brush to a certain value, where the input is the red, green and blue values of this color.
The arguments $r, $g and $b need to be integer values between 0 and 255. For example, $r = 0 is interpreted as "0% red" and $r = 255 is interpreted as "100% red".
  • access: public
Resize the brush
bool setSize (
int $size
)
List of parameters:
Name Type Description
$size int brush size in pixel
Description:
This resizes the brush.
The argument $size is the new size in pixel.
Returns bool(false) on error.
  • access: public
set the directory that contains the brushes
bool setSourceDirectory (
string $directory
)
List of parameters:
Name Type Description
$directory string new source directory
Description:
This function will set the source directory for brushes. The next time you create a Brush object, the png image will automatically be searched for in the directory you provided here.
Returns bool(true) on success and bool(false) on error.
  • since: 2.8.8
  • access: public
get a string representation of this object
string toString ()
Description:
This function is intended to be called when the object is used in a string context.
  • access: public

Redefinition of: Object::toString()

inherited from base classes

Inherited From Object

Documentation generated on Sat, 03 Jan 2009 22:22:29 +0100 by phpDocumentor 1.4.0

yana author: Thomas MeyerHomepage: www.yanaframework.net