Qt 4.8
Classes | Functions
qsvggenerator.cpp File Reference
#include "qsvggenerator.h"
#include "qpainterpath.h"
#include "private/qpaintengine_p.h"
#include "private/qtextengine_p.h"
#include "private/qdrawhelper_p.h"
#include "qfile.h"
#include "qtextcodec.h"
#include "qtextstream.h"
#include "qbuffer.h"
#include "qmath.h"
#include "qdebug.h"

Go to the source code of this file.

Classes

class  QSvgGeneratorPrivate
 
class  QSvgPaintEngine
 
class  QSvgPaintEnginePrivate
 
struct  QSvgPaintEnginePrivate::_attributes
 

Functions

static QPaintEngine::PaintEngineFeatures svgEngineFeatures ()
 
static void translate_color (const QColor &color, QString *color_string, QString *opacity_string)
 
static void translate_dashPattern (QVector< qreal > pattern, const qreal &width, QString *pattern_string)
 

Function Documentation

◆ svgEngineFeatures()

static QPaintEngine::PaintEngineFeatures svgEngineFeatures ( )
inlinestatic

◆ translate_color()

static void translate_color ( const QColor color,
QString color_string,
QString opacity_string 
)
static

Definition at line 62 of file qsvggenerator.cpp.

Referenced by QSvgPaintEngine::qbrushToSvg(), and QSvgPaintEngine::qpenToSvg().

64 {
65  Q_ASSERT(color_string);
66  Q_ASSERT(opacity_string);
67 
68  *color_string =
69  QString::fromLatin1("#%1%2%3")
70  .arg(color.red(), 2, 16, QLatin1Char('0'))
71  .arg(color.green(), 2, 16, QLatin1Char('0'))
72  .arg(color.blue(), 2, 16, QLatin1Char('0'));
73  *opacity_string = QString::number(color.alphaF());
74 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
qreal alphaF() const
Returns the alpha color component of this color.
Definition: qcolor.cpp:1106
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ translate_dashPattern()

static void translate_dashPattern ( QVector< qreal pattern,
const qreal width,
QString pattern_string 
)
static

Definition at line 76 of file qsvggenerator.cpp.

Referenced by QSvgPaintEngine::qpenToSvg().

77 {
78  Q_ASSERT(pattern_string);
79 
80  // Note that SVG operates in absolute lengths, whereas Qt uses a length/width ratio.
81  foreach (qreal entry, pattern)
82  *pattern_string += QString::fromLatin1("%1,").arg(entry * width);
83 
84  pattern_string->chop(1);
85 }
double qreal
Definition: qglobal.h:1193
void chop(int n)
Removes n characters from the end of the string.
Definition: qstring.cpp:4623
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188