1 #pragma once 2 3 #ifndef TVECTORRENDERDATA_H 4 #define TVECTORRENDERDATA_H 5 6 // TnzCore includes 7 #include "tgeometry.h" 8 #include "tpixel.h" 9 10 #undef DVAPI 11 #undef DVVAR 12 #ifdef TVRENDER_EXPORTS 13 #define DVAPI DV_EXPORT_API 14 #define DVVAR DV_EXPORT_VAR 15 #else 16 #define DVAPI DV_IMPORT_API 17 #define DVVAR DV_IMPORT_VAR 18 #endif 19 20 //======================================================================== 21 22 // Forward declarations 23 24 class TPalette; 25 class TColorFunction; 26 27 //======================================================================== 28 29 //********************************************************************************** 30 // TVectorRenderData definition 31 //********************************************************************************** 32 33 /*! 34 \brief Stores parameters for rendering vector images in Toonz. 35 */ 36 37 class DVAPI TVectorRenderData { 38 public: 39 /*! \brief Tag representing default settings for work-quality rendering 40 to be displayed on Toonz widgets. */ 41 42 struct ViewerSettings {}; 43 44 /*! \brief Tag representing default settings for production-quality 45 rendering to be stored on image files. */ 46 47 struct ProductionSettings {}; 48 49 public: 50 const TColorFunction 51 *m_cf; //!< [\p not-owned] Transform to be used for drawing RGBM colors. 52 const TColorFunction *m_guidedCf; 53 const TPalette *m_palette; //!< [\p not-owned] Palette to be used for 54 //! translating color indexes to 55 //! RGBM colors. 56 TAffine m_aff; //!< Geometric transform to be applied on image rendering. 57 58 TRect m_clippingRect; //!< Integral rect where the image drawing will be 59 //! restricted on; 60 //! if empty, clipping is assumed to be disabled. 61 //! \internal Coordinates reference? 62 TPixel m_tCheckInk; //!< Color to be used for <I>ink check</I> mode. 63 TPixel m_tCheckPaint; //!< Color to be used for <I>paint check</I> mode. 64 65 int m_colorCheckIndex; //!< Color index to be highlighted in <I>color 66 //! check</I> mode. 67 int m_indexToHighlight; // for guided vector drawing 68 69 bool m_alphaChannel, //!< Whether alpha channel is enabled. 70 m_antiAliasing, //!< Whether antialiasing must be applied. 71 m_isImagePattern, //!< \internal Seems like a bad bug-patch - inquire 72 //! further... 73 m_drawRegions, //!< Inks only mode. 74 m_tcheckEnabled, //!< Transparency check mode. 75 m_inkCheckEnabled, //!< Ink check mode. 76 m_ink1CheckEnabled, //!< Ink #1 check mode. 77 m_paintCheckEnabled, //!< Paint check mode. 78 m_blackBgEnabled, //!< Black background mode. 79 m_isIcon, //!< Whether image rendering is for an icon. 80 m_is3dView, //!< Whether image rendering is in 3D mode. 81 m_show0ThickStrokes, //!< Whether strokes with 0 thickness should be 82 //! rendered anyway. 83 m_regionAntialias, //!< Whether regions should be rendered with 84 //! antialiasing at boundaries. 85 m_isOfflineRender, //!< Whether image rendering is in render or 86 //! camera-stand (preview) mode. 87 m_showGuidedDrawing, // Whether this image is being used for guided 88 // drawing 89 m_highLightNow; // Show highlight on active stroke 90 bool m_animatedGuidedDrawing = false; 91 //! \deprecated Use the above individual options instead. 92 //! \todo Remove it ASAP. 93 public: 94 TVectorRenderData(ViewerSettings, const TAffine &aff, 95 const TRect &clippingRect, const TPalette *palette, 96 const TColorFunction *cf = 0) m_cf(cf)97 : m_cf(cf) 98 , m_palette(palette) 99 , m_aff(aff) 100 , m_clippingRect(clippingRect) 101 , m_tCheckInk(TPixel::Black) 102 , m_tCheckPaint(TPixel(128, 128, 128)) 103 , m_colorCheckIndex(-1) 104 , m_alphaChannel( 105 false) // Camera stand-like widgets have opaque background 106 , m_antiAliasing( 107 true) // Jaggy-free pretty images, antialias is not that costly 108 , m_isImagePattern(false) // Patch variable - internal use 109 , m_drawRegions(true) // Paint regions painted 110 , m_tcheckEnabled(false) // No checks 111 , m_inkCheckEnabled(false) 112 , m_ink1CheckEnabled(false) 113 , m_paintCheckEnabled(false) 114 , m_blackBgEnabled(false) 115 , m_isIcon(false) // Not an icon by default 116 , m_is3dView(false) // Standard view by default 117 , m_show0ThickStrokes( 118 true) // Wanna see every stroke, even invisible ones 119 , m_regionAntialias(false) // No need for pretty region boundaries, 120 // typically shadowed by strokes 121 // This is also related to interference with the directly above param 122 , m_isOfflineRender(false) // By definition 123 , m_indexToHighlight(-1) 124 , m_highLightNow(false) 125 , m_guidedCf(0) 126 , m_showGuidedDrawing(false) {} 127 128 TVectorRenderData(ProductionSettings, const TAffine &aff, 129 const TRect &clippingRect, const TPalette *palette, 130 const TColorFunction *cf = 0) m_cf(cf)131 : m_cf(cf) 132 , m_palette(palette) 133 , m_aff(aff) 134 , m_clippingRect(clippingRect) 135 , m_tCheckInk(TPixel::Black) 136 , m_tCheckPaint(TPixel(128, 128, 128)) 137 , m_colorCheckIndex(-1) 138 , m_alphaChannel( 139 true) // No opaque background - freestanding images with alpha 140 , m_antiAliasing(true) // Jaggy-free pretty images 141 , m_isImagePattern(false) // Patch variable - internal use 142 , m_drawRegions(true) // Paint regions painted 143 , m_tcheckEnabled(false) // No checks 144 , m_inkCheckEnabled(false) 145 , m_ink1CheckEnabled(false) 146 , m_paintCheckEnabled(false) 147 , m_blackBgEnabled(false) 148 , m_isIcon(false) // Not an icon by default 149 , m_is3dView(false) // Definitely standard view 150 , m_show0ThickStrokes(false) // Invisible strokes must be invisible 151 , m_regionAntialias(true) // Pretty region boundaries under invisible or 152 // semitransparent strokes 153 , m_isOfflineRender(true) // By definition 154 , m_indexToHighlight(-1) 155 , m_highLightNow(false) 156 , m_guidedCf(0) 157 , m_showGuidedDrawing(false) {} 158 159 TVectorRenderData(const TVectorRenderData &other, const TAffine &aff, 160 const TRect &clippingRect, const TPalette *palette, 161 const TColorFunction *cf = 0) m_cf(cf)162 : m_cf(cf) 163 , m_palette(palette) 164 , m_aff(aff) 165 , m_clippingRect(clippingRect) 166 , m_tCheckInk(other.m_tCheckInk) 167 , m_tCheckPaint(other.m_tCheckPaint) 168 , m_colorCheckIndex(other.m_colorCheckIndex) 169 , m_alphaChannel(other.m_alphaChannel) 170 , m_antiAliasing(other.m_antiAliasing) 171 , m_isImagePattern(other.m_isImagePattern) 172 , m_drawRegions(other.m_drawRegions) 173 , m_tcheckEnabled(other.m_tcheckEnabled) 174 , m_inkCheckEnabled(other.m_inkCheckEnabled) 175 , m_ink1CheckEnabled(other.m_ink1CheckEnabled) 176 , m_paintCheckEnabled(other.m_paintCheckEnabled) 177 , m_blackBgEnabled(other.m_blackBgEnabled) 178 , m_isIcon(other.m_isIcon) 179 , m_is3dView(other.m_is3dView) 180 , m_show0ThickStrokes(other.m_show0ThickStrokes) 181 , m_regionAntialias(other.m_regionAntialias) 182 , m_isOfflineRender(other.m_isOfflineRender) 183 , m_indexToHighlight(other.m_indexToHighlight) 184 , m_highLightNow(other.m_highLightNow) 185 , m_guidedCf(other.m_guidedCf) 186 , m_showGuidedDrawing(other.m_showGuidedDrawing) { 187 } //!< Constructs from explicit primary context settings while 188 //! copying the rest from another instance. 189 190 TVectorRenderData(const TAffine &aff, const TRect &clippingRect, 191 const TPalette *palette, const TColorFunction *cf, 192 bool alphaChannel = false, bool antiAliasing = true, 193 bool is3dView = false) m_cf(cf)194 : m_cf(cf) 195 , m_palette(palette) 196 , m_aff(aff) 197 , m_clippingRect(clippingRect) 198 , m_tCheckInk(TPixel::Black) 199 , m_tCheckPaint(TPixel(128, 128, 128)) 200 , m_colorCheckIndex(-1) 201 , m_alphaChannel(alphaChannel) 202 , m_antiAliasing(antiAliasing) 203 , m_isImagePattern(false) 204 , m_drawRegions(true) 205 , m_tcheckEnabled(false) 206 , m_inkCheckEnabled(false) 207 , m_ink1CheckEnabled(false) 208 , m_paintCheckEnabled(false) 209 , m_blackBgEnabled(false) 210 , m_isIcon(false) 211 , m_is3dView(is3dView) 212 , m_show0ThickStrokes(true) 213 , m_regionAntialias(false) 214 , m_isOfflineRender(false) 215 , m_indexToHighlight(-1) 216 , m_highLightNow(false) 217 , m_guidedCf(0) 218 , m_showGuidedDrawing(false) { 219 } //!< Constructs settings with default ViewerSettings. 220 //! \deprecated Use constructors with explicit settings type tag. 221 }; 222 223 #endif // TVECTORRENDERDATA_H 224