#include "pixel_map_generator.h"#include <QApplication>#include <QDomDocument>#include <QFile>#include <QPainter>#include <QPalette>#include <QSvgRenderer>#include <libcockatrice/protocol/pb/serverinfo_user.pb.h>Macros | |
| #define | DEFAULT_COLOR_UNREGISTERED "#32c8ec"; |
| #define | DEFAULT_COLOR_REGISTERED "#5ed900"; |
| #define | DEFAULT_COLOR_MODERATOR_LEFT "#ffffff"; |
| #define | DEFAULT_COLOR_MODERATOR_RIGHT "#000000"; |
| #define | DEFAULT_COLOR_ADMIN "#ff2701"; |
Functions | |
| static QPixmap | loadSvg (const QString &svgPath, const QSize &size, bool expandOnly=false) |
| static QPixmap | tryLoadImage (const QString &path, const QSize &size, bool expandOnly=false) |
| static void | setAttrRecur (QDomElement &elem, const QString &tagName, const QString &attrName, const QString &idName, const QString &attrValue) |
| static QIcon | loadAndColorSvg (const QString &iconPath, const QString &colorLeft, const std::optional< QString > &colorRight, const int minSize) |
| static QString | getIconType (const bool isBuddy, const UserLevelFlags &userLevelFlags, const QString &privLevel) |
| QPixmap | loadColorAdjustedPixmap (const QString &name) |
| #define DEFAULT_COLOR_ADMIN "#ff2701"; |
| #define DEFAULT_COLOR_MODERATOR_LEFT "#ffffff"; |
| #define DEFAULT_COLOR_MODERATOR_RIGHT "#000000"; |
| #define DEFAULT_COLOR_REGISTERED "#5ed900"; |
| #define DEFAULT_COLOR_UNREGISTERED "#32c8ec"; |
|
static |
|
static |
Loads the usericon svg and fills in its colors. The image is kept as a QIcon to preserve the image quality.
Call icon.pixmap(w, h) in order to convert this icon into a pixmap with the given dimensions. Avoid scaling the pixmap in other ways, as that destroys image quality.
| minSize | If the dimensions of the source svg is smaller than this, then it will be scaled up to this size |
| QPixmap loadColorAdjustedPixmap | ( | const QString & | name | ) |
|
static |
Loads in an svg from file and scales it without affecting image quality.
| svgPath | The path to the svg file, with file extension. |
| size | The desired size of the pixmap. |
| expandOnly | If true, then keep the size of the initial pixmap to at least the svg size. |
|
static |
Updates tags in the svg
| elem | The svg |
| tagName | tag with attribute to update |
| attrName | attribute to be updated |
| idName | id that the tag has to match |
| attrValue | the value to update the attribute to |
|
static |
Try to load path image from non-SVG formats, otherwise fall back to SVG. This is to allow custom themes to support non-SVG format type overrides, since SVG requires custom loading.
| path | The path to the file, with no file extension. File formats will be automatically detected. |
| size | The desired size of the pixmap. |
| expandOnly | If true, then keep the size of the initial pixmap to at least the size (Only relevant if SVG). |