#include <Bitmap.h>
Public Types | |
typedef Bitmap::BitmapColour_s | BitmapColour |
enum | Margin { Left = 0, Right = 1, Top = 2, Bottom = 3, All } |
Public Member Functions | |
Bitmap (const int width, const int height, const int bpp=1, bool expandable=true, const int maxwidth=-1, const int maxheight=-1) throw (BitmapError) | |
Create a new bitmap with the given parameters. | |
~Bitmap () | |
void | paint (const int x, const int y, const int w, const int h, const Byte *b) throw (BitmapError) |
Paint a bitmap onto the master bitmap. | |
void | rule (const int x, const int y, const int w, const int h) throw (BitmapError) |
Draws on the master bitmap a block (a `rule' in TeX terms) of height h and width w pixels. | |
void | strut (const int x, const int y, const int l, const int r, const int t, const int b) throw (BitmapError) |
Draws a `strut' on the master bitmap. | |
void | write (const string filename, const string format) throw (BitmapError) |
Writes the bitmap out to the specified file. | |
void | freeze () |
Freeze the bitmap and bounding box. | |
void | crop () |
Crops the bitmap. | |
void | crop (Margin spec, int pixels, bool absolute=false) throw (BitmapError) |
Specifies a crop. | |
void | blur () |
Makes a very simple-minded attempt to antialias the bitmap by blurring it. | |
void | clear () |
Resets the bitmap to its initial state. | |
void | setTransparent (const bool sw) |
Sets the current bitmap to be transparent, if possible. | |
void | setRGB (const bool fg, const BitmapColour *) |
Sets the foreground or background colour. | |
void | scaleDown (const int factor) throw (BitmapError) |
Scales down the bitmap by a numerical factor. | |
bool | empty () const |
Is the bitmap empty? If nothing has (yet) been written to the bitmap, or if everything that was written was out of bounds, then the bitmap is empty. | |
bool | overlaps () const |
Does the bitmap overlap its canvas? This can only be true before a (implicit or explicit) call to freeze, since that normalizes the bounding box variables. | |
int * | boundingBox () |
Obtain a bounding box for the current bitmap. | |
int | getWidth () const |
Returns the total width of the bitmap. | |
int | getHeight () const |
Returns the total height of the bitmap. | |
void | mark (const double x, const double y) |
Marks a particular spot in the bitmap. | |
BitmapMark * | getMark () |
Obtains the mark for this bitmap. | |
const_iterator | begin () |
Returns the beginning of a sequence of bitmap rows. | |
const_iterator | end () const |
Returns the end of a sequence of bitmap rows. | |
Static Public Member Functions | |
void | cropDefault (Margin spec, int pixels, bool absolute=false) throw (BitmapError) |
Specifies a default crop. | |
void | setDefaultRGB (const bool fg, const BitmapColour *) |
Sets the default foreground or background colours. | |
verbosities | verbosity (const verbosities level) |
Sets the verbosity of the current class. | |
void | logBitmapInfo (const char *prefix) |
Sets whether bitmap information is logged. | |
Public Attributes | |
const_iterator | runningIterator_ |
Static Public Attributes | |
const_iterator | endIterator_ |
|
|
|
|
|
Create a new bitmap with the given parameters. Coordinates on the bitmap run from 0 to W-1, and 0 to H-1, with point (0,0) in the top-left corner, the x-axis increasing to the right, and the y-axis increasing downwards.
|
|
|
|
Returns the beginning of a sequence of bitmap rows. Freezes the bitmap as a side-effect. |
|
Makes a very simple-minded attempt to antialias the bitmap by blurring it. Opening the DVI file with a magnification setting, and then calling scaleDown will generally produce a much better effect. Freezes the bitmap as a side-effect. |
|
Obtain a bounding box for the current bitmap. This returns a four-element array consisting of, in order,
[2]-[0] is the number of pixels which the blackened area occupies. Note that `blackened pixels' here includes those notionally blackened by the strut() method. If the bitmap has been cropped, this bounding box reflects the crop margins.The returned array occupies static storage, and is always current as of the last time this method was called.
The methods
It is possible for the bounding-box to be bigger than the bitmap, if rules or bitmaps have been painted on the bitmap in such a way that they overlap the boundaries of the bitmap, and if it is called before an explicit or implicit call to Note that the order of the four dimensions is not that of the Postscript BoundingBox, which is (llx, lly, urx, ury) rather than here, effectively, (ulx, uly, lrx, lry). This is because the position of the upper-left corner (ulx, uly) is the natural TeX reference point.
|
|
Resets the bitmap to its initial state. This clears the bitmap by setting all the pixels to white, unfreezing it, and resetting the bounding box and crops to their initial states. It does not deallocate any memory, however, so if the bitmap has expanded in the past, the reset bitmap is the same size. It does not reset the transparency flag or adjust the colour setting, or reset the pixel depth. This latter behaviour may change in future. |
|
Specifies a crop.
If the Since the implication of this is that a call .crop(All, x, true);would set the crop box to be zero size, this combination is forbidden.
|
|
Crops the bitmap. This applies the cropping specified in methods crop(Margin,int,bool) and cropDefault. Freezes the bitmap as a side-effect. |
|
Specifies a default crop. This is exactly the same as crop(Margin,int,bool), except that it specifies this for all the bitmaps subsequently created by this class.
|
|
Is the bitmap empty? If nothing has (yet) been written to the bitmap, or if everything that was written was out of bounds, then the bitmap is empty.
|
|
Returns the end of a sequence of bitmap rows.
|
|
Freeze the bitmap and bounding box.
This prevents any further changes to the bitmap by the methods
If method |
|
Returns the total height of the bitmap. This may not the the initial size of the bitmap, if it has expanded since then.
|
|
Obtains the mark for this bitmap.
|
|
Returns the total width of the bitmap. This may not the the initial size of the bitmap, if it has expanded since then.
|
|
Sets whether bitmap information is logged.
If logging is enabled, then the details of the bitmaps are sent to the
|
|
Marks a particular spot in the bitmap. This spot can be retrieved later using getMark. The top-left pixel in the bitmap has mark coordinates (0,0). The input coordinates are not restricted to be on the bitmap.
|
|
Does the bitmap overlap its canvas? This can only be true before a (implicit or explicit) call to freeze, since that normalizes the bounding box variables.
|
|
Paint a bitmap onto the master bitmap.
The bitmap to be added is given in a one-dimensional array
The pixel at position (x,y) on the new bitmap is at position Any parts of the new bitmap falling outside the boundary of the master are cropped.
|
|
Draws on the master bitmap a block (a `rule' in TeX terms) of height h and width w pixels. The bottom left corner of the rule occupies pixel (x,y) on the master bitmap.
|
|
Scales down the bitmap by a numerical factor. The resulting bitmap has a linear dimension smaller than the original by the given factor. The pixels in the resulting bitmap are resampled so that this gives a basic anti-aliasing effect. We throw an exception if you try to scale down an empty bitmap, simply on the grounds that this is probably an error, and you want to know about it. Freezes the bitmap as a side-effect.
|
|
Sets the default foreground or background colours.
This is just like
|
|
Sets the foreground or background colour.
|
|
Sets the current bitmap to be transparent, if possible.
|
|
Draws a `strut' on the master bitmap.
This is essentially the same as the
|
|
Sets the verbosity of the current class.
|
|
Writes the bitmap out to the specified file.
The Freezes the bitmap as a side-effect.
|
|
|
|
|