File indexing completed on 2024-05-19 04:26:11
0001 /* 0002 * SPDX-FileCopyrightText: 2010 Boudewijn Rempt <boud@valdyas.org> 0003 * SPDX-FileCopyrightText: 2010 Dmitry Kazakov <dimula73@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 #ifndef KIS_DEFAULT_BOUNDS_BASE_H 0008 #define KIS_DEFAULT_BOUNDS_BASE_H 0009 0010 #include <QRect> 0011 #include "kis_shared.h" 0012 #include "kis_shared_ptr.h" 0013 #include "kritaimage_export.h" 0014 #include "KisWraparoundAxis.h" 0015 class KisDefaultBoundsBase; 0016 0017 typedef KisSharedPtr<KisDefaultBoundsBase> KisDefaultBoundsBaseSP; 0018 0019 class KRITAIMAGE_EXPORT KisDefaultBoundsBase : public KisShared 0020 { 0021 public: 0022 virtual ~KisDefaultBoundsBase(); 0023 0024 /** 0025 * Returns a virtual bounding rect of a paint device. E.g. when a 0026 * paint device has non-transparent default pixel, its virtual bounds 0027 * extend much wider than the actual data it contains. 0028 * 0029 * This bounds rectangle should be used in all the cases when 0030 * one wants to process all the non-existing pixels with default 0031 * value, which may still be visible to the user. 0032 * 0033 * The returned rect usually equals to the bounds of the image, 0034 * except of a few special cases for selections. 0035 * 0036 * Example: 0037 * 0038 * KisPaintDevice adds `defaultBounds->bounds()` to its `extent()` 0039 * and `exactBounds()` when its default pixel is non-transparent. 0040 */ 0041 virtual QRect bounds() const = 0; 0042 0043 /** 0044 * Returns the rectangle of the official image size. This rect is 0045 * used for wrapping the device in wrap-around mode and in some 0046 * specific operations. 0047 * 0048 * NOTE: don't use it unless you know what you are doing, 0049 * most probably you want to use `bounds()` instead! 0050 */ 0051 virtual QRect imageBorderRect() const; 0052 0053 virtual bool wrapAroundMode() const = 0; 0054 virtual WrapAroundAxis wrapAroundModeAxis() const = 0; 0055 virtual int currentLevelOfDetail() const = 0; 0056 virtual int currentTime() const = 0; 0057 virtual bool externalFrameActive() const = 0; 0058 0059 /** 0060 * Return an abstract pointer to the source object, 0061 * where default bounds takes its data from. It the 0062 * cookie is nullptr, then the default bounds is not 0063 * connected to anything. One can also compare if two 0064 * default bounds are connected to the same source by 0065 * comparing two pointers. 0066 * 0067 * NOTE: It is intended to be used for debugging 0068 * purposes only! 0069 */ 0070 virtual void* sourceCookie() const = 0; 0071 }; 0072 0073 0074 #endif // KIS_DEFAULT_BOUNDS_BASE_H