1
0
Fork 0
mirror of https://gitlab.com/Syping/gta5view-cmd synced 2024-12-22 03:45:30 +01:00

Ignore Original Resolution added

This commit is contained in:
Syping 2018-08-14 01:50:59 +02:00
parent fe4a6cd081
commit dc5f1dc84b
3 changed files with 86 additions and 74 deletions

@ -1 +1 @@
Subproject commit dc101a66dad3bf09336556bfd9fc92bb6f723212
Subproject commit feabaac48eadfcc5a7ccc998884f1f96432d3f7c

View file

@ -32,6 +32,8 @@ HEADERS += \
INCLUDEPATH += ./gta5view
DEFINES += GTA5SYNC_NOASSIST
# WINDOWS ONLY
win32: DEFINES += GTA5SYNC_WIN

156
main.cpp
View file

@ -37,6 +37,7 @@ int main(int argc, char *argv[])
QString format = "jpg";
bool isDefault = true;
bool avatarMode = false;
bool ignoreORes = false;
bool convertToGTA = false;
bool customFormat = false;
bool formatSwitch = false;
@ -77,6 +78,11 @@ int main(int argc, char *argv[])
{
isDefault = true;
}
else if (args.at(4) == "-fs")
{
convertToGTA = false;
formatSwitch = true;
}
else if (args.at(4) == "-aiar")
{
isDefault = false;
@ -111,10 +117,11 @@ int main(int argc, char *argv[])
isDefault = true;
keepAspectRatio = true;
}
else if (args.at(4) == "-fs")
else if (args.at(4) == "-ior")
{
convertToGTA = false;
formatSwitch = true;
isDefault = false;
ignoreORes = true;
keepAspectRatio = false;
}
else
{
@ -249,89 +256,92 @@ int main(int argc, char *argv[])
}
if (!image.isNull())
{
QSize snapmaticRes(960, 536);
QSize avatarRes(470, 470);
int avatarZoneX = 145;
int avatarZoneY = 66;
if (isDefault)
if (!ignoreORes)
{
if (image.width() == image.height())
QSize snapmaticRes(960, 536);
QSize avatarRes(470, 470);
int avatarZoneX = 145;
int avatarZoneY = 66;
if (isDefault)
{
avatarMode = true;
if (image.width() == image.height())
{
avatarMode = true;
}
else
{
avatarMode = false;
}
}
if (!avatarMode)
{
QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
snapmaticImage.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticImage);
// Picture mode
int diffWidth = 0;
int diffHeight = 0;
if (keepAspectRatio)
{
image = image.scaled(snapmaticRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (image.width() != snapmaticRes.width())
{
diffWidth = snapmaticRes.width() - image.width();
diffWidth = diffWidth / 2;
}
else if (image.height() != snapmaticRes.height())
{
diffHeight = snapmaticRes.height() - image.height();
diffHeight = diffHeight / 2;
}
}
else
{
image = image.scaled(snapmaticRes.width(), snapmaticRes.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, image);
snapmaticPainter.end();
image = snapmaticImage;
}
else
{
avatarMode = false;
}
}
if (!avatarMode)
{
QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
snapmaticImage.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticImage);
QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
snapmaticImage.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticImage);
// Picture mode
int diffWidth = 0;
int diffHeight = 0;
if (keepAspectRatio)
{
image = image.scaled(snapmaticRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (image.width() != snapmaticRes.width())
// Scale to Avatar Resolution if needed
if (image.width() != avatarRes.width())
{
diffWidth = snapmaticRes.width() - image.width();
diffWidth = diffWidth / 2;
image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
else if (image.height() != snapmaticRes.height())
{
diffHeight = snapmaticRes.height() - image.height();
diffHeight = diffHeight / 2;
}
}
else
{
image = image.scaled(snapmaticRes.width(), snapmaticRes.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
snapmaticPainter.drawImage(0 + diffWidth, 0 + diffHeight, image);
snapmaticPainter.end();
image = snapmaticImage;
}
else
{
QImage snapmaticImage(snapmaticRes, QImage::Format_RGB888);
snapmaticImage.fill(Qt::black);
QPainter snapmaticPainter(&snapmaticImage);
// Scale to Avatar Resolution if needed
if (image.width() != avatarRes.width())
{
image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
// Avatar mode
int diffWidth = 0;
int diffHeight = 0;
if (keepAspectRatio)
{
image = image.scaled(avatarRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (image.width() > image.height())
// Avatar mode
int diffWidth = 0;
int diffHeight = 0;
if (keepAspectRatio)
{
diffHeight = avatarRes.height() - image.height();
diffHeight = diffHeight / 2;
image = image.scaled(avatarRes, Qt::KeepAspectRatio, Qt::SmoothTransformation);
if (image.width() > image.height())
{
diffHeight = avatarRes.height() - image.height();
diffHeight = diffHeight / 2;
}
else if (image.width() < image.height())
{
diffWidth = avatarRes.width() - image.width();
diffWidth = diffWidth / 2;
}
}
else if (image.width() < image.height())
else
{
diffWidth = avatarRes.width() - image.width();
diffWidth = diffWidth / 2;
image = image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
snapmaticPainter.drawImage(avatarZoneX + diffWidth, avatarZoneY + diffHeight, image);
snapmaticPainter.end();
image = snapmaticImage;
}
else
{
image = image.scaled(avatarRes, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
snapmaticPainter.drawImage(avatarZoneX + diffWidth, avatarZoneY + diffHeight, image);
snapmaticPainter.end();
image = snapmaticImage;
}
if (picture.setImage(image))
@ -510,7 +520,7 @@ int main(int argc, char *argv[])
cout << "Convert-only: <autodef> (auto file name at convert)" << endl;
cout << "Convert-only: <autoext> (auto file extension at convert)" << endl;
cout << "Formats: jpg pgta g5e" << endl;
cout << "Snapmatic Modes: a p d fs aiar akar piar pkar diar dkar" << endl;
cout << "Snapmatic Modes: a p d fs aiar akar piar pkar diar dkar ior" << endl;
cout << "Snapmatic Flags: crew=int players=int[] position=double[] title=string" << endl;
cout << "Global Flags: output=string" << endl;
}