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
Description:
Creates a copy of this object. You are encouraged to reimplement this for each subclass.
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.
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.
get name of this brush
string
getName
()
Description:
Returns bool(false) on error.
get brush size
int|bool(false)
getSize
()
Description:
Returns the brush's dimension in pixel or bool(false) on error.
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".
Resize the brush
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.
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.
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.
Redefinition of: Object::toString()
inherited from base classes
Inherited From Object