void ScrPainter::drawRectangle(const libwpg::WPGRect& rect, double rx, double ry) { int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX, baseY, rect.width() * 72.0, rect.height() * 72.0, LineW, CurrColorFill, CurrColorStroke, true); PageItem *ite = m_Doc->Items->at(z); if ((rx > 0) && (ry > 0)) { ite->setCornerRadius(qMax(72*rx, 72*ry)); ite->SetFrameRound(); m_Doc->setRedrawBounding(ite); } QTransform mm = QTransform(); mm.translate(72*rect.x1, 72*rect.y1); ite->PoLine.map(mm); ite->PoLine.translate(m_Doc->currentPage()->xOffset(), m_Doc->currentPage()->yOffset()); finishItem(ite); // qDebug() << "draw Rect"; }
PyObject *scribus_setcornerrad(PyObject* /* self */, PyObject* args) { char *Name = const_cast<char*>(""); int w; if (!PyArg_ParseTuple(args, "i|es", &w, "utf-8", &Name)) return NULL; if(!checkHaveDocument()) return NULL; if (w < 0) { PyErr_SetString(PyExc_ValueError, QObject::tr("Corner radius must be a positive number.","python error").toLocal8Bit().constData()); return NULL; } PageItem *currItem = GetUniqueItem(QString::fromUtf8(Name)); if (currItem == NULL) return NULL; // apply rounding currItem->setCornerRadius(w); currItem->SetFrameRound(); ScCore->primaryMainWindow()->doc->setRedrawBounding(currItem); ScCore->primaryMainWindow()->doc->setFrameRounded(); Py_RETURN_NONE; }