Clip* methods are just bounds checking versions of the Draw*
methods. Only use the Draw* methods if it is known that the bounds are
being obeyed. The methods with the *F suffix take floating point
arguments instead of integers. This only matters for formats that can take
floating point measurements (eg: postscript), otherwise the default is to round
to an integer and call the integer equivalent.
class OEDepictBase
The OEDepictBase abstract base class defines a device-independent
interface for common 2D drawing operations, such as drawing points,
lines, rectangles and circles.
void Clear(int col)
Clear the current drawing area to the specified color.
The color argument, col, should be a color handle returned by
the OEDepictBase::Color method for this class.
virtual void ClipCenterString(int x, int y, const char *str, int c, int dx)
str of length dx at the co-ordinates
x1,y1 in the color c.
virtual void ClipCenterStringF(float x, float y, const char *str,
int c, float dx)
ClipCenterString, but takes floating point values.
void ClipLine(int x1, int y1, int x2, int y2, int c)
Draw a one pixel wide line from the co-ordinates x1,y1
to x2,y2 with color c.
The co-ordinates for this function need not be within the current drawing area, in which case this operation will clip the primitive to the current drawing area.
The color argument, c, should be a color handle returned by
the OEDepictBase::Color method for this class.
void ClipPoint(int x, int y, int c)
Plot a one pixel point at the co-ordinates x,y with
color c.
The co-ordinates for this function need not be within the current drawing area, in which case this operation will clip the primitive to the current drawing area.
The color argument, c, should be a color handle returned by
the OEDepictBase::Color method for this class.
int Color(unsigned char r, unsigned char g, unsigned char b)
Retrieve (or assign) a suitable color handle (index) for a specified
color. The required color is specified by the r, g and
b arguments which specify the 8-bit red, green and blue components
of the color. The returned value provides the ``color handle'' to be
passed to the other drawing functions. The encoding of colour is
implementation specific, for example, an index into a color palette
for some drivers.
void DrawLine(int x1, int y1, int x2, int y2, int c)
Draw a one pixel wide line from the co-ordinates x1,y1
to x2,y2 with color c.
The co-ordinates for this function must all be within the current drawing area.
The color argument, c, should be a color handle returned by
the OEDepictBase::Color method for this class.
void DrawPoint(int x, int y, int c)
int GetXSize() const
Get the current width of the OEDepictBase in pixels. The
dimensions of the OEDepictBase drawing area may be specified
either when the class is constructed or by using the
OEDepictBase::Resize method.
int GetYSize() const
Get the current height of the OEDepictBase in pixels. The
dimensions of the OEDepictBase drawing area may be specified
either when the class is constructed or by using the
OEDepictBase::Resize method.
bool Resize(int x, int y)
Attempt resize the current drawing area to the specified dimensions.
The x and y arguments denote the required width and
height in pixels respectively. This function returns true, if the
operation was successful, and false if it failed.
Some OEDepictBase implementations prohibit the resizing once drawing
has started. Some implementations attempt to preserve the contents of
the current drawing area, whilst others implicitly clear their contents
(using OEDepictBase::Clear) upon resizing.