62 if ((
x1 < 0 &&
x2 < 0) || (
x1 >= w_ &&
x2 >= w_)
63 || (
y1 < 0 &&
y2 < 0) || (
y1 >= h_ &&
y2 >= h_))
96 if (
y1 >= 0 &&
y1 < h_) {
97 int left = std::max(0, std::min(
x1,
x2));
98 int right = std::min(w_ - 1, std::max(
x1,
x2));
99 std::fill_n(lineBuffer(
y1) + left, right - left + 1,
color);
103 if (
x1 >= 0 &&
x1 < w_) {
104 int top = std::max(0, std::min(
y1,
y2));
105 int bottom = std::min(h_ - 1, std::max(
y1,
y2));
106 std::uint8_t*
bp = buf_ + top * pitch_ +
x1 *
sizeof(
C_);
107 for (
int j = top;
j <= bottom; ++
j,
bp += pitch_)
113 int lx = (dx + 1) / 2;
115 std::uint8_t*
bp = buf_ +
y1 * pitch_ +
x1 *
sizeof(
C_);
116 std::uint8_t*
bq = buf_ +
y2 * pitch_ +
x2 *
sizeof(
C_);
117 int spx = sx *
sizeof(
C_);
119 for (
int i = 0;
i <
lx;
i++) {
154 int ly = (dy + 1) / 2;
155 std::uint8_t*
bp = buf_ +
y1 * pitch_ +
x1 *
sizeof(
C_);
156 std::uint8_t*
bq = buf_ +
y2 * pitch_ +
x2 *
sizeof(
C_);
157 int spx = sx *
sizeof(
C_);
159 for (
int i = 0;
i <
ly;
i++) {
188 if (!(dy % 2) && xx1 >= 0 && xx1 < w_ && yy1 >= 0 && yy1 < h_)
189 *
reinterpret_cast<C_*
>(bp) = color;
201 int left,
int top,
int right,
int bottom,
const C_&
color,
bool fill)
205 std::swap(left, right);
207 std::swap(top, bottom);
214 int xx1 = std::max(left, 0);
215 int xx2 = std::min(right, w_ - 1);
216 int yy1 = std::max(top, 0);
217 int yy2 = std::min(bottom, h_ - 1);
220 std::uint8_t*
lp = buf_ + pitch_ *
yy1;
233 std::uint8_t*
lr = buf_ +
yy1 * pitch_;
240 reinterpret_cast<C_*
>(
lr)[right] =
color;
259 int x,
int y,
int a,
int b,
const C_&
color,
bool fill)
261 if (
a == 0 ||
b == 0)
306 int left = std::max(x -
dx1, 0);
307 int right = std::min(x +
dx1, w_ - 1);
310 std::fill_n(lineBuffer(y -
dy1) + left, right - left + 1,
color);
312 std::fill_n(lineBuffer(y +
dy1) + left, right - left + 1,
color);
335 int left = std::max(x -
dx2, 0);
336 int right = std::min(x +
dx2, w_ - 1);
339 std::fill_n(lineBuffer(y -
dy2) + left, right - left + 1,
color);
341 std::fill_n(lineBuffer(y +
dy2) + left, right - left + 1,
color);
363 e += (
p -
q) * 4 + 10;
畫像バッファ基底クラステンプレート
Definition imagebuffer.h:84
void paintFill(int x, int y, const C_ &color)
塗り潰し
Definition ibuf_draw.h:375
void clear(const C_ &color)
バッファ全體の塗り潰し
Definition ibuf_draw.h:45
int width() const noexcept
幅
Definition imagebuffer.h:114
ImageBuffer(int w, int h, int p) noexcept
構築子
Definition imagebuffer.h:101
int pitch() const noexcept
ピッチ
Definition imagebuffer.h:118
void line(int x1, int y1, int x2, int y2, const C_ &color)
線分の描畫
Definition ibuf_draw.h:60
uint8_t * buffer() noexcept
バッファの先頭アドレスの取得
Definition imagebuffer.h:121
void ellipse(int x, int y, int a, int b, const C_ &color, bool fill=false)
楕圓の描畫
Definition ibuf_draw.h:258
int height() const noexcept
高さ
Definition imagebuffer.h:116
void box(int left, int top, int right, int bottom, const C_ &color, bool fill=false)
長方形の描畫
Definition ibuf_draw.h:200
點
Definition imagebuffer.h:58