Lines Matching defs:rect
21 #include "sp-rect.h"
138 SPRect *rect = dynamic_cast<SPRect *>(item);
139 g_assert(rect != NULL);
141 return Geom::Point(rect->x.computed + rect->width.computed - rect->rx.computed, rect->y.computed);
147 SPRect *rect = dynamic_cast<SPRect *>(item);
148 g_assert(rect != NULL);
153 Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(-1, 0)), state);
156 gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
157 rect->rx = rect->ry = CLAMP(rect->x.computed + rect->width.computed - s[Geom::X], 0.0, temp);
159 rect->rx = CLAMP(rect->x.computed + rect->width.computed - s[Geom::X], 0.0, rect->width.computed / 2.0);
164 rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
170 SPRect *rect = dynamic_cast<SPRect *>(item);
171 g_assert(rect != NULL);
175 rect->getRepr()->setAttribute("rx", NULL);
176 rect->getRepr()->setAttribute("ry", NULL);
179 rect->getRepr()->setAttribute("ry", rect->getRepr()->attribute("rx"));
187 SPRect *rect = dynamic_cast<SPRect *>(item);
188 g_assert(rect != NULL);
190 return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->ry.computed);
196 SPRect *rect = dynamic_cast<SPRect *>(item);
197 g_assert(rect != NULL);
202 Geom::Point const s = snap_knot_position_constrained(p, Inkscape::Snapper::SnapConstraint(Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed), Geom::Point(0, 1)), state);
206 gdouble temp = MIN(rect->height.computed, rect->width.computed) / 2.0;
207 rect->rx = rect->ry = CLAMP(s[Geom::Y] - rect->y.computed, 0.0, temp);
209 if (!rect->rx._set || rect->rx.computed == 0) {
210 rect->ry = CLAMP(s[Geom::Y] - rect->y.computed,
212 MIN(rect->height.computed / 2.0, rect->width.computed / 2.0));
214 rect->ry = CLAMP(s[Geom::Y] - rect->y.computed,
216 rect->height.computed / 2.0);
222 rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
228 SPRect *rect = dynamic_cast<SPRect *>(item);
229 g_assert(rect != NULL);
233 rect->getRepr()->setAttribute("rx", NULL);
234 rect->getRepr()->setAttribute("ry", NULL);
237 rect->getRepr()->setAttribute("rx", rect->getRepr()->attribute("ry"));
243 static void sp_rect_clamp_radii(SPRect *rect)
246 if (2 * rect->rx.computed > rect->width.computed) {
247 rect->rx = 0.5 * rect->width.computed;
249 if (2 * rect->ry.computed > rect->height.computed) {
250 rect->ry = 0.5 * rect->height.computed;
257 SPRect *rect = dynamic_cast<SPRect *>(item);
258 g_assert(rect != NULL);
260 return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed);
266 SPRect *rect = dynamic_cast<SPRect *>(item);
267 g_assert(rect != NULL);
273 gdouble const w_orig = (origin[Geom::X] - rect->x.computed);
274 gdouble const h_orig = (origin[Geom::Y] - rect->y.computed);
283 Geom::Point p_handle(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed);
293 rect->height = MAX(h_orig + minx / ratio, 0);
300 rect->height = MAX(h_orig, 0);
302 rect->width = MAX(w_orig + minx, 0);
312 rect->width = MAX(w_orig + miny * ratio, 0);
319 rect->width = MAX(w_orig, 0);
321 rect->height = MAX(h_orig + miny, 0);
328 rect->width = MAX(s[Geom::X] - rect->x.computed, 0);
329 rect->height = MAX(s[Geom::Y] - rect->y.computed, 0);
332 sp_rect_clamp_radii(rect);
334 rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
347 SPRect *rect = dynamic_cast<SPRect *>(item);
348 g_assert(rect != NULL);
350 return Geom::Point(rect->x.computed, rect->y.computed);
356 SPRect *rect = dynamic_cast<SPRect *>(item);
357 g_assert(rect != NULL);
360 gdouble opposite_x = (rect->x.computed + rect->width.computed);
361 gdouble opposite_y = (rect->y.computed + rect->height.computed);
368 Geom::Point p_handle(rect->x.computed, rect->y.computed);
386 rect->y = MIN(origin[Geom::Y] + minx / ratio, opposite_y);
387 rect->height = MAX(h_orig - minx / ratio, 0);
394 rect->y = MIN(origin[Geom::Y], opposite_y);
395 rect->height = MAX(h_orig, 0);
397 rect->x = MIN(s[Geom::X], opposite_x);
398 rect->width = MAX(w_orig - minx, 0);
407 rect->x = MIN(origin[Geom::X] + miny * ratio, opposite_x);
408 rect->width = MAX(w_orig - miny * ratio, 0);
415 rect->x = MIN(origin[Geom::X], opposite_x);
416 rect->width = MAX(w_orig, 0);
418 rect->y = MIN(s[Geom::Y], opposite_y);
419 rect->height = MAX(h_orig - miny, 0);
428 rect->x = MIN(s[Geom::X], opposite_x);
429 rect->y = MIN(s[Geom::Y], opposite_y);
430 rect->width = MAX(w_orig - minx, 0);
431 rect->height = MAX(h_orig - miny, 0);
434 sp_rect_clamp_radii(rect);
438 rect->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
1416 SPRect const *rect = dynamic_cast<SPRect const *>(item);
1417 g_assert(rect != NULL);
1419 return Geom::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed);