37 Clip_(
int ssx,
int ssy,
int ww,
int hh,
int ddx,
int ddy,
const Rect& mask);
38 operator bool()
const {
return flag_; }
59 Rect rect(0, 0, w_ - 1, h_ - 1);
60 blt(dx, dy, src, sx, sy, w, h, rect);
74 int dp = clip.
dx + clip.
dy * offset_;
76 for (
int i=0; i<clip.
h; i++, dp+=offset_, sp+=src->
offset_)
77 std::memcpy(&(buf_[dp]), &(src->
buf_[sp]), clip.
w *
sizeof(C_));
87 int w,
int h,
const C_& tcol)
89 Rect rect(0, 0, w_ - 1, h_ - 1);
90 blt(dx, dy, src, sx, sy, w, h, tcol, rect);
104 int dp = clip.
dx + clip.
dy * offset_;
106 for (
int i = 0; i < clip.
h; i++, dp += offset_, sp += src->
offset_)
107 for (
int j = 0; j < clip.
w; j++)
109 if (src->
buf_[sp + j] != tcol)
110 buf_[dp + j] = src->
buf_[sp + j];
117 template<
class C_>
template<
class C2_>
122 int sx,
int sy,
int w,
int h)
124 Rect rect(0, 0, w_ - 1, h_ - 1);
125 blt(dx, dy, src, sx, sy, w, h, rect);
128 template<
class C_>
template<
class C2_>
139 const C2_* b = src->
buffer();
140 int dp = clip.
dx + clip.
dy * offset_;
142 for (
int j=0; j<clip.
h; j++, dp+=offset_, sp+=src->
offset())
143 for (
int i=0; i<clip.
w; i++)
144 buf_[dp + i] = b[sp + i];
149 template<
class C_>
template<
class C2_>
154 int w,
int h,
const C2_& tcol)
156 Rect rect(0, 0, w_ - 1, h_ - 1);
157 blt(dx, dy, src, sx, sy, w, h, tcol, rect);
160 template<
class C_>
template<
class C2_>
171 const C2_* b = src->
buffer();
172 int dp = clip.
dx + clip.
dy * offset_;
174 for (
int j = 0; j < clip.
h; j++, dp += offset_, sp += src->
offset())
175 for (
int i = 0; i < clip.
w; i++)
176 if (b[sp + i] != tcol)
177 buf_[dp + i] = b[sp + i];
190 for (
int j = 0; j < h_; j++, dp += offset_)
191 for (
int i = 0; i < w_; i++)
259 int lx = (dx + 1) / 2;
261 p = x1 + y1 * offset_;
262 q = x2 + y2 * offset_;
264 for (i = 0; i < lx; i++)
266 if (xx1 >= 0 && xx1 < w_ && yy1 >= 0 && yy1 < h_)
268 if (xx2 >= 0 && xx2 < w_ && yy2 >= 0 && yy2 < h_)
297 if (!(dx % 2) && xx1 >= 0 && xx1 < w_ && yy1 >= 0 && yy1 < h_)
303 int ly = (dy + 1) / 2;
304 p = x1 + y1 * offset_;
305 q = x2 + y2 * offset_;
307 for (i = 0; i < ly; i++)
309 if (xx1 >= 0 && xx1 < w_ && yy1 >= 0 && yy1 < h_)
311 if (xx2 >= 0 && xx2 < w_ && yy2 >= 0 && yy2 < h_)
340 if (!(dy % 2) && xx1 >= 0 && xx1 < w_ && yy1 >= 0 && yy1 < h_)
354 int x1,
int y1,
int x2,
int y2,
const C_& col,
bool fl)
363 if (x1>=w_ || x2<0 || y1>=h_ || y2<0)
367 int xx1, xx2, yy1, yy2;
392 int p = yy1 * offset_;
394 for (i=yy1; i<=yy2; i++, p+=offset_)
395 for (j=xx1; j<=xx2; j++)
403 p = xx1 + y1*offset_;
404 q = xx1 + y2*offset_;
408 for (i=xx1; i<=xx2; i++,p++,q++)
409 buf_[p] = buf_[q] = col;
411 for (i=xx1; i<=xx2; i++,p++)
417 for (i=xx1; i<=xx2; i++,q++)
422 p = x1 + yy1*offset_;
423 q = x2 + yy1*offset_;
427 for (i=yy1; i<=yy2; i++, p+=offset_, q+=offset_)
428 buf_[p] = buf_[q] = col;
430 for (i=yy1; i<=yy2; i++,p+=offset_)
436 for (i=yy1; i<=yy2; i++,q+=offset_)
456 int x,
int y,
int a,
int b,
const C_& col,
bool fl)
485 e += ((p - q) << 2) + 10;
510 if (x - s < w_ && x + s >= 0 && y - t < h_ && y + t >= 0)
514 int i = (x - s < 0) ? 0 : x-s;
515 int j = (x + s + 1 >= w_) ? w_-1 : x + s + 1;
518 int ytp = (y + t) * offset_;
522 int ytm = (y - t) * offset_;
524 buf_[i + ytp] = buf_[i + ytm] = col;
536 int ytm = (y - t) * offset_;
544 bool xs1 = (x - s) >= 0;
545 bool xs2 = (x + s) < w_;
549 ytp = (y + t) * offset_;
551 buf_[x - s + ytp] = col;
553 buf_[x + s + ytp] = col;
557 ytm = (y - t) * offset_;
559 buf_[x - s + ytm] = col;
561 buf_[x + s + ytm] = col;
567 if (x - s2 < w_ && x + s2 >= 0 && y - t2 < h_ && y + t2 >= 0)
571 int i = (x - s2 < 0) ? 0 : x - s2;
572 int j = (x + s2 + 1 >= w_) ? w_ - 1 : x + s2 + 1;
575 int ytp = (y + t2) * offset_;
579 int ytm = (y - t2) * offset_;
581 buf_[i + ytp] = buf_[i + ytm] = col;
593 int ytm = (y - t2) * offset_;
601 bool xs1 = (x - s2) >= 0;
602 bool xs2 = (x + s2) < w_;
606 ytp = (y + t2) * offset_;
608 buf_[x - s2 + ytp] = col;
610 buf_[x + s2 + ytp] = col;
614 ytm = (y - t2) * offset_;
616 buf_[x - s2 + ytm] = col;
618 buf_[x + s2 + ytm] = col;
634 if (x < 0 || y < 0 || x >= w_ || y >= h_)
637 std::stack<int> p_stc;
638 unsigned pos = x + y*offset_;
641 C_ p_col = buf_[pos];
645 while (!p_stc.empty())
647 int pt = p_stc.top();
650 int xx = pt % offset_;
651 int yy = pt / offset_;
654 if (yy > 0 && buf_[pt-offset_]==p_col)
656 p_stc.push(pt-offset_);
663 if (yy < h_ - 1 && buf_[pt+offset_]==p_col)
665 p_stc.push(pt+offset_);
679 while (l >= 0 && buf_[L]==p_col)
683 if (ful && buf_[L-offset_] != p_col)
685 else if (!ful && buf_[L-offset_] == p_col)
688 p_stc.push(L-offset_);
692 if (L+offset_ < h_*offset_)
694 if (fdl && buf_[L+offset_] != p_col)
696 else if (!fdl && buf_[L+offset_] == p_col)
699 p_stc.push(L+offset_);
708 while (r < w_ && buf_[R]==p_col)
714 else if (buf_[R-offset_]==p_col)
717 p_stc.push(R - offset_);
721 if (R+offset_ < h_*offset_)
723 if (fdr && buf_[R+offset_] != p_col)
725 else if (!fdr && buf_[R+offset_] == p_col)
728 p_stc.push(R + offset_);
Definition: ibuf-imp_.h:26
int dy
Definition: ibuf-imp_.h:31
int offset_
オフセット 水平方向の1ラインのバッファサイズ
Definition: ibuf.h:106
int h
Definition: ibuf-imp_.h:30
void blt(int dx, int dy, const polymnia::ImageBuffer< C_ > *src, int sx, int sy, int w, int h)
轉送
Definition: ibuf-imp_.h:55
void paintFill(int x, int y, const C_ &col)
塗り潰し
Definition: ibuf-imp_.h:632
Clip_(int ssx, int ssy, int ww, int hh, int ddx, int ddy, const Rect &mask)
Definition: ibuf.cpp:14
int w
Definition: ibuf-imp_.h:30
void line(int x1, int y1, int x2, int y2, const C_ &col)
直線を描畫
Definition: ibuf-imp_.h:222
int sx
Definition: ibuf-imp_.h:29
int dx
Definition: ibuf-imp_.h:31
void ellipse(int x, int y, int a, int b, const C_ &col, bool fl=false)
楕圓を描畫
Definition: ibuf-imp_.h:455
長方形を表す構造體
Definition: ibuf.h:41
int sy
Definition: ibuf-imp_.h:29
C_ * buffer() noexcept
バッファの先頭アドレスを取得
Definition: ibuf.h:126
void box(int x1, int y1, int x2, int y2, const C_ &col, bool fl=false)
長方形を描畫
Definition: ibuf-imp_.h:353
void clear(const C_ &col)
バッファ全體の塗り潰し
Definition: ibuf-imp_.h:187
int offset() const noexcept
オフセットを取得
Definition: ibuf.h:123
C_ * buf_
畫像バッファ
Definition: ibuf.h:103
畫像バッファ基底クラステンプレート
Definition: ibuf.h:23