2019-01-09 01:06:04 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-01-10 04:36:32 +00:00
|
|
|
#include "Color.h"
|
2019-01-09 01:06:04 +00:00
|
|
|
#include "Size.h"
|
|
|
|
#include <AK/Retainable.h>
|
|
|
|
#include <AK/RetainPtr.h>
|
|
|
|
|
|
|
|
class GraphicsBitmap : public Retainable<GraphicsBitmap> {
|
|
|
|
public:
|
|
|
|
static RetainPtr<GraphicsBitmap> create(const Size&);
|
2019-01-10 04:36:32 +00:00
|
|
|
static RetainPtr<GraphicsBitmap> create_wrapper(const Size&, RGBA32*);
|
2019-01-09 01:06:04 +00:00
|
|
|
~GraphicsBitmap();
|
|
|
|
|
2019-01-10 04:36:32 +00:00
|
|
|
RGBA32* scanline(int y);
|
2019-01-12 05:39:34 +00:00
|
|
|
const RGBA32* scanline(int y) const;
|
2019-01-09 01:06:04 +00:00
|
|
|
|
|
|
|
Size size() const { return m_size; }
|
|
|
|
int width() const { return m_size.width(); }
|
|
|
|
int height() const { return m_size.height(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit GraphicsBitmap(const Size&);
|
2019-01-10 04:36:32 +00:00
|
|
|
GraphicsBitmap(const Size&, RGBA32*);
|
2019-01-09 01:06:04 +00:00
|
|
|
|
|
|
|
Size m_size;
|
2019-01-10 04:36:32 +00:00
|
|
|
RGBA32* m_data { nullptr };
|
2019-01-12 20:29:05 +00:00
|
|
|
size_t m_pitch { 0 };
|
2019-01-09 02:51:34 +00:00
|
|
|
bool m_owned { false };
|
2019-01-09 01:06:04 +00:00
|
|
|
};
|