BitmapMask


This class has been removed in release 10.0.0. Use Image class instead.

This class represents bitmap/image/texture in system memory where each point/pixel is represented as 1-component value(transparency or mask).

Please also see highlighted comment for Bitmap class. Those important comment is also applied to this class.

You can find more information in comments below.

class BitmapMask
    {
    public:
        BitmapMask(); // Create empty        BitmapMask(const int w, const int h); // Create with specified size        BitmapMask(const int w, const int h, const unsigned char *data); // Create with specified size and data.        BitmapMask(const BitmapMask &other); // Copy        BitmapMask(BitmapMask &&other); // Move        ~BitmapMask(); // Destructor
        const COLUMN &operator[](const int x) const; // Return bitmap column. You can access pixel as bmp[x][y]. This is the fastest access pixel method but it is unsafe, so be sure you are not accessing pixel outside of bitmap        COLUMN &operator[](const int x); // Return bitmap column. You can access pixel as bmp[x][y]. This is the fastest access pixel method but it is unsafe, so be sure you are not accessing pixel outside of bitmap        BitmapMask &operator=(const BitmapMask &other); // Copy        BitmapMask &operator=(BitmapMask &&other); // Move
        int getWidth() const; // Return width        int getHeight() const; // Return height        unsigned char getPixel(const int x, const int y) const; // Return pixel from specified position. It is safe method of accessing pixel as it checks whether specified coordinates are inside the bitmap. If bitmap is empty, zero pixel will be returned. If coordinates are outside the bitmap, nearest border pixel will be returned. This method is slower than corresponding operators because it check coordinates first        unsigned char getPixel(const int x, const int y, const unsigned char def) const; // Return pixel from specified position or def one if position is outside the bitmap        const unsigned char *getData() const; // Return bitmap data        const bool isEmpty() const; // Check whether it is empty
        bool setWidth(const int value); // Set width        bool setHeight(const int value); // Set height        bool setSize(const int w, const int h); // Set size        bool setPixel(const int x, const int y, const unsigned char value); // Set pixel at specified position. It is safe method for setting pixel as it checks whether specified coordinates are inside the bitmap. If coordinates are invalid, no changes will be made. This method is slower than corresponding operators because it check coordinates first        bool setData(const int w, const int h, const unsigned char *data); // Set size and data    };

Following operators are also available.

bool operator==(const BitmapMask &a, const BitmapMask &b); // Check if bitmaps are equal    bool operator!=(const BitmapMask &a, const BitmapMask &b); // Check if bitmaps are not equal    std::wostream &operator<<(std::wostream &stream, const BitmapMask &a); // Output as source code
Namespace: nitisa
Include: Nitisa/Core/Bitmap/BitmapMask.h (For class declaration)
Nitisa/Core/Bitmap/BitmapMaskUtils.h (For standalone operators)