An ASCII-encoded image. More...
#include <qtextimage.h>
Public Member Functions | |
| QTextImage () | |
| Constructs a null image. | |
| QTextImage (const QTextImage &) | |
| QTextImage & | operator= (const QTextImage &) |
| bool | isValid () const |
| Whether this image was parsed from a correct ASCIImage string. | |
| QImage | render (int scale, const QPen &strokePen, const QBrush &fillBrush=QBrush()) const |
| Render the image on a QImage. More... | |
| QImage | render (int scale, std::function< void(char, QPainter &)> lineConfig) const |
| Render the image on a QImage. More... | |
Static Public Member Functions | |
| static QTextImage | parse (const QByteArray &text) |
| Parse a QTextImage from a byte array. More... | |
| static QTextImage | parse (const QString &text) |
| Parse a QTextImage from a string. More... | |
| static QTextImage | parse (const QStringList &text) |
| Parse a QTextImage from a list of strings. More... | |
An ASCII-encoded image.
To create a QTextImage use the parse factory methods.
See http://asciimage.org/ for the language reference and other information.
QTextImage is implicitely shared (copy-on-write), so you can pass it by value with negligible overhead.
|
static |
Parse a QTextImage from a byte array.
Rows will be separated by newline charachters.
|
inlinestatic |
Parse a QTextImage from a string.
Rows will be separated by newline charachters.
|
inlinestatic |
Parse a QTextImage from a list of strings.
Each string will be parsed as a different row.
| QImage QTextImage::render | ( | int | scale, |
| const QPen & | strokePen, | ||
| const QBrush & | fillBrush = QBrush() |
||
| ) | const |
Render the image on a QImage.
| scale | The scale of the rendering (1 = 1px per character) |
| strokePen | The pen for stroking lines and points |
| fillBrush | The brush for filling ellipses and polygons |
| QImage QTextImage::render | ( | int | scale, |
| std::function< void(char, QPainter &)> | lineConfig | ||
| ) | const |
Render the image on a QImage.
| scale | The scale of the rendering (1 = 1px per character) |
| lineConfig | A function that will configure the painter for each character |
For multi-character lines (polygons and ellypses), the first character will be passed to lineConfig If the painter is not configured for a character, QPainter default configuration will be used.
Sample usage (A black circle with a transparent X in the middle):
1.8.5