#include <Pt/Gfx/Bitmap.h>
Off-screen image that can be painted. More...
Inherits PaintSurface.
Public Member Functions | |
| Bitmap () | |
| Constructs an empty bitmap. | |
| Bitmap (const Gfx::SizeF &size, std::size_t stride=0) | |
| Constructs a bitmap with the given size and optional stride. | |
| virtual | ~Bitmap () |
| Destroys the bitmap. | |
| void | reset () |
| Resets to empty state. | |
| void | reset (const Gfx::Image &image) |
| Replaces the bitmap with an existing image. | |
| void | reset (const Gfx::SizeF &, std::size_t stride=0) |
| Resets the bitmap to a new size in physical pixels. | |
| bool | empty () const |
| Returns true if no image data is available. | |
| const Gfx::Image & | image () const |
| Returns the underlying image. | |
| void | setScaleFactor (double scaleFactor) |
| Sets the target scale factor. | |
| void | drawBitmap (const Pt::Gfx::PointF &to, const Bitmap &image, const Gfx::Paint &paint, const Gfx::RectF *rect=0) |
| Draws another bitmap into this bitmap. | |
| const Gfx::ImageFormat & | format () const |
| Returns the image format. | |
| const Gfx::SizeF & | size () const |
| Returns the size in physical pixels. | |
| const Scaling & | scaling () const |
| Returns the scaling from logical to physical pixels. | |
| Canvas * | getCanvas (Canvas *canvas) |
| Returns a canvas for backend drawing. | |
| void | sync () |
| Synchronizes pending operations to the surface. | |
| void | finish () |
| Finishes painting to the surface. | |
Static Public Member Functions | |
| static const std::string & | defaultFont () |
| Returns the default font family used by the backend. | |
| static void | setDefaultFont (const std::string &family) |
| Sets the default font family used by the backend. | |
| static std::vector< std::string > | fontFamilies () |
| Returns the available font families. | |
| static std::vector< FontFace > | fontFaces (const std::string &family) |
| Returns the font faces of a family. | |
Protected Member Functions | |
| virtual const Gfx::ImageFormat & | onGetFormat () const |
| Returns the image format. | |
| virtual const Gfx::SizeF & | onGetSize () const |
| Returns the size in physical pixel. | |
| virtual const Scaling & | onGetScaling () const |
| Returns the scaling fro logical to physical pixels. | |
| virtual Gfx::Canvas * | onCreateCanvas (Gfx::Canvas *reuse) override |
| Creates a Canvas. | |
| virtual void | onReleaseCanvas () override |
| Releases the current Canvas. | |
| virtual void | onSync () override |
| Synchronizes pending operations to the surface. | |
| virtual void | onFinish () override |
| Finishes painting to the surface. | |
| void | invalidate () |
| Invalidates the currently active paint canvas. | |
| virtual Gfx::Canvas * | onGetCanvas (Gfx::Canvas *reuse) |
| Returns a reusable canvas instance. | |
Bitmap is the in-memory PaintSurface. Construct it with a physical size, paint with a Painter, then read the pixels with image(). reset() replaces the buffer with a new size or with a copy of an existing Image. setScaleFactor() sets the logical-to-physical scaling used while drawing.
The bitmap owns its image. A painter on the bitmap does not own the bitmap. After finish(), the image remains valid until the bitmap is reset or destroyed.
defaultFont(), fontFamilies(), and fontFaces() query the backend font list. Font::addFont() registers files those queries can resolve.
| void reset | ( | const Gfx::Image & | image | ) |
The existing pixel buffer is reused when the image size already matches. Pixels are copied without drawing or blending.
| void reset | ( | const Gfx::SizeF & | , |
| std::size_t | stride = 0 ) |
The existing pixel buffer is reused when size and stride already match the current buffer.