File indexing completed on 2025-01-05 03:57:25
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2017-05-24 0007 * Description : images transition 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 "transitionmngr_p.h" 0016 0017 namespace Digikam 0018 { 0019 0020 int TransitionMngr::Private::transitionSlideL2R(bool aInit) 0021 { 0022 if (aInit) 0023 { 0024 eff_fx = eff_outSize.width() / 25.0; 0025 eff_i = 0; 0026 } 0027 0028 QPainter bufferPainter(&eff_curFrame); 0029 bufferPainter.drawImage(0, 0, eff_outImage); 0030 bufferPainter.drawImage(eff_i, 0, eff_inImage); 0031 bufferPainter.end(); 0032 0033 eff_i = eff_i + lround(eff_fx); 0034 0035 if (eff_i <= eff_outSize.width()) 0036 { 0037 return 15; 0038 } 0039 0040 eff_curFrame = eff_outImage; 0041 0042 return -1; 0043 } 0044 0045 int TransitionMngr::Private::transitionSlideR2L(bool aInit) 0046 { 0047 if (aInit) 0048 { 0049 eff_fx = eff_outSize.width() / 25.0; 0050 eff_i = 0; 0051 } 0052 0053 QPainter bufferPainter(&eff_curFrame); 0054 bufferPainter.drawImage(0, 0, eff_outImage); 0055 bufferPainter.drawImage(eff_i, 0, eff_inImage); 0056 bufferPainter.end(); 0057 0058 eff_i = eff_i - lround(eff_fx); 0059 0060 if (eff_i >= -eff_outSize.width()) 0061 { 0062 return 15; 0063 } 0064 0065 eff_curFrame = eff_outImage; 0066 0067 return -1; 0068 } 0069 0070 int TransitionMngr::Private::transitionSlideT2B(bool aInit) 0071 { 0072 if (aInit) 0073 { 0074 eff_fy = eff_outSize.height() / 25.0; 0075 eff_i = 0; 0076 } 0077 0078 QPainter bufferPainter(&eff_curFrame); 0079 bufferPainter.drawImage(0, 0, eff_outImage); 0080 bufferPainter.drawImage(0, eff_i, eff_inImage); 0081 bufferPainter.end(); 0082 0083 eff_i = eff_i + lround(eff_fy); 0084 0085 if (eff_i <= eff_outSize.height()) 0086 { 0087 return 15; 0088 } 0089 0090 eff_curFrame = eff_outImage; 0091 0092 return -1; 0093 } 0094 0095 int TransitionMngr::Private::transitionSlideB2T(bool aInit) 0096 { 0097 if (aInit) 0098 { 0099 eff_fy = eff_outSize.height() / 25.0; 0100 eff_i = 0; 0101 } 0102 0103 QPainter bufferPainter(&eff_curFrame); 0104 bufferPainter.drawImage(0, 0, eff_outImage); 0105 bufferPainter.drawImage(0, eff_i, eff_inImage); 0106 bufferPainter.end(); 0107 0108 eff_i = eff_i - lround(eff_fy); 0109 0110 if (eff_i >= -eff_outSize.height()) 0111 { 0112 return 15; 0113 } 0114 0115 eff_curFrame = eff_outImage; 0116 0117 return -1; 0118 } 0119 0120 } // namespace Digikam