diff --git a/NameCreater/NameCreater.qrc b/NameCreater/NameCreater.qrc
index 3a59a98..bf48fdb 100644
--- a/NameCreater/NameCreater.qrc
+++ b/NameCreater/NameCreater.qrc
@@ -16,5 +16,6 @@
resource/background_8.jpg
resource/background_9.jpg
resource/background_10.jpg
+ resource/background_number_smaple.jpg
diff --git a/NameCreater/main.cpp b/NameCreater/main.cpp
index f3ac988..eb010ba 100644
--- a/NameCreater/main.cpp
+++ b/NameCreater/main.cpp
@@ -14,7 +14,7 @@
//#define BG_SAMPLE_PATH ":/NameCreater/resource/background_sample.jpg"
-#define BG_SAMPLE_PATH ":/NameCreater/resource/two_word_sample.jpg"
+#define BG_SAMPLE_PATH ":/NameCreater/resource/background_number_smaple.jpg"
#define BG_PATH_FORMAT ":/NameCreater/resource/background_%1.jpg"
#define FONT_NAME "DFYuanStd-W8.otf"
#define FONT_SIZE 120
@@ -28,6 +28,7 @@ struct NameInfo_t {
QString name1;
QString name2;
QString bg_path;
+ bool is_number_bg;
};
static QPointF BG_POS[] = {
@@ -55,17 +56,17 @@ 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),
+static QPointF NAME_POS_NUMBER[] = {
+ QPointF(240, 410), QPointF(372, 1422),
+ QPointF(564, 410), QPointF(694, 1422),
+ QPointF(883, 410), QPointF(1014, 1422),
+ QPointF(1205, 410), QPointF(1337, 1402),
+ QPointF(1532, 410), QPointF(1663, 1402),
+ QPointF(1854, 410), QPointF(1987, 1402),
+ QPointF(2176, 410), QPointF(2309, 1402),
+ QPointF(2498, 410), QPointF(2629, 1402),
+ QPointF(2821, 410), QPointF(2952, 1402),
+ QPointF(3145, 410), QPointF(3276, 1402),
QPointF(1268, 2012), QPointF(2240, 1880),
QPointF(1268, 2334), QPointF(2240, 2202),
};
@@ -150,7 +151,7 @@ QList getNameByFile(const QString& filename) {
info.name1 = name1;
info.bg_path = QString(BG_PATH_FORMAT).arg(type_str);
-
+ info.is_number_bg = type_str[0].isDigit();
nameList.append(info);
@@ -204,9 +205,9 @@ int main(int argc, char* argv[])
- //QImage image(BG_SAMPLE_PATH);
- //QGraphicsPixmapItem* bgItem = new QGraphicsPixmapItem(QPixmap::fromImage(image));
- //scene.addItem(bgItem);
+ QImage image(BG_SAMPLE_PATH);
+ QGraphicsPixmapItem* bgItem = new QGraphicsPixmapItem(QPixmap::fromImage(image));
+ scene.addItem(bgItem);
for (int n = 0; n < nameList.length(); n++) {
@@ -214,9 +215,9 @@ int main(int argc, char* argv[])
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);
+ /*QGraphicsRectItem* bg_item = new QGraphicsRectItem(0, 0, 3508, 2482);
bg_item->setBrush(QBrush(QColor(255, 255, 255)));
- scene.addItem(bg_item);
+ scene.addItem(bg_item);*/
}
@@ -239,7 +240,7 @@ int main(int argc, char* argv[])
int xscale, yscale;
xscale = yscale = (j == 1) ? -1 : 1;
- QPointF pos = NAME_POS[pos_idx];
+ QPointF pos = name_info.is_number_bg ? NAME_POS_NUMBER[pos_idx] : NAME_POS[pos_idx];
int y_offset[2] = {0};
if (name_len == 2) {
if (!rot) {
diff --git a/NameCreater/resource/background_number_smaple.jpg b/NameCreater/resource/background_number_smaple.jpg
new file mode 100644
index 0000000..48e26b9
Binary files /dev/null and b/NameCreater/resource/background_number_smaple.jpg differ