sp-rect.cpp revision e7e412199b7b3b313320daeed49215402caeac72
830N/A#define __SP_RECT_C__
919N/A#ifdef HAVE_CONFIG_H
919N/A#include "document.h"
830N/A#include "attributes.h"
830N/A#include "sp-guide.h"
830N/A#include "prefs-utils.h"
830N/A#define noRECT_VERBOSE
830N/Astatic Inkscape::XML::Node *sp_rect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags);
830N/Asp_rect_get_type(void)
sizeof(SPRectClass),
sizeof(SPRect),
return type;
item_class->snappoints = sp_rect_snappoints; //override the default sp_shape_snappoints; see sp_rect_snappoints for details
switch (key) {
case SP_ATTR_X:
case SP_ATTR_Y:
case SP_ATTR_WIDTH:
case SP_ATTR_HEIGHT:
case SP_ATTR_RX:
case SP_ATTR_RY:
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
return repr;
static gchar *
* http://www.w3.org/TR/SVG11/shapes.html#RectElementRXAttribute once Inkscape has proper error
* handling (see http://www.w3.org/TR/SVG11/implnote.html#ErrorProcessing).
/* We don't use proper circular/elliptical arcs, but bezier curves can approximate a 90-degree
sp_curve_lineto(c, x + w, y + h);
sp_curve_unref(c);
return ret;
static gdouble
if (rx == 0) {
if (ry == 0) {
// This is needed because if we just set them the same length in SVG, they might end up unequal because of transform
/* This method overrides sp_shape_snappoints, which is the default for any shape. The default method
the startpoint and endpoint of each rounded corner is not very usefull and really confusing. Instead
we could snap either the real corners, or not snap at all. Bulia Byak opted to snap the real corners,
*p = NR::Point(rect->x.computed + rect->width.computed, rect->y.computed + rect->height.computed) * i2d;