42 std::unique_ptr<PixelStream>
createStream()
const override;
45 std::unique_ptr<PixelStream>
createStream(
const Box& bounds)
const override;
57template <
typename Getter>
61 : getter_(
getter), extents_(
extents), transparency_(transparency) {}
68 *
result++ = getter_(*x++, *y++);
82template <
typename Getter>
91template <
typename Getter>
103 transparency_(transparency),
105 y_offset_(y_offset) {}
121 return transparency_;
128 const int16_t x_offset_, y_offset_;
131template <
typename Getter>
139template <
typename Raster>
146template <
typename Raster>
Axis-aligned integer rectangle.
int16_t width() const
Width in pixels (inclusive coordinates).
int16_t xMin() const
Minimum x (inclusive).
static Box MaximumBox()
Return a large sentinel box used for unbounded extents.
int16_t height() const
Height in pixels (inclusive coordinates).
int16_t yMin() const
Minimum y (inclusive).
ARGB8888 color stored as a 32-bit unsigned integer.
Non-owning raster view over a pixel buffer.
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
Drawable that can provide a color for any point within its extents.
void readColorsMaybeOutOfBounds(const int16_t *x, const int16_t *y, uint32_t count, Color *result, Color out_of_bounds_color=color::Transparent) const
Read colors for points that may be out of bounds.
void drawTo(const Surface &s) const override
Default drawTo() using readColors().
std::unique_ptr< PixelStream > createStream() const override
Default createStream() using readColors().
virtual void readColors(const int16_t *x, const int16_t *y, uint32_t count, Color *result) const =0
Read colors for the given points.
virtual bool readColorRect(int16_t xMin, int16_t yMin, int16_t xMax, int16_t yMax, Color *result) const
Read colors for a rectangle.
Wrap a function object into a Rasterizable.
SimpleRasterizable(Box extents, Getter getter, TransparencyMode transparency)
void readColors(const int16_t *x, const int16_t *y, uint32_t count, Color *result) const override
Read colors for the given points.
TransparencyMode getTransparencyMode() const override
Return the transparency mode for pixels in this stream.
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
"Infinite" rasterizable background by tiling a finite raster.
TransparencyMode getTransparencyMode() const override
Return the transparency mode for pixels in this stream.
SimpleTiledRasterizable(const Box &extents, Getter getter, TransparencyMode transparency, int16_t x_offset, int16_t y_offset)
SimpleTiledRasterizable(const Box &extents, Getter getter, TransparencyMode transparency)
Box extents() const override
Return the bounding box encompassing all pixels that need to be drawn.
void readColors(const int16_t *x, const int16_t *y, uint32_t count, Color *result) const override
Read colors for the given points.
Drawable that can provide a sequential pixel stream.
Low-level handle used to draw to an underlying device.
Defines 140 opaque HTML named colors.
SimpleTiledRasterizable< const Raster & > MakeTiledRaster(const Raster *raster)
Create a tiled rasterizable from a raster.
SimpleTiledRasterizable< Getter > MakeTiledRasterizable(Box extents, Getter getter, TransparencyMode transparency=TransparencyMode::kFull)
Create a tiled rasterizable from a getter function.
TransparencyMode
Transparency information for a stream or color mode.
@ kFull
Colors may include partial transparency (alpha channel).
SimpleRasterizable< Getter > MakeRasterizable(Box extents, Getter getter, TransparencyMode transparency=TransparencyMode::kFull)
Create a SimpleRasterizable from a getter function.