13template <
typename RawPixelStream>
29 width_skip_(width -
inner.width()),
32 : width ==
inner.width() &&
inner.xMin() == 0 &&
42 return color::Transparent;
44 if (count_ < width_) {
46 return delegate_->next();
48 if (remaining_lines_ == 0) {
49 return color::Transparent;
52 skip_ = width_skip_ - 1;
54 return color::Transparent;
69 std::unique_ptr<RawPixelStream> delegate_;
78template <
typename RawPixelStream>
79std::unique_ptr<SuperRectangleStream<RawPixelStream>>
Realign(
81 std::unique_ptr<RawPixelStream>
stream) {
82 return std::unique_ptr<SuperRectangleStream<RawPixelStream>>(
90template <
typename Bg,
typename Fg>
107 Color bg = bg_->next();
108 Color fg = fg_->next();
122 std::unique_ptr<Bg> bg_;
123 std::unique_ptr<Fg> fg_;
127template <
typename Bg,
typename Fg>
129 std::unique_ptr<Fg> fg) {
130 return std::unique_ptr<UnionStream<Bg, Fg>>(
136template <
typename Bg,
typename Fg>
150 extents_(
Box::Extent(bg_extents(), fg_extents())) {}
158 Realign(extents_, bg_extents(), bg_.createRawStream()),
159 Realign(extents_, fg_extents(), fg_.createRawStream()));
188 Box bg_extents()
const {
return bg_.extents().translate(bg_x_, bg_y_); }
190 Box fg_extents()
const {
return fg_.extents().translate(fg_x_, fg_y_); }
197template <
typename RawStreamable>
202 decltype(std::declval<const RawStreamable &>().createRawStream())
204 return ref_.createRawStream();
213template <
typename Bg,
typename Fg>
221template <
typename Bg,
typename Fg>
232template <
typename RawStreamable>
Combines horizontal and vertical alignment.
Axis-aligned integer rectangle.
Box translate(int16_t x_offset, int16_t y_offset) const
Return a translated copy of this box.
static Box Intersect(const Box &a, const Box &b)
Return the intersection of two boxes (may be empty).
ARGB8888 color stored as a 32-bit unsigned integer.
Filter functor that alpha-blends a fixed overlay color.
const Box extents() const
RawStreamableRef(const RawStreamable &ref)
decltype(std::declval< const RawStreamable & >().createRawStream()) createRawStream() const
void skip(uint32_t count)
SuperRectangleStream(std::unique_ptr< RawPixelStream > delegate, int16_t width, const Box &inner)
TransparencyMode transparency() const
SuperRectangleStream(SuperRectangleStream &&)=default
Superposition(Superposition &&)=default
const Box & extents() const
Superposition(Box anchor_extents, Bg bg, int16_t bg_x, int16_t bg_y, Fg fg, int16_t fg_x, int16_t fg_y)
auto createRawStream() const -> std::unique_ptr< internal::UnionStream< SuperRectangleStream< RawStreamTypeOf< Bg > >, SuperRectangleStream< RawStreamTypeOf< Fg > > > >
auto CreateClippedStream(const Box &clip_box) const -> std::unique_ptr< internal::UnionStream< SuperRectangleStream< ClipperedRawStreamTypeOf< Bg > >, SuperRectangleStream< ClipperedRawStreamTypeOf< Fg > > > >
const Box & anchorExtents() const
UnionStream(UnionStream &&)=default
TransparencyMode transparency() const
UnionStream(std::unique_ptr< Bg > bg, std::unique_ptr< Fg > fg)
void skip(uint32_t count)
std::unique_ptr< UnionStream< Bg, Fg > > MakeUnionStream(std::unique_ptr< Bg > bg, std::unique_ptr< Fg > fg)
std::unique_ptr< SuperRectangleStream< RawPixelStream > > Realign(const Box &outer_extents, const Box &inner_extents, std::unique_ptr< RawPixelStream > stream)
Defines 140 opaque HTML named colors.
Color AlphaBlend(Color bgc, Color fgc)
TransparencyMode
Transparency information for a stream or color mode.
@ kNone
All colors are fully opaque.
@ kCrude
Colors are either fully opaque or fully transparent.
@ kFull
Colors may include partial transparency (alpha channel).
typename decltype(std::declval< const RawStreamable >() .createRawStream())::element_type RawStreamTypeOf
internal::RawStreamableRef< RawStreamable > Ref(const RawStreamable &ref)