The Image class.
More...
#include <image.h>
|
| static const QStringList & | getSupportedExtensions () noexcept |
| | Get all supported file extensions.
|
| |
| static std::optional< QImage > | tryLoad (const QByteArray &data, const QString &format, QString *errorMsg=nullptr) noexcept |
| | Try loading an image file.
|
| |
◆ OnEditedSlot
◆ Event
| Enumerator |
|---|
| UuidChanged | |
| FileNameChanged | |
| PositionChanged | |
| RotationChanged | |
| WidthChanged | |
| HeightChanged | |
| BorderWidthChanged | |
◆ Image() [1/5]
◆ Image() [2/5]
◆ Image() [3/5]
◆ Image() [4/5]
◆ Image() [5/5]
◆ ~Image()
◆ getUuid()
| const Uuid & getUuid |
( |
| ) |
const |
|
inlinenoexcept |
◆ getFileName()
◆ getFileBasename()
| QString getFileBasename |
( |
| ) |
const |
|
noexcept |
◆ getFileExtension()
| QString getFileExtension |
( |
| ) |
const |
|
noexcept |
◆ getPosition()
| const Point & getPosition |
( |
| ) |
const |
|
inlinenoexcept |
◆ getCenter()
| Point getCenter |
( |
| ) |
const |
|
noexcept |
◆ getRotation()
| const Angle & getRotation |
( |
| ) |
const |
|
inlinenoexcept |
◆ getWidth()
◆ getHeight()
◆ getBorderWidth()
◆ setFileName()
◆ setPosition()
| bool setPosition |
( |
const Point & |
pos | ) |
|
|
noexcept |
◆ setRotation()
| bool setRotation |
( |
const Angle & |
rotation | ) |
|
|
noexcept |
◆ setWidth()
◆ setHeight()
◆ setBorderWidth()
◆ serialize()
◆ operator==()
| bool operator== |
( |
const Image & |
rhs | ) |
const |
|
noexcept |
◆ operator!=()
| bool operator!= |
( |
const Image & |
rhs | ) |
const |
|
inlinenoexcept |
◆ operator=()
◆ getSupportedExtensions()
| const QStringList & getSupportedExtensions |
( |
| ) |
|
|
staticnoexcept |
Get all supported file extensions.
- Note
- This is only a small subset of Qt's supported image formats. We don't want to support unusual, exotic or non-portable image formats to make sure LibrePCB can open them on any platform without needing possibly heavy dependencies.
-
All returned file extensions are lowercase and we expect images to be created only with lowercase file extensions too.
- Returns
- File extensions (e.g. "png", "jpg", "svg").
◆ tryLoad()
| std::optional< QImage > tryLoad |
( |
const QByteArray & |
data, |
|
|
const QString & |
format, |
|
|
QString * |
errorMsg = nullptr |
|
) |
| |
|
staticnoexcept |
Try loading an image file.
- Note
- This also verifies that the format is officially supported. Formats not contained in getSupportedExtensions() will return
std::nullopt even if Qt would be able to load it.
- Parameters
-
| data | The file content. |
| format | The file format (getFileExtension()). Note that we are case-sensitive, i.e. don't allow uppercase file extensions (there's no good reason to have uppercase file extensions). |
| errorMsg | If not nullptr, the (translated) error message will be written into this string (only on error). |
- Returns
- The
QImage on success, std::nullopt on failure.
◆ onEdited
◆ mUuid
◆ mFileName
◆ mPosition
◆ mRotation
◆ mWidth
◆ mHeight
◆ mBorderWidth
The documentation for this class was generated from the following files:
- /__w/1/s/libs/librepcb/core/geometry/image.h
- /__w/1/s/libs/librepcb/core/geometry/image.cpp