2018-10-12 12:49:45 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "Size.h"
|
2019-06-21 18:45:35 +02:00
|
|
|
#include <AK/RefPtr.h>
|
2019-06-21 18:58:45 +02:00
|
|
|
#include <AK/RefCounted.h>
|
2018-10-12 12:49:45 +02:00
|
|
|
|
2019-06-21 15:29:31 +02:00
|
|
|
class CharacterBitmap : public RefCounted<CharacterBitmap> {
|
2018-10-12 12:49:45 +02:00
|
|
|
public:
|
2019-06-21 18:37:47 +02:00
|
|
|
static NonnullRefPtr<CharacterBitmap> create_from_ascii(const char* asciiData, unsigned width, unsigned height);
|
2019-01-10 05:41:49 +01:00
|
|
|
~CharacterBitmap();
|
2018-10-12 12:49:45 +02:00
|
|
|
|
2019-02-02 08:05:14 +01:00
|
|
|
bool bit_at(unsigned x, unsigned y) const { return m_bits[y * width() + x] == '#'; }
|
2018-10-12 12:49:45 +02:00
|
|
|
const char* bits() const { return m_bits; }
|
|
|
|
|
|
|
|
|
|
Size size() const { return m_size; }
|
|
|
|
|
unsigned width() const { return m_size.width(); }
|
|
|
|
|
unsigned height() const { return m_size.height(); }
|
|
|
|
|
|
|
|
|
|
private:
|
2019-01-10 05:41:49 +01:00
|
|
|
CharacterBitmap(const char* b, unsigned w, unsigned h);
|
2018-10-12 12:49:45 +02:00
|
|
|
|
|
|
|
|
const char* m_bits { nullptr };
|
|
|
|
|
Size m_size;
|
|
|
|
|
};
|