class Core::Portable::Bitmap
Overview
#include <corebitmap.h> class Bitmap { public: // enums enum Options; // fields frameCount; // construction Bitmap(); Bitmap(const BitmapData& data); Bitmap( int width, int height, BitmapPixelFormat format = kBitmapRGBAlpha, int options = 0 ); Bitmap(const uint8* bitmapFileData, uint32 bitmapFileLength); // methods void construct( int width, int height, BitmapPixelFormat format, int options, const uint8* externalBuffer = nullptr, uint32 externalBufferSize = 0 ); PROPERTY_BOOL(alphaChannelUsed, AlphaChannelUsed); FrameCount int getWidth() const; int getHeight() const; Rect& getSize(Rect& size) const; Rect getSize() const; Rect& getFrame(Rect& frameRect, int frameIndex = 0) const; BitmapPixelFormat getFormat() const; BitmapData& accessForWrite(); const BitmapData& accessForRead() const; bool copyFrom(const Bitmap& bitmap); bool copyFrom(const Bitmap& bitmap, RectRef rect); void* getBufferAddress(); const void* getBufferAddress() const; uint32 getBufferSize() const; void use(); void unuse(); bool isReferenced() const; static Bitmap* loadPNGImage( IO::Stream& stream, BitmapPixelFormat requestedFormat = kBitmapAny, bool explicitFormat = true ); static Bitmap* loadBMPImage(IO::Stream& stream); static bool saveBMPImage(IO::Stream& stream, const Bitmap& bitmap); static uint32 getTotalBitmapMemory(); }; // direct descendants class OptimizedBitmap;
Detailed Documentation
Construction
Bitmap()
[LIGHT] Default constructor, no allocation.
Bitmap(const BitmapData& data)
[LIGHT] Wrap bitmap data, no allocation.
Bitmap( int width, int height, BitmapPixelFormat format = kBitmapRGBAlpha, int options = 0 )
[HEAVY] Allocates bitmap on heap.
Bitmap(const uint8* bitmapFileData, uint32 bitmapFileLength)
[LIGHT] Does not allocate or copy any data, works for BMP format only.