finish birthday namecreater

This commit is contained in:
shouchih_chen 2022-02-20 07:27:25 +08:00
parent 615fa0e283
commit 6025cc2913
2 changed files with 38 additions and 13 deletions

View File

@ -11,3 +11,18 @@ name_1,bg_type
<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

1 name_1 bg_type
11 甃�和 g
12 ︺�诧 y
13 甃�和 b
14 ︺�诧 b
15 甃�和 b
16 �衱郝 b
17 え�丹 y
18 ︺�诧 b
19 甃�和 g
20 �衱郝 g
21 え�丹 r
22 ︺�诧 r
23 甃�和 r
24 ︺�诧 y
25 甃�和 y
26 甃�和 r
27 ︺�诧 g
28 甃�和 b

View File

@ -178,7 +178,7 @@ int main(int argc, char* argv[])
msgBox.exec();
}
QGraphicsScene scene(0, 0, 3508, 2482);
QGraphicsScene scene;
scene.setBackgroundBrush(QBrush(QColor(255, 255, 255)));
QGraphicsView view(&scene);
@ -190,13 +190,20 @@ int main(int argc, char* argv[])
for (int n = 0; n < nameList.length(); n++) {
if (n >= BG_POS_COUNT)break;
int idx = n % BG_POS_COUNT;
NameInfo_t name_info = nameList.at(n);
QImage name_image(name_info.bg_path);
if (idx == 0) {
QGraphicsRectItem* bg_item = new QGraphicsRectItem(0, 0, 3508, 2482);
bg_item->setBrush(QBrush(QColor(255, 255, 255)));
scene.addItem(bg_item);
}
QGraphicsPixmapItem* name_bgItem = new QGraphicsPixmapItem(QPixmap::fromImage(name_image));
bool rot = (n == 10 || n == 11);
bool rot = (idx == 10 || idx == 11);
name_bgItem->setRotation(rot ? -90 : 0);
name_bgItem->setPos(BG_POS[n]);
name_bgItem->setPos(BG_POS[idx]);
scene.addItem(name_bgItem);
@ -207,7 +214,7 @@ int main(int argc, char* argv[])
}
QString name = name_info.name1;
for (int j = 0; j < 2; j++) {
int pos_idx = n * 2 + j;
int pos_idx = idx * 2 + j;
int xscale, yscale;
xscale = yscale = (j == 1) ? -1 : 1;
@ -264,20 +271,23 @@ int main(int argc, char* argv[])
scene.addItem(textItem3);
}
bool is_export_page = ((idx + 1) % BG_POS_COUNT == 0);
if (is_export_page || n == nameList.count()-1) {
QString file_name = QString("%1_.jpg").arg(QString::number(export_times + 1));
saveToImage(file_name, &scene);
export_times++;
scene.clear();
}
}
}
QString file_name = QString("%1_.jpg").arg(QString::number(export_times + 1));
saveToImage(file_name, &scene);
export_times++;
/*QMessageBox msgBox;
QMessageBox msgBox;
msgBox.setText(QString().asprintf("Export Finshed. Count:%d", export_times));
msgBox.exec();*/
msgBox.exec();
font_res.close();
return a.exec();
return 0;
}