/usr/include/Wt/WSvgImage is in libwt-dev 3.3.3+dfsg-4.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WSVG_IMAGE_H_
#define WSVG_IMAGE_H_
#include <Wt/WBrush>
#include <Wt/WFont>
#include <Wt/WPen>
#include <Wt/WPointF>
#include <Wt/WResource>
#include <Wt/WShadow>
#include <Wt/WStringStream>
#include <Wt/WTransform>
#include <Wt/WVectorImage>
namespace Wt {
/*! \class WSvgImage Wt/WSvgImage Wt/WSvgImage
* \brief A paint device for rendering using Scalable Vector Graphics (SVG).
*
* The %WSvgImage is primarily used by WPaintedWidget to render to the
* browser in Support Vector Graphics (SVG) format.
*
* \if cpp
* You may also use the %WSvgImage as an independent resource, for example
* in conjunction with a WAnchor or WImage, or to make a hard copy of an
* image in SVG format, using write():
* \code
* Wt::Chart::WCartesianChart *chart = ...
*
* Wt::WSvgImage svgImage(800, 400);
* Wt::WPainter p(&svgImage);
* chart->paint(p);
* p.end();
* std::ofstream f("chart.svg");
* svgImage.write(f);
* \endcode
* \endif
*
* \ingroup painting
*/
class WT_API WSvgImage : public WResource, public WVectorImage
{
public:
/*! \brief Create an SVG paint device.
*
* If \p paintUpdate is \c true, then only an SVG fragment will be
* rendered that can be used to update the DOM of an existing SVG
* image, instead of a full SVG image.
*/
WSvgImage(const WLength& width, const WLength& height, WObject *parent = 0,
bool paintUpdate = false);
/*! \brief Destructor.
*/
~WSvgImage();
virtual WFlags<FeatureFlag> features() const;
virtual void setChanged(WFlags<ChangeFlag> flags);
virtual void drawArc(const WRectF& rect, double startAngle, double spanAngle);
virtual void drawImage(const WRectF& rect, const std::string& imgUri,
int imgWidth, int imgHeight, const WRectF& sourceRect);
virtual void drawLine(double x1, double y1, double x2, double y2);
virtual void drawPath(const WPainterPath& path);
virtual void drawText(const WRectF& rect,
WFlags<AlignmentFlag> alignmentFlags,
TextFlag textFlag,
const WString& text);
virtual WTextItem measureText(const WString& text, double maxWidth = -1,
bool wordWrap = false);
virtual WFontMetrics fontMetrics();
virtual void init();
virtual void done();
virtual bool paintActive() const { return painter_ != 0; }
virtual std::string rendered();
virtual WLength width() const { return width_; }
virtual WLength height() const { return height_; }
virtual void handleRequest(const Http::Request& request,
Http::Response& response);
protected:
virtual WPainter *painter() const { return painter_; }
virtual void setPainter(WPainter *painter) { painter_ = painter; }
private:
WLength width_, height_;
WPainter *painter_;
bool paintUpdate_;
WFlags<ChangeFlag> changeFlags_;
bool newGroup_;
bool newClipPath_;
bool busyWithPath_;
int currentClipId_;
static int nextClipId_;
int currentFillGradientId_;
int currentStrokeGradientId_;
static int nextGradientId_;
WTransform currentTransform_;
WBrush currentBrush_;
WFont currentFont_;
WPen currentPen_;
WShadow currentShadow_;
int currentShadowId_, nextShadowId_;
WPointF pathTranslation_;
WStringStream shapes_;
void finishPath();
void makeNewGroup();
std::string fillStyle() const;
std::string strokeStyle() const;
std::string fontStyle() const;
std::string clipPath() const;
int createShadowFilter(WStringStream& out);
void defineGradient(const WGradient& gradient, int id);
std::string fillStyle_, strokeStyle_, fontStyle_;
static std::string quote(double s);
static std::string quote(const std::string& s);
void drawPlainPath(WStringStream& s, const WPainterPath& path);
void streamResourceData(std::ostream& stream);
};
}
#endif // WSVG_IMAGE_H_
|