tbx
0.7.6
|
Interface to drawing graphics to the screen. More...
#include <graphics.h>
Public Member Functions | |
virtual int | os_x (int logical_x) const =0 |
Convert from logical x value to OS units. More... | |
virtual int | os_y (int logical_y) const =0 |
Convert from logical y value to OS units. More... | |
virtual int | logical_x (int os_x) const =0 |
Convert from OS units to logical x value. More... | |
virtual int | logical_y (int os_y) const =0 |
Convert from OS units to logical y value. More... | |
virtual Point | os (const Point &pt) const |
Convert from logical coordinates to OS units. More... | |
virtual Point | logical (const Point &pt) const |
Convert from OS units to logical coordinates. More... | |
virtual BBox | os (const BBox &b) const |
Convert from logical coordinates to OS units. More... | |
virtual BBox | logical (const BBox &b) const |
Convert from OS units to logical coordinates. More... | |
virtual void | foreground (Colour colour)=0 |
Set the foreground colour for graphics. More... | |
virtual void | background (Colour colour)=0 |
Set the background colour for graphics. More... | |
virtual void | wimp_foreground (WimpColour colour)=0 |
Set the foreground colour for graphics to one of the standard WIMP colours. More... | |
virtual void | wimp_background (WimpColour colour)=0 |
Set the background colour for graphics to one of the standard WIMP colours. More... | |
virtual void | move (int x, int y)=0 |
Move the graphics cursor to the given point. More... | |
virtual void | point (int x, int y)=0 |
Draw a point at the given location. More... | |
virtual void | line (int tx, int ty)=0 |
Draw a line from the last point visited to the given location. More... | |
virtual void | line (int fx, int fy, int tx, int ty) |
Draw a line between the given two points. More... | |
virtual void | rectangle (int xmin, int ymin, int xmax, int ymax)=0 |
Draw the outline of a rectangle. More... | |
virtual void | fill_rectangle (int xmin, int ymin, int xmax, int ymax)=0 |
Draw a filled rectangle. More... | |
virtual void | path (const Point *points, int num)=0 |
Draw a path of lines connecting the given points. More... | |
virtual void | polygon (const Point *points, int num)=0 |
Draw the outline of a polygon. More... | |
virtual void | fill_polygon (const Point *points, int num)=0 |
Draw a filled polygon. More... | |
virtual void | circle (int centre_x, int centre_y, int radius)=0 |
Draw the outline of a circle. More... | |
virtual void | fill_circle (int centre_x, int centre_y, int radius)=0 |
Draw a filled circle. More... | |
virtual void | arc (int centre_x, int centre_y, int start_x, int start_y, int end_x, int end_y)=0 |
Draw arc around a circle. More... | |
virtual void | segment (int centre_x, int centre_y, int start_x, int start_y, int end_x, int end_y)=0 |
Draw a segment of a circle. More... | |
virtual void | sector (int centre_x, int centre_y, int start_x, int start_y, int end_x, int end_y)=0 |
Draw a sector of a circle. More... | |
virtual void | ellipse (int centre_x, int centre_y, int intersect_x, int intersect_y, int high_x, int high_y)=0 |
Draw the outline of an ellipse. More... | |
virtual void | fill_ellipse (int centre_x, int centre_y, int intersect_x, int intersect_y, int high_x, int high_y)=0 |
Draw a filled ellipse. More... | |
virtual void | move (const Point &point) |
Move the graphics cursor to the given location. More... | |
virtual void | point (const Point &pt) |
Draw a point at the given location. More... | |
virtual void | line (const Point &to_point) |
Draw a line from the last point visited to the given location. More... | |
virtual void | line (const Point &from_point, const Point &to_point) |
Draw a line between the given two points. More... | |
virtual void | rectangle (const Point &min_point, const Point &max_point) |
Draw the outline of a rectangle. More... | |
virtual void | rectangle (const BBox &r) |
Draw the outline of a rectangle. More... | |
virtual void | fill_rectangle (const Point &min_point, const Point &max_point) |
Draw the outline of a rectangle. More... | |
virtual void | fill_rectangle (const BBox &r) |
Draw a filled rectangle. More... | |
virtual void | circle (const Point ¢re_point, int radius) |
Draw the outline of a circle. More... | |
virtual void | fill_circle (const Point ¢re_point, int radius) |
Draw a filled circle. More... | |
virtual void | arc (const Point ¢re_point, const Point &start_point, const Point &end_point) |
Draw an arc. More... | |
virtual void | segment (const Point ¢re_point, const Point &start_point, const Point &end_point) |
Draw a segment of a circle. More... | |
virtual void | sector (const Point ¢re_point, const Point &start_point, const Point &end_point) |
Draw a sector of a circle. More... | |
virtual void | ellipse (const Point ¢re_point, const Point &intersect_point, const Point &high_point) |
Draw the outline of an ellipse. More... | |
virtual void | fill_ellipse (const Point ¢re_point, const Point &intersect_point, const Point &high_point) |
Draw a filled ellipse. More... | |
virtual void | text (int x, int y, const std::string &text)=0 |
Draw text at the given location in the current WIMP font. More... | |
virtual void | text (int x, int y, const std::string &text, const Font &font)=0 |
Draw text at the given location in the given font. More... | |
virtual void | text_colours (Colour foreground, Colour background)=0 |
Set the text colours for the current WIMP font. More... | |
virtual void | text_colours (Font &font, Colour foreground, Colour background)=0 |
Set text colours for the given font. More... | |
virtual void | text (const Point &pt, const std::string &str) |
Draw text at the given location in the current WIMP font. More... | |
virtual void | text (const Point &pt, const std::string &str, const Font &font) |
Draw text at the given location in the given font. More... | |
virtual void | image (int x, int y, const Image &image)=0 |
Draw an image. More... | |
virtual void | image (const Point &pt, const Image &im) |
Draw an image. More... | |
virtual void | fill (int x, int y, const DrawPath &path, DrawFillStyle fill_style=WINDING_NON_ZERO, int flatness=1)=0 |
Fill a draw path. More... | |
virtual void | fill (const Point &pt, const DrawPath &path, DrawFillStyle fill_style=WINDING_NON_ZERO, int flatness=1) |
Fill a draw path. More... | |
virtual void | stroke (int x, int y, const DrawPath &path, DrawFillStyle fill_style=WINDING_NON_ZERO, int flatness=1, int thickness=0, DrawCapAndJoin *cap_and_join=0, DrawDashPattern *dashes=0)=0 |
Plot the lines in a path. More... | |
virtual void | stroke (const Point &pt, const DrawPath &path, DrawFillStyle fill_style=WINDING_NON_ZERO, int flatness=1, int thickness=0, DrawCapAndJoin *cap_and_join=0, DrawDashPattern *dashes=0) |
Plot the lines in a path. More... | |
Interface to drawing graphics to the screen.
This provides a standard interface that can be used with all the graphics classes.
|
inlinevirtual |
Draw an arc.
centre_point | centre of circle arc is on |
start_point | start of arc |
end_point | point on line from centre to the end of the arc |
|
pure virtual |
Draw arc around a circle.
centre_x | centre of circle arc is on |
centre_y | centre of circle arc is on |
start_x | start of arc |
start_y | start of arc |
end_x | point on line from centre to the end of the arc |
end_y | point on line from centre to the end of the arc |
Implemented in tbx::OSGraphics.
|
pure virtual |
Set the background colour for graphics.
colour | new colour for the background |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw the outline of a circle.
centre_point | coordinates of centre of the circle |
radius | radius of the circle |
|
pure virtual |
Draw the outline of a circle.
centre_x | x coordinate of centre of the circle |
centre_y | y coordinate of centre of the circle |
radius | radius of the circle |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw the outline of an ellipse.
centre_point | centre of the ellipse |
intersect_point | intersection of centre and edge of ellipse |
high_point | highest (or lowest) point on the ellipse |
|
pure virtual |
Draw the outline of an ellipse.
centre_x | centre of the ellipse |
centre_y | centre of the ellipse |
intersect_x | intersection of centre_y and edge of ellipse |
intersect_y | intersection of centre_y and edge of ellipse |
high_x | highest (or lowest) point on the ellipse |
high_y | highest (or lowest) point on the ellipse |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Fill a draw path.
The path is drawn by transforming it so the user units used in it are treated as OS coordinates.
pt | coordinates of bottom left to place the path |
path | the DrawPath to fill |
style | style flags for filling. Default WINDING_NON_ZERO. |
flatness | maximum distance allowed from beizer curve when flattening it in user units. Defaults to 1 as this gives a good curve with the transform used. |
Reimplemented in tbx::OffsetGraphics.
|
pure virtual |
Fill a draw path.
The path is drawn by transforming it so the user units used in it are treated as OS coordinates.
x | coordinate of bottom left to place the path |
y | coordinate of bottom left to place the path |
path | the DrawPath to fill |
style | style flags for filling. Default WINDING_NON_ZERO. |
flatness | maximum distance allowed from beizer curve when flattening it in user units. Defaults to 1 as this gives a good curve with the transform used. |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
inlinevirtual |
Draw a filled circle.
centre_point | coordinates of centre of the circle |
radius | radius of the circle |
|
pure virtual |
Draw a filled circle.
centre_x | x coordinate of centre of the circle |
centre_y | y coordinate of centre of the circle |
radius | radius of the circle |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw a filled ellipse.
centre_point | centre of the ellipse |
intersect_point | intersection of centre and edge of ellipse |
high_point | highest (or lowest) point on the ellipse |
|
pure virtual |
Draw a filled ellipse.
centre_x | centre of the ellipse |
centre_y | centre of the ellipse |
intersect_x | intersection of centre_y and edge of ellipse |
intersect_y | intersection of centre_y and edge of ellipse |
high_x | highest (or lowest) point on the ellipse |
high_y | highest (or lowest) point on the ellipse |
Implemented in tbx::OSGraphics.
|
pure virtual |
Draw a filled polygon.
The algorithm that fills the polygon is not guaranteed to be accurate unless it can fill it by using triangles swept from the first point.
points | array of vertices of the polygon |
num | number of vertices |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw a filled rectangle.
r | coordinates of rectangle |
|
inlinevirtual |
Draw the outline of a rectangle.
min_point | minimum coordinates of rectangle |
max_point | maximum coordinates of rectangle |
|
pure virtual |
Draw a filled rectangle.
xmin | minimum x coordinate of rectangle |
ymin | minimum y coordinate of rectangle |
xmax | maximum x coordinate of rectangle |
ymax | maximum y coordinate of rectangle |
Implemented in tbx::OSGraphics.
|
pure virtual |
Set the foreground colour for graphics.
colour | new colour for the foreground |
Implemented in tbx::OSGraphics.
Draw an image.
pt | coordinates for bottom left of image |
im | Image to draw |
Reimplemented in tbx::OffsetGraphics.
|
pure virtual |
Draw an image.
x | x coordinate for bottom left of image |
y | x coordinate for bottom left of image |
image | Image to draw |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
Draw a line between the given two points.
from_point | coordinates of start of line |
to_point | coordinates of end of line |
|
inlinevirtual |
Draw a line from the last point visited to the given location.
to_point | coordinates to draw line to |
|
inlinevirtual |
Draw a line between the given two points.
fx | x coordinate of start of line |
fy | y coordinate of start of line |
tx | x coordinate of end of line |
ty | y coordinate of end of line |
Reimplemented in tbx::OSGraphics.
|
pure virtual |
Draw a line from the last point visited to the given location.
tx | coordinate of end of line |
ty | coordinate of end of line |
Implemented in tbx::OSGraphics.
Convert from OS units to logical coordinates.
b | value to convert |
Reimplemented in tbx::OSGraphics, and tbx::OffsetGraphics.
Convert from OS units to logical coordinates.
pt | value to convert |
Reimplemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
pure virtual |
Convert from OS units to logical x value.
os_x | value to convert |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
pure virtual |
Convert from OS units to logical y value.
os_y | value to convert |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
inlinevirtual |
Move the graphics cursor to the given location.
point | coordinates to move to |
|
pure virtual |
Move the graphics cursor to the given point.
x | x coordinate |
y | y coordinate |
Implemented in tbx::OSGraphics.
Convert from logical coordinates to OS units.
b | value to convert |
Reimplemented in tbx::OSGraphics, and tbx::OffsetGraphics.
Convert from logical coordinates to OS units.
pt | value to convert |
Reimplemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
pure virtual |
Convert from logical x value to OS units.
logical_x | value to convert |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
pure virtual |
Convert from logical y value to OS units.
logical_y | value to convert |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
pure virtual |
Draw a path of lines connecting the given points.
points | array of points to connect |
num | number of points to connect |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw a point at the given location.
pt | coordinates to draw point |
|
pure virtual |
Draw a point at the given location.
x | x coordinate |
y | y coordinate |
Implemented in tbx::OSGraphics.
|
pure virtual |
Draw the outline of a polygon.
This draws a line connecting all the points and an additional line connecting the last and first points.
points | array of vertices of the polygon |
num | number of vertices |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw the outline of a rectangle.
r | coordinates of rectangle |
|
inlinevirtual |
Draw the outline of a rectangle.
min_point | minimum coordinates of rectangle |
max_point | maximum coordinates of rectangle |
|
pure virtual |
Draw the outline of a rectangle.
xmin | minimum x coordinate of rectangle |
ymin | minimum y coordinate of rectangle |
xmax | maximum x coordinate of rectangle |
ymax | maximum y coordinate of rectangle |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw a sector of a circle.
centre_point | centre of circle sector is on |
start_point | start of sector |
end_point | point on line from centre to the end of the sector |
|
pure virtual |
Draw a sector of a circle.
centre_x | centre of circle arc is on |
centre_y | centre of circle arc is on |
start_x | start of arc |
start_y | start of arc |
end_x | point on line from centre to the end of the arc |
end_y | point on line from centre to the end of the arc |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Draw a segment of a circle.
centre_point | centre of circle segment is on |
start_point | start of segment |
end_point | point on line from centre to the end of the segment |
|
pure virtual |
Draw a segment of a circle.
centre_x | centre of circle arc is on |
centre_y | centre of circle arc is on |
start_x | start of arc |
start_y | start of arc |
end_x | point on line from centre to the end of the arc |
end_y | point on line from centre to the end of the arc |
Implemented in tbx::OSGraphics.
|
inlinevirtual |
Plot the lines in a path.
The path is drawn by transforming it so the user units used in it are treated as OS coordinates.
pt | coordinates of bottom left to place the path |
path | the DrawPath to draw |
fill_style | DrawFillStyle. Default WINDING_NON_ZERO. |
transform | pointer to transformation matrix, or 0 for identity matrix |
flatness | flatness. Defaults to 1 as this gives a good curve with the transform used. |
thickness | line thickness, or 0 for default. If the thickness is zero then the line is drawn with the minimum width that can be used, given the limitations of the pixel size (so lines are a single pixel wide). If the thickness is n, then the line will be drawn with a thickness of n/2 user coordinates translated to pixels on either side of the theoretical line position. If the line thickness is non-zero, then the cap and join parameter must also be passed. |
cap_and_join | pointer to line cap and join specification (if required) |
pointer | to dash pattern, or 0 for no dashes |
Reimplemented in tbx::OffsetGraphics.
|
pure virtual |
Plot the lines in a path.
The path is drawn by transforming it so the user units used in it are treated as OS coordinates.
x | coordinate of bottom left to place the path |
y | coordinate of bottom left to place the path |
path | the DrawPath to draw |
fill_style | DrawFillStyle. Default WINDING_NON_ZERO. |
transform | pointer to transformation matrix, or 0 for identity matrix |
flatness | flatness. Defaults to 1 as this gives a good curve with the transform used. |
thickness | line thickness, or 0 for default. If the thickness is zero then the line is drawn with the minimum width that can be used, given the limitations of the pixel size (so lines are a single pixel wide). If the thickness is n, then the line will be drawn with a thickness of n/2 user coordinates translated to pixels on either side of the theoretical line position. If the line thickness is non-zero, then the cap and join parameter must also be passed. |
cap_and_join | pointer to line cap and join specification (if required) |
pointer | to dash pattern, or 0 for no dashes |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
inlinevirtual |
Draw text at the given location in the current WIMP font.
pt | coordinates for base line and left of text |
str | text to draw |
|
inlinevirtual |
Draw text at the given location in the given font.
pt | coordinates for base line and left of text |
str | text to draw |
font | font to use to draw the text |
|
pure virtual |
Draw text at the given location in the current WIMP font.
x | x coordinate for base line of text |
y | y coordinate for left of text |
text | text to draw |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
|
pure virtual |
Draw text at the given location in the given font.
x | x coordinate for base line of text |
y | y coordinate for left of text |
text | text to draw |
font | font to use to draw the text |
Implemented in tbx::OSGraphics, and tbx::OffsetGraphics.
Set the text colours for the current WIMP font.
foreground | text foreground colour |
background | text background colour |
Implemented in tbx::OSGraphics.
|
pure virtual |
Set text colours for the given font.
font | to set colours for |
foreground | text foreground colour |
background | text background colour |
Implemented in tbx::OSGraphics.
|
pure virtual |
Set the background colour for graphics to one of the standard WIMP colours.
colour | new colour for the background |
Implemented in tbx::OSGraphics.
|
pure virtual |
Set the foreground colour for graphics to one of the standard WIMP colours.
colour | new colour for the foreground |
Implemented in tbx::OSGraphics.