blob: b40d3ae333a84628b1e6037405e061b25e08c648 [file] [log] [blame]
#pragma once
#include "../abi/pixel_formats.h"
#include "../abi/rect.h"
#include <cstddef>
namespace eskia {
// Blend n RGBA_8888 pixels from src over dst,
// returning the pointer just past the last dst touched.
using BlendFn = void*(void* dst, const RGBA_8888* src, int n);
BlendFn src_RGB_565, srcover_RGB_565,
src_BGR_565, srcover_BGR_565,
src_RGB_888, srcover_RGB_888,
src_RGBA_8888, srcover_RGBA_8888,
src_BGRA_8888, srcover_BGRA_8888;
struct Paint {
RGBA_8888 color;
};
// Shade a run of n destination pixels (x,y), (x+1,y) ...
// by calling blend(dst, ....).
using ShadeFn = void(const Paint&,
int x, int y, int n,
void* dst, BlendFn* blend);
// Shade a single color, Paint::color.
ShadeFn single_color;
struct Frame {
void* const dst;
const int width,
height,
bpp,
stride;
BlendFn* const src;
BlendFn* const srcover;
// Draws may not be flushed to dst until the frame ends.
~Frame();
void draw(const Rect&, const Paint&, ShadeFn*, BlendFn*);
};
}