File indexing completed on 2024-05-12 15:58:14
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 class KisDefaultBoundsBase; 0015 0016 typedef KisSharedPtr<KisDefaultBoundsBase> KisDefaultBoundsBaseSP; 0017 0018 class KRITAIMAGE_EXPORT KisDefaultBoundsBase : public KisShared 0019 { 0020 public: 0021 virtual ~KisDefaultBoundsBase(); 0022 0023 /** 0024 * Returns a virtual bounding rect of a paint device. E.g. when a 0025 * paint device has non-transparent default pixel, its virtual bounds 0026 * extend much wider than the actual data it contains. 0027 * 0028 * This bounds rectangle should be used in all the cases when 0029 * one wants to process all the non-existing pixels with default 0030 * value, which may still be visible to the user. 0031 * 0032 * The returned rect usually equals to the bounds of the image, 0033 * except of a few special cases for selections. 0034 * 0035 * Example: 0036 * 0037 * KisPaintDevice adds `defaultBounds->bounds()` to its `extent()` 0038 * and `exactBounds()` when its default pixel is non-transparent. 0039 */ 0040 virtual QRect bounds() const = 0; 0041 0042 /** 0043 * Returns the rectangle of the official image size. This rect is 0044 * used for wrapping the device in wrap-around mode and in some 0045 * specific operations. 0046 * 0047 * NOTE: don't use it uless you know what you are doing, 0048 * most probably you want to use `bounds()` instead! 0049 */ 0050 virtual QRect imageBorderRect() const; 0051 0052 virtual bool wrapAroundMode() const = 0; 0053 virtual int currentLevelOfDetail() const = 0; 0054 virtual int currentTime() const = 0; 0055 virtual bool externalFrameActive() const = 0; 0056 0057 /** 0058 * Return an abstract pointer to the source object, 0059 * where default bounds takes its data from. It the 0060 * cookie is nullptr, then the default bounds is not 0061 * connected to anything. One can also compare if two 0062 * default bounds are connected to the same source by 0063 * comparing two pointers. 0064 * 0065 * NOTE: It is intended to be used for debugging 0066 * purposes only! 0067 */ 0068 virtual void* sourceCookie() const = 0; 0069 }; 0070 0071 0072 #endif // KIS_DEFAULT_BOUNDS_BASE_H