CImagePtr CSVGFeImage:: filterImage(CImagePtr src_image) { if (! src_image.isValid()) return CImagePtr(); CImagePtr dst_image = src_image->dup(); CSVGFilter *filter = NULL; CSVGObject *parent = parent_; while (parent != NULL) { filter = dynamic_cast<CSVGFilter *>(parent); if (filter != NULL) break; } if (filter) { CBBox2D bbox; filter->getObject()->getBBox(bbox); if (bbox.isSet()) dst_image->reshape(bbox.getWidth(), bbox.getHeight()); } return dst_image; }
void CQIllustratorCreateTextToolbar:: setSize(const CBBox2D &bbox) { double w = bbox.getWidth(); double h = bbox.getHeight(); widthEdit_ ->setValue(w); heightEdit_->setValue(h); }
void CQIllustratorShape:: setBBox(const CBBox2D &bbox) { checkoutShape(CQIllustratorData::ChangeType::GEOMETRY); moveTo(bbox.getLL()); resizeTo(bbox.getWidth(), bbox.getHeight()); checkinShape(CQIllustratorData::ChangeType::GEOMETRY); }
void CSVGBuffer:: pathText(const string &text, CFontPtr font, CHAlignType align) { renderer_->setFont(font); CBBox2D box; renderer_->textBounds(text, box); int dx; if (align == CHALIGN_TYPE_LEFT) dx = 0; else if (align == CHALIGN_TYPE_CENTER) dx = -box.getWidth()/2; else if (align == CHALIGN_TYPE_RIGHT) dx = -box.getWidth(); renderer_->pathRMoveTo(CPoint2D(dx, 0)); renderer_->pathText(text); }