Merge branch 'birthday' of https://gitlab.com/portfolio91/namecreater into birthday
@ -5,5 +5,16 @@
|
||||
<file>resource/background_g.jpg</file>
|
||||
<file>resource/background_r.jpg</file>
|
||||
<file>resource/background_y.jpg</file>
|
||||
<file>resource/two_word_sample.jpg</file>
|
||||
<file>resource/background_1.jpg</file>
|
||||
<file>resource/background_2.jpg</file>
|
||||
<file>resource/background_3.jpg</file>
|
||||
<file>resource/background_4.jpg</file>
|
||||
<file>resource/background_5.jpg</file>
|
||||
<file>resource/background_6.jpg</file>
|
||||
<file>resource/background_7.jpg</file>
|
||||
<file>resource/background_8.jpg</file>
|
||||
<file>resource/background_9.jpg</file>
|
||||
<file>resource/background_10.jpg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -1,28 +1,13 @@
|
||||
name_1,bg_type
|
||||
︺<EFBFBD>诧,r
|
||||
甃<EFBFBD>和,g
|
||||
<EFBFBD>衱郝,b
|
||||
え<EFBFBD>丹,y
|
||||
︺<EFBFBD>诧,r
|
||||
甃<EFBFBD>和,g
|
||||
<EFBFBD>衱郝,b
|
||||
え<EFBFBD>丹,y
|
||||
︺<EFBFBD>诧,r
|
||||
甃<EFBFBD>和,g
|
||||
︺<EFBFBD>诧,y
|
||||
甃<EFBFBD>和,b
|
||||
︺<EFBFBD>诧,b
|
||||
甃<EFBFBD>和,b
|
||||
<EFBFBD>衱郝,b
|
||||
え<EFBFBD>丹,y
|
||||
︺<EFBFBD>诧,b
|
||||
甃<EFBFBD>和,g
|
||||
<EFBFBD>衱郝,g
|
||||
え<EFBFBD>丹,r
|
||||
︺<EFBFBD>诧,r
|
||||
甃<EFBFBD>和,r
|
||||
︺<EFBFBD>诧,y
|
||||
甃<EFBFBD>和,y
|
||||
甃<EFBFBD>和,r
|
||||
︺<EFBFBD>诧,g
|
||||
甃<EFBFBD>和,b
|
||||
¦ã¤p¨F,r
|
||||
®L¤p,g
|
||||
§dÐw,b
|
||||
¤¨¤p,y
|
||||
¦ã¤p,r
|
||||
®L¤p,g
|
||||
§dÐw,b
|
||||
¤¨¤p,y
|
||||
¦ã¤p,r
|
||||
®L¤p,g
|
||||
¦ã¤p,2
|
||||
®L¤p,1
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
#include <QFontDatabase>
|
||||
|
||||
|
||||
#define BG_SAMPLE_PATH ":/NameCreater/resource/background_sample.jpg"
|
||||
//#define BG_SAMPLE_PATH ":/NameCreater/resource/background_sample.jpg"
|
||||
#define BG_SAMPLE_PATH ":/NameCreater/resource/two_word_sample.jpg"
|
||||
#define BG_PATH_FORMAT ":/NameCreater/resource/background_%1.jpg"
|
||||
#define FONT_NAME "DFYuanStd-W8.otf"
|
||||
#define FONT_SIZE 120
|
||||
@ -54,6 +55,21 @@ static QPointF NAME_POS[] = {
|
||||
QPointF(1268, 2334), QPointF(2240, 2202),
|
||||
};
|
||||
|
||||
static QPointF NAME_POS_TWO_WORD[] = {
|
||||
QPointF(240, 510), QPointF(372, 1402),
|
||||
QPointF(564, 430), QPointF(694, 1402),
|
||||
QPointF(883, 430), QPointF(1014, 1402),
|
||||
QPointF(1205, 430), QPointF(1337, 1402),
|
||||
QPointF(1532, 430), QPointF(1663, 1402),
|
||||
QPointF(1854, 430), QPointF(1987, 1402),
|
||||
QPointF(2176, 430), QPointF(2309, 1402),
|
||||
QPointF(2498, 430), QPointF(2629, 1402),
|
||||
QPointF(2821, 430), QPointF(2952, 1402),
|
||||
QPointF(3145, 430), QPointF(3276, 1402),
|
||||
QPointF(1268, 2012), QPointF(2240, 1880),
|
||||
QPointF(1268, 2334), QPointF(2240, 2202),
|
||||
};
|
||||
|
||||
static int NAME_POS_COUNT = sizeof(NAME_POS) / sizeof(NAME_POS[0]);
|
||||
|
||||
|
||||
@ -217,14 +233,25 @@ int main(int argc, char* argv[])
|
||||
msgBox.exec();
|
||||
}
|
||||
QString name = name_info.name1;
|
||||
int name_len = name.length();
|
||||
for (int j = 0; j < 2; j++) {
|
||||
int pos_idx = idx * 2 + j;
|
||||
int xscale, yscale;
|
||||
|
||||
xscale = yscale = (j == 1) ? -1 : 1;
|
||||
QPointF pos = NAME_POS[pos_idx];
|
||||
int y_offset[2] = {0};
|
||||
if (name_len == 2) {
|
||||
if (!rot) {
|
||||
pos.setY(pos.y() + 82 * xscale);
|
||||
}
|
||||
else {
|
||||
pos.setX(pos.x() + 82 * xscale);
|
||||
|
||||
}
|
||||
|
||||
y_offset[0] = 25;
|
||||
}
|
||||
|
||||
QGraphicsTextItem* textItem1 = new QGraphicsTextItem(name.mid(0, 1));
|
||||
textItem1->setFont(font);
|
||||
@ -240,7 +267,6 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
|
||||
|
||||
scene.addItem(textItem1);
|
||||
|
||||
QGraphicsTextItem* textItem2 = new QGraphicsTextItem(name.mid(1, 1));
|
||||
@ -248,17 +274,18 @@ int main(int argc, char* argv[])
|
||||
textItem2->setDefaultTextColor(font_color);
|
||||
if (!rot) {
|
||||
|
||||
textItem2->setPos(pos.x(), pos.y() + 145 * xscale);
|
||||
textItem2->setPos(pos.x(), pos.y() + (145 + y_offset[0]) * xscale);
|
||||
textItem2->setTransform(QTransform::fromScale(xscale, yscale));
|
||||
}
|
||||
else {
|
||||
textItem2->setPos(pos.x() + 145 * xscale, pos.y());
|
||||
textItem2->setPos(pos.x() + (145 + y_offset[0]) * xscale, pos.y());
|
||||
textItem2->setRotation(-90);
|
||||
textItem2->setTransform(QTransform::fromScale(xscale, yscale));
|
||||
}
|
||||
|
||||
scene.addItem(textItem2);
|
||||
|
||||
if (name_len > 2) {
|
||||
QGraphicsTextItem* textItem3 = new QGraphicsTextItem(name.mid(2, 1));
|
||||
textItem3->setFont(font);
|
||||
textItem3->setDefaultTextColor(font_color);
|
||||
@ -273,6 +300,8 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
scene.addItem(textItem3);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
bool is_export_page = ((idx + 1) % BG_POS_COUNT == 0);
|
||||
@ -280,7 +309,9 @@ int main(int argc, char* argv[])
|
||||
QString file_name = QString("%1_.jpg").arg(QString::number(export_times + 1));
|
||||
saveToImage(file_name, &scene);
|
||||
export_times++;
|
||||
scene.clear();
|
||||
view.show();
|
||||
break;
|
||||
//scene.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,5 +324,5 @@ int main(int argc, char* argv[])
|
||||
|
||||
|
||||
font_res.close();
|
||||
return 0;
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
BIN
NameCreater/resource/background_1.jpg
Normal file
|
After Width: | Height: | Size: 189 KiB |
BIN
NameCreater/resource/background_10.jpg
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
NameCreater/resource/background_2.jpg
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
NameCreater/resource/background_3.jpg
Normal file
|
After Width: | Height: | Size: 156 KiB |
BIN
NameCreater/resource/background_4.jpg
Normal file
|
After Width: | Height: | Size: 167 KiB |
BIN
NameCreater/resource/background_5.jpg
Normal file
|
After Width: | Height: | Size: 135 KiB |
BIN
NameCreater/resource/background_6.jpg
Normal file
|
After Width: | Height: | Size: 149 KiB |
BIN
NameCreater/resource/background_7.jpg
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
NameCreater/resource/background_8.jpg
Normal file
|
After Width: | Height: | Size: 177 KiB |
BIN
NameCreater/resource/background_9.jpg
Normal file
|
After Width: | Height: | Size: 223 KiB |
BIN
NameCreater/resource/two_word_sample.jpg
Normal file
|
After Width: | Height: | Size: 2.3 MiB |