-
Notifications
You must be signed in to change notification settings - Fork 29
/
imagegenerator.hpp
82 lines (68 loc) · 2.93 KB
/
imagegenerator.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***************************************************************************
//
// softProjector - an open source media projection software
// Copyright (C) 2017 Vladislav Kobzar
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation version 3 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
***************************************************************************/
#ifndef IMAGEGENERATOR_HPP
#define IMAGEGENERATOR_HPP
#include <QPixmap>
#include <QPainter>
#include <QGraphicsBlurEffect>
#include <QGraphicsScene>
#include <QGraphicsPixmapItem>
#include <settings.hpp>
#include <displaysetting.hpp>
#include <bible.hpp>
#include <song.hpp>
#include <announcement.hpp>
class ImageGenerator
{
public:
ImageGenerator();
void setScreenSize(QSize size);
QSize getScreenSize();
QPixmap generateEmptyImage();
QPixmap generateColorImage(QColor &color);
QPixmap generateBibleImage(Verse verse, BibleSettings &bSets);
QPixmap generateSongImage(Stanza stanza, SongSettings &sSets);
QPixmap generateAnnounceImage(AnnounceSlide announce, TextSettings &aSets);
int width();
int height();
private:
QSize m_screenSize;
bool m_shadow, m_blurShadow, m_isTextPrepared, m_bibleAddBKColorToText, m_songAddBKColorToText, m_announcementAddBKColorToText;
int m_type; // 0 = empty, 1 = bible, 2 = song, 3 = announce
int m_shadowOffset, m_blurRadius;
QColor m_bibleTextRecBKColor, m_bibleTextGenBKColor, m_songTextRecBKColor, m_songTextGenBKColor, m_announcementTextRecBKColor, m_announcementTextGenBKColor;
Verse m_verse;
BibleSettings m_bSets;
BibleDisplaySettings m_bdSets;
Stanza m_stanza;
SongSettings m_sSets;
SongDisplaySettings m_sdSets;
AnnounceSlide m_announce;
TextSettings m_aSets;
AnnounceDisplaySettings m_adSets;
QPixmap renderText();
QRect boundRectOrDrawText(QPainter *painter, bool draw, int left, int top, int width, int height, int flags, QString text);
void drawBibleText(QPainter *painter, bool isShadow);
void drawBibleTextToRect(QPainter *painter, QRect& trect, QRect& crect, QString ttext, QString ctext, int tflags, int cflags, int top, int left, int width, int height);
void drawSongText(QPainter *painter, bool isShadow);
void drawAnnounceText(QPainter *painter, bool isShadow);
// void fastbluralpha(QImage &img, int radius);
QPixmap applyEffectToImage(QPixmap src, QGraphicsEffect *effect);
};
#endif // IMAGEGENERATOR_HPP