tbx
0.7.3
|
Class to draw to graphics to the screen using standard OS routines with no translation or scaling. More...
#include <osgraphics.h>
Public Types | |
enum | PlotAction { ACTION_OVERWRITE, ACTION_OR, ACTION_AND, ACTION_XOR, ACTION_INVERT, ACTION_NONE, ACTION_AND_NOT, ACTION_OR_NOT } |
Public Member Functions | |
OSGraphics () | |
Create the graphics class with the default plot action of overwrite. | |
virtual void | plot (int code, int x, int y) |
Execute the OS_Plot swi. More... | |
void | plot_action (PlotAction action) |
Sets the plot action. More... | |
virtual int | os_x (int logical_x) const |
Convert from logical x value to OS units. More... | |
virtual int | os_y (int logical_y) const |
Convert from logical y value to OS units. More... | |
virtual int | logical_x (int os_x) const |
Convert from OS units to logical x value. More... | |
virtual int | logical_y (int os_y) const |
Convert from OS units to logical y value. More... | |
virtual Point | os (const Point &pt) |
Convert from logical coordinates to OS units. More... | |
virtual Point | logical (const Point &pt) |
Convert from OS units to logical coordinates. More... | |
virtual BBox | os (const BBox &b) |
Convert from logical coordinates to OS units. More... | |
virtual BBox | logical (const BBox &b) |
Convert from OS units to logical coordinates. More... | |
virtual void | foreground (Colour colour) |
Set foreground graphics colour to the nearest match to the given colour for the current screen mode. More... | |
virtual void | background (Colour colour) |
Set background graphics colour to the nearest match to the given colour for the current screen mode. More... | |
virtual void | wimp_foreground (WimpColour colour) |
Set the graphics foreground colour to the given WIMP colour. | |
virtual void | wimp_background (WimpColour colour) |
Set the graphics background colour to the given WIMP colour. | |
virtual void | move (int x, int y) |
Move graphics position. | |
virtual void | point (int x, int y) |
Draw a single pixel point. | |
virtual void | line (int fx, int fy, int tx, int ty) |
Draw a line betweenn the given coordinates. | |
virtual void | line (int x, int y) |
Draw a line from the current graphics position to the given coordinates. | |
virtual void | rectangle (int xmin, int ymin, int xmax, int ymax) |
Draw outline of a rectangle. | |
virtual void | fill_rectangle (int xmin, int ymin, int xmax, int ymax) |
Fill a rectangle the current foreground colour. | |
virtual void | circle (int centre_x, int centre_y, int radius) |
Draw outline of a circle. More... | |
virtual void | fill_circle (int centre_x, int centre_y, int radius) |
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) |
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) |
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) |
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) |
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) |
Draw a filled ellipse. More... | |
virtual void | path (const Point *points, int num) |
Draw a line through the specified points. More... | |
virtual void | polygon (const Point *points, int num) |
Draw outline of a polygon. More... | |
virtual void | fill_polygon (const Point *points, int num) |
Fill a polygon. More... | |
virtual void | text (int x, int y, const std::string &text) |
Draw text in current desktop font. | |
virtual void | text (int x, int y, const std::string &text, const Font &font) |
Draw text in given font. | |
virtual void | text_colours (Colour foreground, Colour background) |
Set the colours for the desktop font. | |
virtual void | text_colours (Font &font, Colour foreground, Colour background) |
Set the colours for the given font. | |
virtual void | image (int x, int y, const Image &image) |
Draw an image at given location. | |
virtual void | fill (int x, int y, const DrawPath &path, DrawFillStyle fill_style=WINDING_NON_ZERO, int flatness=1) |
Fill an draw path at the given location. | |
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) |
Draw lines of a draw path at the given location. | |
void | clear () |
Clear the current graphics window to the background colour. | |
![]() | |
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 (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 (const Point &pt, const Image &im) |
Draw an image. 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 (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... | |
Protected Attributes | |
int | _plot_action |
Stores the current Plot action. | |
Class to draw to graphics to the screen using standard OS routines with no translation or scaling.
Enum for how to combine plotted graphics with the screen
|
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 |
Implements tbx::Graphics.
|
virtual |
Set background graphics colour to the nearest match to the given colour for the current screen mode.
It will use an ECF pattern to get a better match.
Implements tbx::Graphics.
|
virtual |
Draw outline of a circle.
centre_x | centre of circle |
centre_y | centre of circle |
radius | radius of the circle |
Implements tbx::Graphics.
|
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 |
Implements tbx::Graphics.
|
virtual |
Draw a filled circle.
centre_x | centre of circle |
centre_y | centre of circle |
radius | radius of the circle |
Implements tbx::Graphics.
|
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 |
Implements tbx::Graphics.
|
virtual |
Fill a polygon.
The polygon is filled using triangles swept from the first point so the line from the first point to any vertex should not cross any edges of the polygon.
points | vertices of the polygon |
num | number of vertices (minimum of 3) |
std::domain_error | if num is less than three |
Implements tbx::Graphics.
|
virtual |
Set foreground graphics colour to the nearest match to the given colour for the current screen mode.
It will use an ECF pattern to get a better match.
Implements tbx::Graphics.
Convert from OS units to logical coordinates.
pt | value to convert |
Reimplemented from tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
Convert from OS units to logical coordinates.
b | value to convert |
Reimplemented from tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
|
inlinevirtual |
Convert from OS units to logical x value.
os_x | value to convert |
Implements tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
|
inlinevirtual |
Convert from OS units to logical y value.
os_y | value to convert |
Implements tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
Convert from logical coordinates to OS units.
pt | value to convert |
Reimplemented from tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
Convert from logical coordinates to OS units.
b | value to convert |
Reimplemented from tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
|
inlinevirtual |
Convert from logical x value to OS units.
logical_x | value to convert |
Implements tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
|
inlinevirtual |
Convert from logical y value to OS units.
logical_y | value to convert |
Implements tbx::Graphics.
Reimplemented in tbx::OffsetGraphics.
|
virtual |
Draw a line through the specified points.
points | array of points to draw through |
num | number of points |
Implements tbx::Graphics.
|
virtual |
Execute the OS_Plot swi.
For details of the plot codes see the RISC OS PRM.
For clarity use and protability to other Graphics derived classes use the move, line, etc. codes
Reimplemented in tbx::OffsetGraphics.
void OSGraphics::plot_action | ( | PlotAction | action | ) |
Sets the plot action.
The plot action. The plot action doesn't take effect until the next colour change.
|
virtual |
Draw outline of a polygon.
points | vertices of the polygon |
num | number of vertices (minimum of 3) |
std::domain_error | if num is less than three |
Implements tbx::Graphics.
|
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 |
Implements tbx::Graphics.
|
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 |
Implements tbx::Graphics.