1 #pragma once 2 3 #ifndef IMAGEPAINTER_H 4 #define IMAGEPAINTER_H 5 6 // TnzCore includes 7 #include "tgeometry.h" 8 #include "timage.h" 9 #include "tpixel.h" 10 #include "ttoonzimage.h" 11 12 // TnzExt includes 13 #include "ext/plasticvisualsettings.h" 14 15 #undef DVAPI 16 #undef DVVAR 17 #ifdef TOONZLIB_EXPORTS 18 #define DVAPI DV_EXPORT_API 19 #define DVVAR DV_EXPORT_VAR 20 #else 21 #define DVAPI DV_IMPORT_API 22 #define DVVAR DV_IMPORT_VAR 23 #endif 24 25 //=========================================================================== 26 27 // Forward declaration 28 29 class TSceneProperties; 30 class TSceneProperties; 31 32 //=========================================================================== 33 34 namespace ImagePainter { 35 36 //************************************************************************************************* 37 // ImagePainter::VisualSettings declaration 38 //************************************************************************************************* 39 40 //! Stores generic settings used by Toonz painters to draw images 41 class DVAPI VisualSettings { 42 public: 43 int m_colorMask; //!< Combination of TRop::rChan, gChan, bChan or mChan. 44 //!< Note: 0 means rChan | gChan | bChan (draw all channels). 45 bool m_greytones; //!< Whether color channels are visualized in greytones 46 int m_bg; //!< Can be equal to eBlackBg, or eWhiteBg, or eCheckBg 47 bool m_drawExternalBG; // ... not sure ... 48 bool m_showBBox; //!< Show the bounding box of current level 49 50 TSceneProperties *m_sceneProperties; //!< Scene properties reference - which 51 //! contains further options 52 53 PlasticVisualSettings m_plasticVisualSettings; //!< Settings for mesh images 54 //! and plastic deformations 55 56 // Other (misplaced) misc options 57 58 bool m_doCompare; //!< Whehter must compare between two images 59 bool m_defineLoadbox; //!< Flipbook-specific 60 bool m_useLoadbox; //!< Flipbook-specific 61 62 TPixel32 m_blankColor; //!< The color of blank frames during playback 63 64 bool m_useTexture; //!< Whether should we use OpenGL textures instead of 65 //! drawPixels() 66 bool m_recomputeIfNeeded; 67 bool m_drawBlankFrame; 68 bool m_useChecks; //!< whether to consider paint check and ink check 69 bool m_forSceneIcon = false; // whether it is redered for the scene icons 70 public: 71 VisualSettings(); 72 73 bool needRepaint(const VisualSettings &newVs) const; 74 }; 75 76 //************************************************************************************************* 77 // ImagePainter::VisualSettings declaration 78 //************************************************************************************************* 79 80 //! Stores settings used to compare two images 81 class DVAPI CompareSettings { 82 public: 83 //! Used to set compared image width 84 double m_compareX; 85 //! Used to set compared image height 86 double m_compareY; 87 88 //! Used to change compared image width 89 bool m_dragCompareX; 90 //! Used to change compared image height 91 bool m_dragCompareY; 92 93 //! Used to swap compared images 94 bool m_swapCompared; 95 96 public: 97 CompareSettings(); 98 }; 99 100 const double DefaultCompareValue = 0.01; 101 102 //************************************************************************************************* 103 // ImagePainter global functions 104 //************************************************************************************************* 105 106 DVAPI void paintImage(const TImageP &image, const TDimension &imageSize, 107 const TDimension &viewerSize, const TAffine &aff, 108 const VisualSettings &visualSettings, 109 const CompareSettings &compareSettings, 110 const TRect &loadbox); 111 } 112 113 #endif // IMAGEPAINTER_H 114