1 /* 2 * Copyright (c) 2016 Eugene Ingerman geneing at gmail dot com 3 * Copyright (c) 2020 Dmitry Kazakov <dimula73@gmail.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef OVERVIEWTHUMBNAILSTROKESTRATEGY_H 21 #define OVERVIEWTHUMBNAILSTROKESTRATEGY_H 22 23 #include <QObject> 24 #include <QRect> 25 #include <QSize> 26 #include <QImage> 27 28 #include <KoColorConversionTransformation.h> 29 #include "kis_types.h" 30 #include "kis_simple_stroke_strategy.h" 31 32 class KoColorProfile; 33 34 35 class OverviewThumbnailStrokeStrategy : public QObject, public KisSimpleStrokeStrategy 36 { 37 Q_OBJECT 38 public: 39 OverviewThumbnailStrokeStrategy(KisPaintDeviceSP device, 40 const QRect& rect, 41 const QSize& thumbnailSize, 42 bool isPixelArt, 43 const KoColorProfile *profile, 44 KoColorConversionTransformation::Intent renderingIntent, 45 KoColorConversionTransformation::ConversionFlags conversionFlags); 46 ~OverviewThumbnailStrokeStrategy() override; 47 48 KisStrokeStrategy* createLodClone(int levelOfDetail) override; 49 50 private: 51 void initStrokeCallback() override; 52 void doStrokeCallback(KisStrokeJobData *data) override; 53 void finishStrokeCallback() override; 54 void cancelStrokeCallback() override; 55 56 Q_SIGNALS: 57 //Emitted when thumbnail is updated and overviewImage is fully generated. 58 void thumbnailUpdated(QImage pixmap); 59 60 61 private: 62 class ProcessData; 63 64 KisPaintDeviceSP m_device; 65 QRect m_rect; 66 QSize m_thumbnailSize; 67 QSize m_thumbnailOversampledSize; 68 bool m_isPixelArt {false}; 69 KisPaintDeviceSP m_thumbnailDevice; 70 71 const KoColorProfile *m_profile; 72 KoColorConversionTransformation::Intent m_renderingIntent; 73 KoColorConversionTransformation::ConversionFlags m_conversionFlags; 74 }; 75 76 #endif // OVERVIEWTHUMBNAILSTROKESTRATEGY_H 77