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
|
.. _ZImage:
ZImage
======
.. cpp:class:: Tui::ZImage
ZImage allows keeping terminal output in a memory buffer for later usage or to store and load.
ZSymbol is copyable, movable, assignable and supports equality comparisons.
It is undefined behaviour when a image with outstanding painter is moved from or access anything else than
the assignment operators and destructor on the moved from state.
**Constructors**
| :cpp:func:`ZImage(const Tui::ZTerminal *terminal, int width, int height)> <void Tui::ZImage::ZImage(const Tui::ZTerminal *terminal, int width, int height)>`
**Static Functions**
| :cpp:func:`~std::unique_ptr<Tui::ZImage> Tui::ZImage::fromFile(const Tui::ZTerminal *terminal, const QString &fileName)`
| :cpp:func:`~std::unique_ptr<Tui::ZImage> Tui::ZImage::fromByteArray(const Tui::ZTerminal *terminal, QByteArray data)`
**Functions**
| :cpp:func:`~int Tui::ZImage::height() const`
| :cpp:func:`~Tui::ZPainter Tui::ZImage::painter()`
| :cpp:func:`~Tui::ZTextAttributes Tui::ZImage::peekAttributes(int x, int y) const`
| :cpp:func:`~Tui::ZColor Tui::ZImage::peekBackground(int x, int y) const`
| :cpp:func:`~Tui::ZColor Tui::ZImage::peekDecoration(int x, int y) const`
| :cpp:func:`~Tui::ZColor Tui::ZImage::peekForground(int x, int y) const`
| :cpp:func:`~bool Tui::ZImage::peekSoftwrapMarker(int x, int y) const`
| :cpp:func:`~QString Tui::ZImage::peekText(int x, int y, int *left, int *right) const`
| :cpp:func:`~bool Tui::ZImage::save(const QString &fileName) const`
| :cpp:func:`~QByteArray Tui::ZImage::saveToByteArray() const`
| :cpp:func:`~QSize Tui::ZImage::size() const`
| :cpp:func:`swap(Tui::ZImage &other) <void Tui::ZImage::swap(Tui::ZImage &other)>`
| :cpp:func:`~int Tui::ZImage::width() const`
Members
-------
.. cpp:namespace:: Tui::ZImage
.. cpp:function:: ZImage(const Tui::ZTerminal *terminal, int width, int height)
Construct an empty image using terminal characteristics from ``terminal`` with
the width ``width`` and height ``height``.
.. rst-class:: tw-static
.. cpp:function:: std::unique_ptr<Tui::ZImage> fromFile(const Tui::ZTerminal *terminal, const QString &fileName)
Load an terminal image from the file named ``fileName`` and using the terminal characteristics from ``terminal``.
Returns :cpp:expr:`nullptr` if the file could not be read or parsing failed.
.. rst-class:: tw-static
.. cpp:function:: std::unique_ptr<Tui::ZImage> fromByteArray(const Tui::ZTerminal *terminal, QByteArray data)
Load an terminal image from memory buffer ``data`` and using the terminal characteristics from ``terminal``.
Returns :cpp:expr:`nullptr` if the parsing failed.
.. cpp:function:: int width() const
.. cpp:function:: int height() const
.. cpp:function:: QSize size() const
Returns the size of the buffer.
.. cpp:function:: bool save(const QString &fileName) const
Save the contents of the image to file ``fileName``.
Returns :cpp:expr:`true` on success.
.. cpp:function:: QByteArray saveToByteArray() const
Save the contents of the image to a memory buffer and returns it as :cpp:class:`QByteArray`.
.. cpp:function:: QString peekText(int x, int y, int *left, int *right) const
Get text of cluster covering the cell at position ``x``, ``y``.
If not :cpp:expr:`nullptr`, ``left`` and ``right`` will be set to the left most respectivly right most cell covered
by the cluster.
.. cpp:function:: Tui::ZColor peekForground(int x, int y) const
Get the foreground color of the cell at position ``x``, ``y``.
.. cpp:function:: Tui::ZColor peekBackground(int x, int y) const
Get the background color of the cell at position ``x``, ``y``.
.. cpp:function:: Tui::ZColor peekDecoration(int x, int y) const
Get the decoration color of the cell at position ``x``, ``y``.
.. cpp:function:: bool peekSoftwrapMarker(int x, int y) const
Returns :cpp:expr:`true` if the cell at position ``x``, ``y`` contains a softwrap marker.
.. cpp:function:: Tui::ZTextAttributes peekAttributes(int x, int y) const
Get the attributes of the cell at position ``x``, ``y``.
.. cpp:function:: Tui::ZPainter painter()
Returns a :cpp:class:`Tui::ZPainter` for painting on the image.
.. cpp:function:: void swap(Tui::ZImage &other)
Like ``std::swap`` for ``Tui::ZImage``.
.. cpp:namespace:: NULL
|