20 if (val <= low)
return low;
21 if (val >= high)
return high;
31 if (x1<clip_rect.l || x0>clip_rect.r)
return false;
32 if (y1<clip_rect.t || y0>clip_rect.b)
return false;
34 if (completely_clipped())
return false;
45 if (completely_clipped())
return false;
78 for (
int c = 0; c<4; ++c) {
104 bool is_visible =
false;
107 const int MAX_POSS_POS = npos*2;
108 clippedPos =
new Position[MAX_POSS_POS];
110 for (
int i = 0; i<npos; ++i) {
112 if (j == npos) j = 0;
116 if (clip(v, vclipped)) {
119 clippedPos[nclippedPos++] = vclipped.
start();
120 clippedPos[nclippedPos++] = vclipped.
head();
124 clippedPos[nclippedPos++] = vclipped.
head();
128 if (need_extra_clip_position(clippedPos[nclippedPos-1], vclipped.
start(), extra)) {
129 clippedPos[nclippedPos++] = extra;
131 clippedPos[nclippedPos++] = vclipped.
start();
132 clippedPos[nclippedPos++] = vclipped.
head();
136 if (j == 0 && nclippedPos>0) {
138 if (need_extra_clip_position(clippedPos[nclippedPos-1], clippedPos[0], extra)) {
139 clippedPos[nclippedPos++] = extra;
156 bool is_visible =
false;
160 int outcode0 = compoutcode(x0, y0);
161 int outcode1 = compoutcode(x1, y1);
163 if ((outcode0 | outcode1) == 0) {
164 x0out = x0; y0out = y0;
165 x1out = x1; y1out = y1;
170 else if ((outcode0 & outcode1) != 0) {
174 outcodeout = outcode0>0 ? outcode0 : outcode1;
176 if ((outcodeout & 8) != 0) {
177 x = x0+(x1-x0)*(clip_rect.t-y0)/(y1-y0);
180 else if ((outcodeout & 4) != 0) {
181 x = x0+(x1-x0)*(clip_rect.b-y0)/(y1-y0);
184 else if ((outcodeout & 2) != 0) {
185 y = y0+(y1-y0)*(clip_rect.r-x0)/(x1-x0);
188 else if ((outcodeout & 1) != 0) {
189 y = y0+(y1-y0)*(clip_rect.l-x0)/(x1-x0);
212 if (drawflag) clippedLine =
LineVector(x0, y0, x1, y1);
216 clip_rect.b = bottom;
217 if (!allow_oversize) {
218 if (clip_rect.b > get_screen().b) clip_rect.b = get_screen().b;
221 set_bottom_font_overlap(
true);
227 if (!allow_oversize) {
228 if (clip_rect.l < get_screen().l) clip_rect.l = get_screen().l;
231 set_left_font_overlap(
true);
237 if (!allow_oversize) {
238 if (clip_rect.r > get_screen().r) clip_rect.r = get_screen().r;
241 set_right_font_overlap(
true);
247 if (!allow_oversize) {
248 if (clip_rect.t < get_screen().t) clip_rect.t = get_screen().t;
251 set_top_font_overlap(
true);
258 if (top > clip_rect.t) clip_rect.t = top;
259 if (bottom < clip_rect.b) clip_rect.b = bottom;
260 if (left > clip_rect.l) clip_rect.l = left;
261 if (right < clip_rect.r) clip_rect.r = right;
263 return !(clip_rect.b<clip_rect.t || clip_rect.r<clip_rect.l);
266 void AW_clipable::set_cliprect_oversize(
const AW_screen_area& rect,
bool allow_oversize) {
270 if (!allow_oversize) {
271 if (clip_rect.t < screen.
t) clip_rect.t = screen.
t;
272 if (clip_rect.b > screen.
b) clip_rect.b = screen.
b;
273 if (clip_rect.l < screen.
l) clip_rect.l = screen.
l;
274 if (clip_rect.r > screen.
r) clip_rect.r = screen.
r;
277 set_font_overlap(
false);
279 if (allow_oversize) {
280 if (clip_rect.t < screen.
t) set_top_font_overlap(
true);
281 if (clip_rect.b > screen.
b) set_bottom_font_overlap(
true);
282 if (clip_rect.l < screen.
l) set_left_font_overlap(
true);
283 if (clip_rect.r > screen.
r) set_right_font_overlap(
true);
288 if (top > clip_rect.t) clip_rect.t = top;
291 if (bottom < clip_rect.b) clip_rect.b = bottom;
294 if (left > clip_rect.l)clip_rect.l = left;
297 if (right < clip_rect.r) clip_rect.r = right;
301 clip_rect.b -= bottom;
302 if (!allow_oversize) {
303 if (clip_rect.b > get_screen().b) clip_rect.b = get_screen().b;
306 set_bottom_font_overlap(
true);
311 if (completely_clipped())
return false;
Position rect_corner(const Rectangle &rect, int n)
bool box_clip(AW_pos x0, AW_pos y0, AW_pos x1, AW_pos y1, AW_pos &x0out, AW_pos &y0out, AW_pos &x1out, AW_pos &y1out)
void reduce_bottom_clip_border(int bottom)
bool nearlyEqual(const double &val1, const double &val2)
void set_left_clip_border(int left, bool allow_oversize=false)
int reduceClipBorders(int top, int bottom, int left, int right)
void reduce_left_clip_border(int left)
void reduce_top_clip_border(int top)
void reduce_right_clip_border(int right)
AW_pos clip_in_range(AW_pos low, AW_pos val, AW_pos high)
void set_top_clip_border(int top, bool allow_oversize=false)
bool clip(AW_pos x0, AW_pos y0, AW_pos x1, AW_pos y1, AW_pos &x0out, AW_pos &y0out, AW_pos &x1out, AW_pos &y1out)
bool distinct_from(const Rectangle &rect) const
void sety(const double &Y)
const Position & start() const
const double & ypos() const
Rectangle intersect_with(const Rectangle &rect) const
void set_bottom_clip_border(int bottom, bool allow_oversize=false)
Position lower_left_corner() const
const Position & upper_left_corner() const
void set_bottom_clip_margin(int bottom, bool allow_oversize=false)
void setx(const double &X)
void set_right_clip_border(int right, bool allow_oversize=false)
Position upper_right_corner() const
const double & xpos() const
Position lower_right_corner() const
bool force_into_clipbox(const AW::Position &pos, AW::Position &forcedPos)