This commit is contained in:
寂静的羽夏 2022-11-18 11:00:04 +08:00
parent 90118747ef
commit 588a49d05b
6 changed files with 44 additions and 6 deletions

View File

@ -18,8 +18,6 @@ ExportDialog::ExportDialog(DMainWindow *parent) : DDialog(parent) {
l->setReadOnly(true);
connect(l, &QLineEdit::textChanged, this,
[=] { folder->setToolTip(l->text()); });
connect(folder, &DFileChooserEdit::fileChoosed, this,
[=](const QString &fileName) { res.path = fileName; });
addContent(folder);
addSpacing(10);
btnbox = new DButtonBox(this);
@ -64,7 +62,10 @@ ExportDialog::ExportDialog(DMainWindow *parent) : DDialog(parent) {
ExportResult ExportDialog::getResult() { return res; }
void ExportDialog::on_accept() { done(1); }
void ExportDialog::on_accept() {
res.path = folder->text();
done(1);
}
void ExportDialog::on_reject() { done(0); }

View File

@ -283,18 +283,24 @@ void GifDecoder::loadfromImages(QStringList filenames, QSize size) {
}
filenames.removeFirst();
}
auto oimg = img;
auto osize = size == QSize() ? oimg.size() : size;
if (osize.width() > UINT16_MAX || osize.height() > UINT16_MAX) {
osize.scale(UINT16_MAX, UINT16_MAX, Qt::KeepAspectRatio);
}
for (auto f : filenames) {
if (img.load(f)) {
QGifFrameInfoData frame;
frame.image = img.scaled(osize);
frame.image = correctImage(img.scaled(osize));
frame.transparentColor = Qt::transparent;
frame.delayTime = 40; // 40 ms
frameInfos.append(frame);
}
}
canvasSize = osize;
emit frameRefreshAll();
}
@ -315,6 +321,7 @@ void GifDecoder::loadfromGifs(QStringList gifs, QSize size) {
}
}
}
canvasSize = osize;
emit frameRefreshAll();
}
@ -322,7 +329,8 @@ bool GifDecoder::exportImages(QString folder, QString ext) {
int index = 0;
for (auto &frame : frameInfos) {
auto res = frame.image.save(
QString("%1/winggif-%2.%3").arg(folder).arg(index++).arg(ext));
QString("%1/winggif-%2.%3").arg(folder).arg(index++).arg(ext),
ext.toLatin1().constData());
if (!res)
return false;
}
@ -481,3 +489,10 @@ GifDecoder::colorTableToColorMapObject(QVector<QRgb> colorTable) const {
return cmap;
}
QImage GifDecoder::correctImage(QImage img) {
QImage image(img.size(), QImage::Format_RGBA8888);
QPainter p(&image);
p.drawImage(image.rect(), img);
return image;
}

View File

@ -77,6 +77,8 @@ private:
QSize getCanvasSize() const;
int getFrameTransparentColorIndex(const QGifFrameInfoData &info) const;
QImage correctImage(QImage img);
private:
QSize canvasSize;
int loopCount;

View File

@ -86,4 +86,24 @@
## 应用商店
&emsp;&emsp;目前有星火商店。
&emsp;&emsp;该软件可以通过应用商店进行安装,目前支持的有:深度商店、星火商店。
### 深度商店
&emsp;&emsp;如果你是 Deepin 系统,可以直接从应用商店搜索“羽云 GIF 编辑器”下载:
<p align="center">
<img alt="深度商店" src="deepinstore.png">
<p align="center">深度商店</p>
</p>
### 星火商店
&emsp;&emsp;如果您安装了星火商店,可以通过它下载安装,会与深度商店的较大或者阶段性更新同步。
<p align="center">
<img alt="星火商店" src="sparkstore.png">
<p align="center">星火商店</p>
</p>
&emsp;&emsp;Spk分享链接spk://store/store/com.wingsummer.winggifeditor

BIN
deepinstore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 225 KiB

BIN
sparkstore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 234 KiB