0
@@ -609,6 +609,19 @@ shoes_shape_attr(int argc, VALUE *argv, int syms, ...)
0
+shoes_shape_check(cairo_t *cr, shoes_place *place)
0
+ double ox1 = place->ix, oy1 = place->iy, ox2 = place->ix + place->iw, oy2 = place->iy + place->ih;
0
+ double cx1, cy1, cx2, cy2;
0
+ cairo_clip_extents(cr, &cx1, &cy1, &cx2, &cy2);
0
+ cairo_user_to_device(cr, &ox1, &oy1);
0
+ cairo_user_to_device(cr, &ox2, &oy2);
0
+ if ((ox1 < cx1 && ox2 < cx1) || (oy1 < cy1 && oy2 < cy1) ||
0
+ (ox1 > cx2 && ox2 > cx2) || (oy1 > cy2 && oy2 > cy2)) return 0;
0
shoes_shape_sketch(cairo_t *cr, ID name, shoes_place *place, shoes_transform *st, VALUE attr)
0
@@ -616,6 +629,8 @@ shoes_shape_sketch(cairo_t *cr, ID name, shoes_place *place, shoes_transform *st
0
double sw = ATTR2(dbl, attr, strokewidth, 1.);
0
shoes_apply_transformation(cr, st, place, RTEST(ATTR(attr, center)), 1);
0
+ if (!shoes_shape_check(cr, place))
0
+ return shoes_undo_transformation(cr, st, place, 1);
0
cairo_translate(cr, (place->x * 1.) + (place->w / 2.), (place->y * 1.) + (place->h / 2.));
0
cairo_scale(cr, place->w / 2., place->h / 2.);
0
@@ -632,6 +647,8 @@ shoes_shape_sketch(cairo_t *cr, ID name, shoes_place *place, shoes_transform *st
0
cv = ATTR2(dbl, attr, curve, 0.);
0
shoes_apply_transformation(cr, st, place, RTEST(ATTR(attr, center)), 0);
0
+ if (!shoes_shape_check(cr, place))
0
+ return shoes_undo_transformation(cr, st, place, 0);
0
shoes_cairo_rect(cr, SWPOS(place->x), SWPOS(place->y), place->w * 1., place->h * 1., cv);
0
shoes_undo_transformation(cr, st, place, 0);
0
PATH_OUT(cr, attr, *place, sw, fill, cairo_fill_preserve);
0
@@ -643,6 +660,8 @@ shoes_shape_sketch(cairo_t *cr, ID name, shoes_place *place, shoes_transform *st
0
sw = ATTR2(dbl, attr, strokewidth, 1.);
0
shoes_apply_transformation(cr, st, place, RTEST(ATTR(attr, center)), 0);
0
+ if (!shoes_shape_check(cr, place))
0
+ return shoes_undo_transformation(cr, st, place, 0);
0
cairo_move_to(cr, SWPOS(place->ix), SWPOS(place->iy));
0
cairo_line_to(cr, SWPOS(place->ix + place->iw), SWPOS(place->iy + place->ih));
0
shoes_undo_transformation(cr, st, place, 0);
0
@@ -657,6 +676,8 @@ shoes_shape_sketch(cairo_t *cr, ID name, shoes_place *place, shoes_transform *st
0
sw = ATTR2(dbl, attr, strokewidth, 1.);
0
shoes_apply_transformation(cr, st, place, RTEST(ATTR(attr, center)), 0);
0
+ if (!shoes_shape_check(cr, place))
0
+ return shoes_undo_transformation(cr, st, place, 0);
0
cairo_move_to(cr, SWPOS(x), SWPOS(place->y));
0
cairo_rel_line_to(cr, -tip, +(h*0.5));
0
cairo_rel_line_to(cr, 0, -(h*0.25));
0
@@ -682,6 +703,8 @@ shoes_shape_sketch(cairo_t *cr, ID name, shoes_place *place, shoes_transform *st
0
place->w = place->h = outer;
0
shoes_apply_transformation(cr, st, place, RTEST(ATTR(attr, center)), 0);
0
+ if (!shoes_shape_check(cr, place))
0
+ return shoes_undo_transformation(cr, st, place, 0);
0
cairo_move_to(cr, place->x * 1., (place->y * 1.) + outer);
0
for (i = 1; i <= points * 2; i++) {
0
angle = (i * SHOES_PI) / (points * 1.);
Comments
No one has commented yet.