#include <image.h>
Inheritance diagram for Plot::AARImage

Public Types | |
| typedef PixelMatrix::size_type | PixelSubscript |
| Underlying pixel matrix subscript type; could be unsigned. More... | |
| typedef PixelSubscript | size_type |
| typedef PixelType | value_type |
| typedef double | CartesianCoordinate |
| Arbitrary floating-point x or y position in the plane occupied by the image. More... | |
Public Methods | |
| AARImage (PixelSubscript height=0, PixelSubscript width=0) | |
| Blank or empty image constructor. More... | |
| void | draw_pixel (const PixelSubscript r, const PixelSubscript c, PixelType p) |
| Sets the specified pixel to the given color, if in bounds. More... | |
| const PixelType& | get_pixel (const PixelSubscript r, const PixelSubscript c) const |
| Returns the current value of the specified pixel. More... | |
| PixelSubscript | nrows () const |
| Returns the number of pixel rows in the image. More... | |
| PixelSubscript | ncols () const |
| Returns the number of pixel columns in the image. More... | |
| void | draw_rectangle (int r1, int c1, int r2, int c2, PixelType p) |
| Draws a single-color rectangle bounded by the two specified points. More... | |
| void | draw_line (int r1, int c1, int r2, int c2, PixelType p, int thickness=1) |
| Draws a single-color line between the two specified points. More... | |
| void | draw_bar (CartesianCoordinate cx, CartesianCoordinate cy, double angle, double length, double width=1, PixelType p=default_fg, bool always_draw=true) |
| Same as draw_line but specified by the midpoint of the line in Cartesian space rather than endpoints in matrix coordinates. More... | |
| void | draw_border (size_type borderwidth=1, PixelType p=default_border) |
| Draws a single-color rectangular border around the image. More... | |
| ostream& | ppm_write ( ostream& os, const string& comments="", int max_val=255 ) |
| Writes this image to a ppm file. More... | |
Static Public Attributes | |
| PixelType | default_fg |
| Global defaults. More... | |
| PixelType | default_bg |
| PixelType | default_border |
Protected Methods | |
| PixelSubscript | col_from_x (const CartesianCoordinate x) |
| Returns the pixel column corresponding to the specified Cartesian coordinate. More... | |
| PixelSubscript | row_from_y (const CartesianCoordinate y) |
| Returns the pixel row corresponding to the specified Cartesian coordinate. More... | |
| bool | inbounds (const PixelSubscript r, const PixelSubscript c) const |
| Returns true if the given coordinates are within the image matrix. More... | |
Friends | |
| template<classPType, classPMatrix> ostream& | operator<<<PType, PMatrix> (ostream& s, const AARImage<PType,PMatrix>& o) |
| Writes a readable representation to a stream. | |
In this class and its derived classes, the emphasis is on generality and simplicity of implementation rather than speed. To be suitable for real-time display, some of the routines may need to be rewritten for common special cases such as axis-aligned straight lines, square box outlines, etc.
All integer coordinate pairs in the base class are in the form (row,column), laid out in standard mathematical matrix order with the origin in the upper left, columns increasing to the right, and rows increasing downwards. All floating-point coordinate pairs are in standard mathematical Cartesian space, with the origin at the lower left, x increasing to the right, and y increasing upwards. In Cartesian space, units are centered in between integer locations, so e.g. the lower left unit is centered on location (0.5,0.5).
Definition at line 43 of file image.h.
|
|||
|
Arbitrary floating-point x or y position in the plane occupied by the image.
|
|
|||
|
Underlying pixel matrix subscript type; could be unsigned.
|
|
|||
|
|
|
|||
|
|
|
||||||
|
Blank or empty image constructor.
|
|
||||
|
Returns the pixel column corresponding to the specified Cartesian coordinate.
|
|
||||||||||||||||
|
Same as draw_line but specified by the midpoint of the line in Cartesian space rather than endpoints in matrix coordinates. Takes a center point in Cartesian space, an angle (in radians), and a length. Unlike draw_line, thick lines should approximate a rotated rectangle properly, at least for large enough thicknesses, but they are not implemented very efficiently. The origin is at the at the lower left, with x and y axes increasing to the right and upwards, respectively. The length is specified between the centers of the two endpoint pixels. As a result, a horizontal or vertical bar of length 0 will consist of one pixel, length 1, 2 pixels, length 5, 6 pixels, etc. |
|
||||||
|
Draws a single-color rectangular border around the image.
|
|
||||||||||||||
|
Draws a single-color line between the two specified points. The "thickness" argument is just a hack. For oblique angles, it draws sheared rectangles instead of rotated ones, but that's better than nothing and much simpler than doing scan line conversion. |
|
||||||||
|
Sets the specified pixel to the given color, if in bounds.
|
|
||||||||||||
|
Draws a single-color rectangle bounded by the two specified points. The first point is included, and the second is not. |
|
||||||
|
Returns the current value of the specified pixel.
|
|
||||||
|
Returns true if the given coordinates are within the image matrix.
|
|
||||
|
Returns the number of pixel columns in the image.
|
|
||||
|
Returns the number of pixel rows in the image.
|
|
||||||||
|
Writes this image to a ppm file. The given ostream should presumably be fresh, i.e. with nothing yet written, and should be closed afterwards. If 'comments' contains newlines, each should be followed immediately by a '#'. |
|
||||
|
Returns the pixel row corresponding to the specified Cartesian coordinate.
|
|
|||
|
|
|
|||
|
|
|
|||
|
Global defaults.
|
1.2.1 written by Dimitri van Heesch,
© 1997-2000