class Core::Portable::MonoBitmapRenderer

Overview

Render into monochrome bitmap, white (Colors::kWhite) represents a lit pixel. More…

#include <coregraphics.h>

class MonoBitmapRenderer: public Core::Portable::BitmapGraphicsRenderer
{
public:
    // construction

    MonoBitmapRenderer(Bitmap& bitmap);

    // methods

    INLINE void setPixel(BitmapData& data, int x, int y, bool state);
};

Inherited Members

public:
    // typedefs

    typedef int32 TypeID;

    // enums

    enum Direction;
    enum Modes;

    // fields

    static const int kMaxMultilineStringLength = STRING_STACK_SPACE_MAX;

    // methods

    virtual void* castTo(TypeID typeId) = 0;
    virtual void* castTo(TypeID typeId);
    virtual DECLARE_CORE_CLASS('Grph', Graphics, TypedObject) = 0;
    virtual bool setClip(RectRef rect) = 0;
    virtual int setMode(int mode) = 0;
    virtual bool fillRect(RectRef rect, ColorRef color) = 0;
    virtual bool drawRect(RectRef rect, ColorRef color) = 0;

    virtual bool drawLinearGradient(
        PointRef startPoint,
        PointRef endPoint,
        ColorRef startColor,
        ColorRef endColor,
        Direction direction
    ) = 0;

    virtual bool drawLine(PointRef p1, PointRef p2, ColorRef color) = 0;

    virtual bool drawString(
        RectRef rect,
        CStringPtr text,
        ColorRef color,
        CStringPtr fontName = nullptr,
        int alignment = Alignment::kLeftCenter
    ) = 0;

    virtual bool drawMultiLineString(
        RectRef rect,
        CStringPtr text,
        ColorRef color,
        CStringPtr fontName = nullptr,
        int alignment = Alignment::kLeftCenter
    ) = 0;

    virtual int getStringWidth(CStringPtr text, CStringPtr fontName = nullptr) const = 0;

    virtual bool drawBitmap(
        PointRef pos,
        Bitmap& bitmap,
        RectRef srcRect,
        const BitmapMode* mode = nullptr
    ) = 0;

    virtual const BitmapFont* getFont(CStringPtr fontName) const = 0;
    bool drawBitmap(PointRef pos, Bitmap& bitmap, const BitmapMode* mode = nullptr);
    DECLARE_CORE_CLASS('GRnd', GraphicsRenderer, Graphics);
    bool setOrigin(PointRef point);
    virtual bool setClip(RectRef rect);
    virtual int setMode(int mode);
    virtual bool fillRect(RectRef rect, ColorRef color);
    virtual bool drawRect(RectRef rect, ColorRef color);

    virtual bool drawLinearGradient(
        PointRef startPoint,
        PointRef endPoint,
        ColorRef startColor,
        ColorRef endColor,
        Direction direction
    );

    virtual bool drawLine(PointRef p1, PointRef p2, ColorRef color);

    virtual bool drawString(
        RectRef rect,
        CStringPtr text,
        ColorRef color,
        CStringPtr fontName = nullptr,
        int alignment = Alignment::kLeftCenter
    );

    virtual bool drawMultiLineString(
        RectRef rect,
        CStringPtr text,
        ColorRef color,
        CStringPtr fontName = nullptr,
        int alignment = Alignment::kLeftCenter
    );

    virtual int getStringWidth(CStringPtr text, CStringPtr fontName = nullptr) const;
    virtual const BitmapFont* getFont(CStringPtr fontName) const;

    virtual bool drawBitmap(
        PointRef pos,
        Bitmap& bitmap,
        RectRef srcRect,
        const BitmapMode* mode = nullptr
    );

    DECLARE_CORE_CLASS('BGRd', BitmapGraphicsRenderer, GraphicsRenderer);
    INLINE Bitmap& getBitmap();
    INLINE bool isVisible(int x, int y) const;

Detailed Documentation

Render into monochrome bitmap, white (Colors::kWhite) represents a lit pixel.

Exception: text rendering ignores color, use BitmapFont::kInvertColor to invert it.