31 lines
603 B
C
31 lines
603 B
C
|
#pragma once
|
||
|
#include <luna/Result.h>
|
||
|
#include <luna/Types.h>
|
||
|
#include <ui/Color.h>
|
||
|
#include <ui/Point.h>
|
||
|
#include <ui/Rect.h>
|
||
|
|
||
|
namespace ui
|
||
|
{
|
||
|
/**
|
||
|
* @brief A drawable surface.
|
||
|
*/
|
||
|
struct Canvas
|
||
|
{
|
||
|
int width;
|
||
|
int height;
|
||
|
int stride;
|
||
|
u8* ptr;
|
||
|
|
||
|
static Canvas create(u8* ptr, int width, int height);
|
||
|
Result<Canvas> subcanvas(Point begin, int width, int height, bool clamp);
|
||
|
|
||
|
Rect rect()
|
||
|
{
|
||
|
return Rect { .begin = { 0, 0 }, .width = width, .height = height };
|
||
|
}
|
||
|
|
||
|
void fill(Color color);
|
||
|
};
|
||
|
};
|