add number sample
This commit is contained in:
parent
793446dcd2
commit
6009f56287
@ -16,5 +16,6 @@
|
|||||||
<file>resource/background_8.jpg</file>
|
<file>resource/background_8.jpg</file>
|
||||||
<file>resource/background_9.jpg</file>
|
<file>resource/background_9.jpg</file>
|
||||||
<file>resource/background_10.jpg</file>
|
<file>resource/background_10.jpg</file>
|
||||||
|
<file>resource/background_number_smaple.jpg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
//#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_SAMPLE_PATH ":/NameCreater/resource/background_number_smaple.jpg"
|
||||||
#define BG_PATH_FORMAT ":/NameCreater/resource/background_%1.jpg"
|
#define BG_PATH_FORMAT ":/NameCreater/resource/background_%1.jpg"
|
||||||
#define FONT_NAME "DFYuanStd-W8.otf"
|
#define FONT_NAME "DFYuanStd-W8.otf"
|
||||||
#define FONT_SIZE 120
|
#define FONT_SIZE 120
|
||||||
@ -28,6 +28,7 @@ struct NameInfo_t {
|
|||||||
QString name1;
|
QString name1;
|
||||||
QString name2;
|
QString name2;
|
||||||
QString bg_path;
|
QString bg_path;
|
||||||
|
bool is_number_bg;
|
||||||
};
|
};
|
||||||
|
|
||||||
static QPointF BG_POS[] = {
|
static QPointF BG_POS[] = {
|
||||||
@ -55,17 +56,17 @@ static QPointF NAME_POS[] = {
|
|||||||
QPointF(1268, 2334), QPointF(2240, 2202),
|
QPointF(1268, 2334), QPointF(2240, 2202),
|
||||||
};
|
};
|
||||||
|
|
||||||
static QPointF NAME_POS_TWO_WORD[] = {
|
static QPointF NAME_POS_NUMBER[] = {
|
||||||
QPointF(240, 510), QPointF(372, 1402),
|
QPointF(240, 410), QPointF(372, 1422),
|
||||||
QPointF(564, 430), QPointF(694, 1402),
|
QPointF(564, 410), QPointF(694, 1422),
|
||||||
QPointF(883, 430), QPointF(1014, 1402),
|
QPointF(883, 410), QPointF(1014, 1422),
|
||||||
QPointF(1205, 430), QPointF(1337, 1402),
|
QPointF(1205, 410), QPointF(1337, 1402),
|
||||||
QPointF(1532, 430), QPointF(1663, 1402),
|
QPointF(1532, 410), QPointF(1663, 1402),
|
||||||
QPointF(1854, 430), QPointF(1987, 1402),
|
QPointF(1854, 410), QPointF(1987, 1402),
|
||||||
QPointF(2176, 430), QPointF(2309, 1402),
|
QPointF(2176, 410), QPointF(2309, 1402),
|
||||||
QPointF(2498, 430), QPointF(2629, 1402),
|
QPointF(2498, 410), QPointF(2629, 1402),
|
||||||
QPointF(2821, 430), QPointF(2952, 1402),
|
QPointF(2821, 410), QPointF(2952, 1402),
|
||||||
QPointF(3145, 430), QPointF(3276, 1402),
|
QPointF(3145, 410), QPointF(3276, 1402),
|
||||||
QPointF(1268, 2012), QPointF(2240, 1880),
|
QPointF(1268, 2012), QPointF(2240, 1880),
|
||||||
QPointF(1268, 2334), QPointF(2240, 2202),
|
QPointF(1268, 2334), QPointF(2240, 2202),
|
||||||
};
|
};
|
||||||
@ -150,7 +151,7 @@ QList<NameInfo_t> getNameByFile(const QString& filename) {
|
|||||||
|
|
||||||
info.name1 = name1;
|
info.name1 = name1;
|
||||||
info.bg_path = QString(BG_PATH_FORMAT).arg(type_str);
|
info.bg_path = QString(BG_PATH_FORMAT).arg(type_str);
|
||||||
|
info.is_number_bg = type_str[0].isDigit();
|
||||||
|
|
||||||
nameList.append(info);
|
nameList.append(info);
|
||||||
|
|
||||||
@ -204,9 +205,9 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//QImage image(BG_SAMPLE_PATH);
|
QImage image(BG_SAMPLE_PATH);
|
||||||
//QGraphicsPixmapItem* bgItem = new QGraphicsPixmapItem(QPixmap::fromImage(image));
|
QGraphicsPixmapItem* bgItem = new QGraphicsPixmapItem(QPixmap::fromImage(image));
|
||||||
//scene.addItem(bgItem);
|
scene.addItem(bgItem);
|
||||||
|
|
||||||
|
|
||||||
for (int n = 0; n < nameList.length(); n++) {
|
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);
|
NameInfo_t name_info = nameList.at(n);
|
||||||
QImage name_image(name_info.bg_path);
|
QImage name_image(name_info.bg_path);
|
||||||
if (idx == 0) {
|
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)));
|
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;
|
int xscale, yscale;
|
||||||
|
|
||||||
xscale = yscale = (j == 1) ? -1 : 1;
|
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};
|
int y_offset[2] = {0};
|
||||||
if (name_len == 2) {
|
if (name_len == 2) {
|
||||||
if (!rot) {
|
if (!rot) {
|
||||||
|
|||||||
BIN
NameCreater/resource/background_number_smaple.jpg
Normal file
BIN
NameCreater/resource/background_number_smaple.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
Loading…
x
Reference in New Issue
Block a user