File indexing completed on 2025-01-05 03:57:24
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-05-24 0007 * Description : video frame effects manager. 0008 * 0009 * SPDX-FileCopyrightText: 2017-2024 by Gilles Caulier <caulier dot gilles at gmail dot com> 0010 * 0011 * SPDX-License-Identifier: GPL-2.0-or-later 0012 * 0013 * ============================================================ */ 0014 0015 #include "effectmngr_p.h" 0016 0017 // Qt includes 0018 0019 #include <QRandomGenerator> 0020 0021 namespace Digikam 0022 { 0023 0024 void EffectMngr::Private::registerEffects() 0025 { 0026 eff_effectList.insert(EffectMngr::None, &EffectMngr::Private::effectNone); 0027 eff_effectList.insert(EffectMngr::KenBurnsZoomIn, &EffectMngr::Private::effectKenBurnsZoomIn); 0028 eff_effectList.insert(EffectMngr::KenBurnsZoomOut, &EffectMngr::Private::effectKenBurnsZoomOut); 0029 eff_effectList.insert(EffectMngr::KenBurnsPanLR, &EffectMngr::Private::effectKenBurnsPanLR); 0030 eff_effectList.insert(EffectMngr::KenBurnsPanRL, &EffectMngr::Private::effectKenBurnsPanRL); 0031 eff_effectList.insert(EffectMngr::KenBurnsPanTB, &EffectMngr::Private::effectKenBurnsPanTB); 0032 eff_effectList.insert(EffectMngr::KenBurnsPanBT, &EffectMngr::Private::effectKenBurnsPanBT); 0033 } 0034 0035 EffectMngr::EffectType EffectMngr::Private::getRandomEffect() const 0036 { 0037 QList<EffectMngr::EffectType> effs = eff_effectList.keys(); 0038 effs.removeAt(effs.indexOf(EffectMngr::None)); 0039 0040 int i = QRandomGenerator::global()->bounded(effs.count()); 0041 0042 return effs[i]; 0043 } 0044 0045 void EffectMngr::Private::updateCurrentFrame(const QRectF& area) 0046 { 0047 QImage kbImg = eff_image.copy(area.toAlignedRect()) 0048 .scaled(eff_outSize, 0049 Qt::KeepAspectRatioByExpanding, 0050 Qt::SmoothTransformation); 0051 eff_curFrame = kbImg.convertToFormat(QImage::Format_ARGB32); 0052 } 0053 0054 int EffectMngr::Private::effectRandom(bool /*aInit*/) 0055 { 0056 return -1; 0057 } 0058 0059 int EffectMngr::Private::effectNone(bool) 0060 { 0061 eff_curFrame = eff_image; 0062 0063 return -1; 0064 } 0065 0066 } // namespace Digikam