Optibits
Loading...
Searching...
No Matches
include
Optibits
Bitmap.hpp
1
#pragma once
2
3
#include <Optibits/Buffer.hpp>
4
#include <Optibits/Color.hpp>
5
#include <Optibits/Utility.hpp>
6
#include <string>
7
#include <string_view>
8
9
namespace
Optibits
10
{
11
12
class
Bitmap
13
{
14
int
mWidth = 0, mHeight = 0;
15
Buffer
mPixels;
16
17
public
:
18
19
Bitmap
() =
default
;
20
21
Bitmap
(
int
width,
int
height,
Color
c = Color::NONE);
22
23
Bitmap
(
int
width,
int
height,
Optibits::Buffer
&& buffer);
24
25
int
width()
const
{
return
mWidth; };
26
int
height()
const
{
return
mHeight; };
27
28
void
resize(
int
width,
int
height,
Color
c = Color::NONE);
29
30
31
const
Color
* data()
const
{
return
reinterpret_cast<
const
Color
*
>
(mPixels.data()); }
32
Color
* data() {
return
reinterpret_cast<
Color
*
>
(mPixels.data()); }
33
34
const
Color
& pixel(
int
x,
int
y)
const
{
return
data()[y * mWidth + x]; }
35
Color
& pixel(
int
x,
int
y) {
return
data()[y * mWidth + x]; }
36
37
// https://en.wikipedia.org/wiki/Alpha_compositing
38
void
blendPixel(
int
x,
int
y,
Color
c);
39
40
void
insert(
const
Bitmap
& source,
int
x,
int
y,
Rect
sourceRect);
41
42
void
applyColorKey(
Color
key);
43
44
bool
operator==(
const
Bitmap
&)
const
;
45
46
};
47
48
49
Bitmap
applyBorderFlags(
unsigned
imageFlags,
const
Bitmap
& source,
Rect
sourceRect);
50
51
}
Optibits::Bitmap
Definition
Bitmap.hpp:13
Optibits::Buffer
Definition
Buffer.hpp:13
Optibits::Color
Definition
Color.hpp:11
Optibits::Rect
Definition
Utility.hpp:39
Generated by
1.12.0