14 qInfo() <<
"Enter image";
20 boost::optional<double>
const &
width()
const {
return width_; }
22 boost::optional<double>
const &
height()
const {
return height_; }
27 void set(tag::attribute::xlink::href, tag::iri_fragment,
28 IRI
const &fragment) {
29 qInfo() <<
"xlink::href" << fragment;
33 auto str = std::string(fragment.begin(), fragment.end());
34 auto substr = std::string(fragment.begin() + 22, fragment.end());
35 qInfo() <<
"xlink::href (from string)" << substr.size();
36 QImage img = QImage::fromData(QByteArray::fromBase64(QString::fromStdString(substr).toUtf8()));
37 qInfo() <<
"image size" << img.size();
38 bitmap_ = make_shared<BitmapShape>(img);
41 void set(tag::attribute::x,
double val) { x_ = val; }
43 void set(tag::attribute::y,
double val) { y_ = val; }
45 void set(tag::attribute::width,
double val) { width_ = val; }
47 void set(tag::attribute::height,
double val) { height_ = val; }
50 QString bitmap_layer_name(
"Bitmap");
52 if (width_ == 0) width_ = new_shape->
pixmap()->width();
53 if (height_ == 0) height_ = new_shape->
pixmap()->height();
55 qtransform() * QTransform().translate(x_, y_).scale(
56 width_ / new_shape->
pixmap()->width(),
57 height_ / new_shape->
pixmap()->height())
68 std::string fragment_id_;
70 double width_, height_;
71 shared_ptr<Shape> bitmap_;
Definition: bitmap-shape.h:7
const QPixmap * pixmap() const
Definition: bitmap-shape.cpp:94
Definition: base-context.h:10
void set(tag::attribute::width, double val)
Definition: object-context.h:9
Definition: image-context.h:11
void on_exit_element()
Definition: image-context.h:49
string type()
Definition: image-context.h:63
void set(tag::attribute::width, double val)
Definition: image-context.h:45
ImageContext(BaseContext const &parent)
Definition: image-context.h:13
void set(tag::attribute::xlink::href, RangedChar fragment)
Definition: image-context.h:32
void set(tag::attribute::x, double val)
Definition: image-context.h:41
void set(tag::attribute::height, double val)
Definition: image-context.h:47
boost::optional< double > const & height() const
Definition: image-context.h:22
void set(tag::attribute::xlink::href, tag::iri_fragment, IRI const &fragment)
Definition: image-context.h:27
void set(tag::attribute::y, double val)
Definition: image-context.h:43
boost::optional< double > const & width() const
Definition: image-context.h:20
QTransform qtransform()
Definition: transformable-context.h:28
void setTransform(const QTransform &transform)
Definition: shape.cpp:60
Definition: base-context.h:8
boost::iterator_range< const char * > RangedChar
Definition: svgpp-defs.h:13
void svgpp_add_shape(ShapePtr &shape, QString &layer_name)
Definition: svgpp-impl.cpp:268