16#ifndef vtkAnariOverlayCanvas_h
17#define vtkAnariOverlayCanvas_h
30VTK_ABI_NAMESPACE_BEGIN
49 return { std::max(this->X0, o.
X0), std::max(this->Y0, o.
Y0), std::min(this->X1, o.
X1),
50 std::min(this->Y1, o.
Y1) };
58 constexpr double limit = double(1 << 24);
59 return vtkMath::IsNan(v) ? 0 :
static_cast<int>(std::clamp(
double(v), -limit, limit));
97 return this->Image.Data && this->Image.Width > 0 && this->Image.Height > 0;
114 const std::uint8_t* coverage,
int w,
int h,
int left,
int top,
const RGBAColor& c);
121 std::uint8_t* Pixel(
int x,
int y)
const
123 const int ix = x - this->Image.Tile.OffsetX;
124 const int iy = y - this->Image.Tile.OffsetY;
125 return this->Image.Data + (std::size_t(iy) * std::size_t(this->Image.Width) + ix) * 4;
139 : Provider(context.Glyphs)
140 , DPIScale(context.DPIScale > 0.f ? context.DPIScale : 1.f)
void SetClip(const PixelRect &r)
void Blend(int x, int y, const RGBAColor &c, float coverage)
void BlitCoverage(const std::uint8_t *coverage, int w, int h, int left, int top, const RGBAColor &c)
Canvas(const ImageView &image)
int GetFullHeight() const
void DrawText(const GlyphRun &run, float x, float y, const TextStyle &style)
TextRenderer(const DrawContext &context)
GlyphRun Layout(std::string_view text, const TextStyle &style) const
GlyphRun LayoutAtSize(std::string_view text, const TextStyle &style, float pixelSize) const
float GetDPIScale() const
static vtkTypeBool IsNan(double x)
Test if a number is equal to the special floating point value Not-A-Number (Nan).
Computes the portion of a dataset which is inside a selection.
PixelRect PixelBounds(float x0, float y0, float x1, float y1)
std::function< GlyphRun(std::string_view text, const TextStyle &style, float pixelSize)> GlyphProvider
Rasterizes text into a coverage bitmap.
An 8-bit coverage bitmap for a run of text, trimmed to its drawn pixels, row 0 at the TOP.
A tightly packed RGBA8 image.
An axis-aligned pixel rectangle covering [X0, X1) x [Y0, Y1).
PixelRect Intersect(const PixelRect &o) const
Returns the overlap of this rectangle and o.
CPU overlay drawing types for the pure-ANARI render window.