AnewtImageDrawingContext class

Drawing context for AnewtImage.

Class Overview

Drawing context for AnewtImage.

A drawing context keeps some drawing properties and offers drawing methods. Note that not all functions might be available on your particular setup (eg. anti-aliasing).

See also

Todo

Add proper Doxygen method grouping marks.

Public Methods

color_at($x, $y)

Return the color value of the specified pixel.

Parameters

$x

X coordinate

$y

Y coordinate

Return value

Color value

draw_point($x, $y)

Draw a single point on the image.

Parameters

$x

X coordinate

$y

Y coordinate

draw_line($x1, $y1, $x2, $y2)

Draw a line from one point to another point.

Parameters

$x1

X coordinate of the first point

$y1

Y coordinate of the first point

$x2

X coordinate of the second point

$y2

Y coordinate of the second point

draw_rectangle($x1, $y1, $x2, $y2)

Draw a rectangle.

Parameters

$x1

X coordinate of the top-left point

$y1

X coordinate of the top-left point

$x2

X coordinate of the bottom-right point

$y2

X coordinate of the bottom-right point

draw_filled_rectangle($x1, $y1, $x2, $y2)

Draw a filled rectangle.

Parameters

$x1

X coordinate of the top-left point

$y1

X coordinate of the top-left point

$x2

X coordinate of the bottom-right point

$y2

X coordinate of the bottom-right point

draw_rectangle_size($x, $y, $width, $height)

Draw a rectangle of a given width and height.

Negative width and height values cause the rectangle to be drawn from the bottom right coordinate, extending to the top left.

Parameters

$x

X coordinate of the top-left point

$y

X coordinate of the top-left point

$width

Width of the rectangle

$height

Height of the rectangle

draw_filled_rectangle_size($x, $y, $width, $height)

Draw a filled rectangle of a given width and height.

Negative width and height values cause the rectangle to be drawn from the bottom right coordinate, extending to the top left.

Parameters

$x

X coordinate of the top-left point

$y

X coordinate of the top-left point

$width

Width of the rectangle

$height

Height of the rectangle

draw_string($x, $y, $str)

Draw a simple string at the given point.

Parameters

$x

X coordinate

$y

y coordinate

$str

String to draw

Todo

This method doesn't work like it really should

Private Methods

__construct($image) [private]

Create a new drawing context.

Do not instantiate this class directly, use AnewtImage::create_drawing_context instead.

Parameters

$image

A valid AnewtImage instance.

See also

_install_gd_properties() [private]

Set the gd properties on the actual image instance.

All drawing methods should call this method before any GD function is invoked. This method shouldn't be called by non-drawing methods.

_draw_rectangle($x1, $y1, $x2, $y2, $filled) [private]

Draw a rectangle.

Parameters

$x1

X coordinate of the top-left point

$y1

X coordinate of the top-left point

$x2

X coordinate of the bottom-right point

$y2

X coordinate of the bottom-right point

$filled

Whether the rectangle is filled

_draw_rectangle_size($x, $y, $width, $height, $filled) [private]

Draw a rectangle of a given width and height.

Negative width and height values cause the rectangle to be drawn from the bottom right coordinate, extending to the top left.

Parameters

$x

X coordinate of the top-left point

$y

X coordinate of the top-left point

$width

Width of the rectangle

$height

Height of the rectangle

$filled

Whether the rectangle is filled

Private Attributes

$image [private]

AnewtImage instance this AnewtImageDrawingContext belongs to.

Inheritance

Base Classes

Inherited members