12#include <QApplication>
15#include <kpluginfactory.h>
47 for (
int i = 0; i < h; ++i) {
53 }
while(it->nextPixel());
67 Q_UNUSED(configuration);
69 if (depthId.
id().isNull()) {
70 document->setErrorMessage(i18n(
"Unknown file type"));
78 const quint64 size = io->size();
83 QDataStream::ByteOrder bo = QDataStream::LittleEndian;
89 kdb->setWindowTitle(i18n(
"Heightmap Import Options"));
96 connect(wdg, SIGNAL(statusUpdated(
bool)), kdb, SLOT(enableButtonOk(
bool)));
102 cfg->fromXML(filterConfig);
105 int endianness = cfg->getInt(
"endianness", 1);
106 if (endianness == 0) {
107 wdg->radioBig->setChecked(
true);
110 wdg->radioLittle->setChecked(
true);
113 wdg->fileSizeLabel->setText(QString::number(size));
116 wdg->bppLabel->setText(QString::number(8));
117 wdg->typeLabel->setText(
"Integer");
120 wdg->bppLabel->setText(QString::number(16));
121 wdg->typeLabel->setText(
"Integer");
124 wdg->bppLabel->setText(QString::number(32));
125 wdg->typeLabel->setText(
"Float");
132 if (kdb->exec() == QDialog::Rejected) {
136 cfg->setProperty(
"endianness", wdg->radioBig->isChecked() ? 0 : 1);
140 w = wdg->widthInput->value();
141 h = wdg->heightInput->value();
143 bo = QDataStream::LittleEndian;
144 cfg->setProperty(
"endianness", 1);
145 if (wdg->radioBig->isChecked()) {
146 bo = QDataStream::BigEndian;
147 cfg->setProperty(
"endianness", 0);
152 const int pixelSize =
156 const int numPixels = size / pixelSize;
158 w = std::sqrt(numPixels);
160 bo = QDataStream::LittleEndian;
167 s.setFloatingPointPrecision(QDataStream::SinglePrecision);
170 KisImageSP image =
new KisImage(document->createUndoStore(), w, h, colorSpace,
"imported heightmap");
188 document->setCurrentImage(image);
192#include "kis_heightmap_import.moc"
const KoID Float32BitsColorDepthID("F32", ki18n("32-bit float/channel"))
const KoID GrayAColorModelID("GRAYA", ki18n("Grayscale/Alpha"))
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const qreal OPACITY_OPAQUE_F
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
QString importConfiguration(const QString &filterId, bool defaultValue=false) const
void setImportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
void setExportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
The KisCursorOverrideHijacker class stores all override cursors in a stack, and resets them back afte...
KisImportExportErrorCode convert(KisDocument *document, QIODevice *io, KisPropertiesConfigurationSP configuration=0) override
KisHeightMapImport(QObject *parent, const QVariantList &)
~KisHeightMapImport() override
KisGroupLayerSP rootLayer() const
QString nextLayerName(const QString &baseName="") const
The base class for import and export filters.
QByteArray mimeType() const
KisHLineIteratorSP createHLineIteratorNG(qint32 x, qint32 y, qint32 w)
A dialog base class with standard buttons and predefined layouts.
void setMainWidget(QWidget *widget)
void setButtons(ButtonCodes buttonMask)
@ Ok
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)
@ Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)
K_PLUGIN_FACTORY_WITH_JSON(KritaASCCDLFactory, "kritaasccdl.json", registerPlugin< KritaASCCDL >();) KritaASCCDL
#define KIS_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_ASSERT_RECOVER_RETURN(cond)
void fillData(KisPaintDeviceSP pd, int w, int h, QDataStream &stream)
KoID mimeTypeToKoID(const class QByteArray &mimeType)
bool addNode(KisNodeSP node, KisNodeSP parent=KisNodeSP(), KisNodeAdditionFlags flags=KisNodeAdditionFlag::None)
KisPaintDeviceSP paintDevice
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()
static void setOpacity(quint8 *pixels, quint8 alpha, qint32 nPixels)
static void setGray(quint8 *data, channels_type nv)
Set the gray component.