15 clip_box_(
Box::MaximumBox()) {}
26 clip_box_(std::
move(clip_box)) {}
31 return Transformation(!xy_swap_, y_scale_, x_scale_, y_offset_, x_offset_,
32 clipped_, clip_box_.
swapXY());
36 return Transformation(xy_swap_, -x_scale_, y_scale_, -x_offset_, y_offset_,
37 clipped_, clip_box_.
flipX());
41 return Transformation(xy_swap_, x_scale_, -y_scale_, x_offset_, -y_offset_,
42 clipped_, clip_box_.
flipY());
60 xy_swap_, x_scale_, y_scale_, x_offset_, y_offset_,
true,
65 return Transformation(xy_swap_, -x_scale_, -y_scale_, -x_offset_, -y_offset_,
70 return Transformation(!xy_swap_, -y_scale_, x_scale_, -y_offset_, x_offset_,
75 return Transformation(!xy_swap_, y_scale_, -x_scale_, y_offset_, -x_offset_,
109 x0 = x0 * x_scale_ + x_offset_;
110 y0 = y0 * y_scale_ + y_offset_;
111 x1 = (x1 + 1) * x_scale_ + x_offset_;
112 y1 = (y1 + 1) * y_scale_ + y_offset_;
137 return Box(x0, y0, x1, y1);
144 return r ? (
d - ((a < 0) ^ (b < 0))) :
d;
166 return Box(x0, y0, x1, y1);
180 addr_window_ =
Box(x0, y0, x1, y1);
181 blending_mode_ = mode;
195 if (transformation_.
xy_swap()) {
201 if (x_cursor_ < addr_window_.
xMax()) {
204 x_cursor_ = addr_window_.
xMin();
213 if (transformation_.
xy_swap()) {
220 if (x_cursor_ < addr_window_.
xMax()) {
223 x_cursor_ = addr_window_.
xMin();
239 if (transformation_.
xy_swap()) {
245 if (x_cursor_ < addr_window_.
xMax()) {
248 x_cursor_ = addr_window_.
xMin();
258 if (transformation_.
xy_swap()) {
264 filler.fillRect(x0, y0, x1, y1);
265 if (x_cursor_ < addr_window_.
xMax()) {
268 x_cursor_ = addr_window_.
xMin();
278 if (transformation_.
xy_swap()) {
319 if (transformation_.
xy_swap()) {
350 filler.fillRect(x0, y0, x1, y1);
359 if (transformation_.
xy_swap()) {
363 while (count-- > 0) {
369 writer.writeRect(xMin, yMin, xMax, yMax, *
color++);
377 if (transformation_.
xy_swap()) {
381 while (count-- > 0) {
387 filler.fillRect(xMin, yMin, xMax, yMax);
BufferedRectWriter & writer
Axis-aligned integer rectangle.
Box rotateRight() const
Return a copy rotated 90 degrees clockwise around the origin.
Box rotateUpsideDown() const
Return a copy rotated 180 degrees around the origin.
int16_t xMin() const
Minimum x (inclusive).
int16_t xMax() const
Maximum x (inclusive).
static Box MaximumBox()
Return a large sentinel box used for unbounded extents.
Box scale(int16_t x_scale, int16_t y_scale) const
Return a scaled copy of this box.
Box translate(int16_t x_offset, int16_t y_offset) const
Return a translated copy of this box.
Box flipX() const
Return a copy mirrored across the Y-axis.
Box swapXY() const
Return a copy with x and y axes swapped.
Box rotateLeft() const
Return a copy rotated 90 degrees counter-clockwise around the origin.
static Box Intersect(const Box &a, const Box &b)
Return the intersection of two boxes (may be empty).
Box flipY() const
Return a copy mirrored across the X-axis.
Buffered pixel filler with a clipping box.
Buffered pixel writer with a clipping box.
ARGB8888 color stored as a 32-bit unsigned integer.
virtual void write(Color *color, uint32_t pixel_count)=0
Write pixels into the current address window.
virtual void fill(Color color, uint32_t pixel_count)
Write pixel_count copies of the same color into the current address window.
virtual void fillPixels(BlendingMode blending_mode, Color color, int16_t *x, int16_t *y, uint16_t pixel_count)=0
Draw the specified pixels using the same color. Invalidates the address window.
virtual void writePixels(BlendingMode blending_mode, Color *color, int16_t *x, int16_t *y, uint16_t pixel_count)=0
Draw the specified pixels (per-pixel colors). Invalidates the address window.
void setAddress(const Box &bounds, BlendingMode blending_mode)
Convenience overload for setAddress() using a Box.
Defines 140 opaque HTML named colors.
BlendingMode
Porter-Duff style blending modes.
int floor_div(int a, int b)