Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TVECTORRENDERDATA_H
Toshihiro Shimizu 890ddd
#define TVECTORRENDERDATA_H
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tgeometry.h"
Toshihiro Shimizu 890ddd
#include "tpixel.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TVRENDER_EXPORTS
Toshihiro Shimizu 890ddd
#define DVAPI DV_EXPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_EXPORT_VAR
Toshihiro Shimizu 890ddd
#else
Toshihiro Shimizu 890ddd
#define DVAPI DV_IMPORT_API
Toshihiro Shimizu 890ddd
#define DVVAR DV_IMPORT_VAR
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//========================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//    Forward declarations
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class TPalette;
Toshihiro Shimizu 890ddd
class TColorFunction;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//========================================================================
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
//    TVectorRenderData  definition
Toshihiro Shimizu 890ddd
//**********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  \brief    Stores parameters for rendering vector images in Toonz.
Toshihiro Shimizu 890ddd
*/
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
class DVAPI TVectorRenderData
Toshihiro Shimizu 890ddd
{
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	/*! \brief  Tag representing default settings for work-quality rendering
Toshihiro Shimizu 890ddd
              to be displayed on Toonz widgets.                                     */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	struct ViewerSettings {
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	/*! \brief  Tag representing default settings for production-quality
Toshihiro Shimizu 890ddd
              rendering to be stored on image files.                                */
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	struct ProductionSettings {
Toshihiro Shimizu 890ddd
	};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	const TColorFunction *m_cf; //!< [\p not-owned] Transform to be used for drawing RGBM colors.
Toshihiro Shimizu 890ddd
	const TPalette *m_palette;  //!< [\p not-owned] Palette to be used for translating color indexes to
Toshihiro Shimizu 890ddd
								//!                 RGBM colors.
Toshihiro Shimizu 890ddd
	TAffine m_aff;				//!< Geometric transform to be applied on image rendering.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TRect m_clippingRect; //!< Integral rect where the image drawing will be restricted on;
Toshihiro Shimizu 890ddd
						  //!  if empty, clipping is assumed to be disabled.
Toshihiro Shimizu 890ddd
						  //!  \internal  Coordinates reference?
Toshihiro Shimizu 890ddd
	TPixel m_tCheckInk;   //!< Color to be used for ink check mode.
Toshihiro Shimizu 890ddd
	TPixel m_tCheckPaint; //!< Color to be used for paint check mode.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	int m_colorCheckIndex; //!< Color index to be highlighted in color check mode.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	bool m_alphaChannel,	 //!< Whether alpha channel is enabled.
Toshihiro Shimizu 890ddd
		m_antiAliasing,		 //!< Whether antialiasing must be applied.
Toshihiro Shimizu 890ddd
		m_isImagePattern,	//!< \internal  Seems like a bad bug-patch - inquire further...
Toshihiro Shimizu 890ddd
		m_drawRegions,		 //!< Inks only mode.
Toshihiro Shimizu 890ddd
		m_tcheckEnabled,	 //!< Transparency check mode.
Toshihiro Shimizu 890ddd
		m_inkCheckEnabled,   //!< Ink check mode.
Toshihiro Shimizu 890ddd
		m_paintCheckEnabled, //!< Paint check mode.
Toshihiro Shimizu 890ddd
		m_blackBgEnabled,	//!< Black background mode.
Toshihiro Shimizu 890ddd
		m_isIcon,			 //!< Whether image rendering is for an icon.
Toshihiro Shimizu 890ddd
		m_is3dView,			 //!< Whether image rendering is in 3D mode.
Toshihiro Shimizu 890ddd
		m_show0ThickStrokes, //!< Whether strokes with 0 thickness should be rendered anyway.
Toshihiro Shimizu 890ddd
		m_regionAntialias,   //!< Whether regions should be rendered with antialiasing at boundaries.
Toshihiro Shimizu 890ddd
		m_isOfflineRender;   //!< Whether image rendering is in render or camera-stand (preview) mode.
Toshihiro Shimizu 890ddd
							 //!  \deprecated  Use the above individual options instead.
Toshihiro Shimizu 890ddd
							 //!  \todo  Remove it ASAP.
Toshihiro Shimizu 890ddd
public:
Toshihiro Shimizu 890ddd
	TVectorRenderData(ViewerSettings,
Toshihiro Shimizu 890ddd
					  const TAffine &aff,
Toshihiro Shimizu 890ddd
					  const TRect &clippingRect,
Toshihiro Shimizu 890ddd
					  const TPalette *palette,
Toshihiro Shimizu 890ddd
					  const TColorFunction *cf = 0)
Toshihiro Shimizu 890ddd
		: m_cf(cf), m_palette(palette), m_aff(aff), m_clippingRect(clippingRect), m_tCheckInk(TPixel::Black), m_tCheckPaint(TPixel(128, 128, 128)), m_colorCheckIndex(-1), m_alphaChannel(false) // Camera stand-like widgets have opaque background
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_antiAliasing(true) // Jaggy-free pretty images, antialias is not that costly
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_isImagePattern(false) // Patch variable - internal use
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_drawRegions(true) // Paint regions painted
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_tcheckEnabled(false) // No checks
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_inkCheckEnabled(false), m_paintCheckEnabled(false), m_blackBgEnabled(false), m_isIcon(false) // Not an icon by default
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_is3dView(false) // Standard view by default
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_show0ThickStrokes(true) // Wanna see every stroke, even invisible ones
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_regionAntialias(false) // No need for pretty region boundaries, typically shadowed by strokes
Toshihiro Shimizu 890ddd
								   // This is also related to interference with the directly above param
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_isOfflineRender(false)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	} // By definition
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TVectorRenderData(ProductionSettings,
Toshihiro Shimizu 890ddd
					  const TAffine &aff,
Toshihiro Shimizu 890ddd
					  const TRect &clippingRect,
Toshihiro Shimizu 890ddd
					  const TPalette *palette,
Toshihiro Shimizu 890ddd
					  const TColorFunction *cf = 0)
Toshihiro Shimizu 890ddd
		: m_cf(cf), m_palette(palette), m_aff(aff), m_clippingRect(clippingRect), m_tCheckInk(TPixel::Black), m_tCheckPaint(TPixel(128, 128, 128)), m_colorCheckIndex(-1), m_alphaChannel(true) // No opaque background - freestanding images with alpha
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_antiAliasing(true) // Jaggy-free pretty images
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_isImagePattern(false) // Patch variable - internal use
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_drawRegions(true) // Paint regions painted
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_tcheckEnabled(false) // No checks
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_inkCheckEnabled(false), m_paintCheckEnabled(false), m_blackBgEnabled(false), m_isIcon(false) // Not an icon by default
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_is3dView(false) // Definitely standard view
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_show0ThickStrokes(false) // Invisible strokes must be invisible
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_regionAntialias(true) // Pretty region boundaries under invisible or
Toshihiro Shimizu 890ddd
								  // semitransparent strokes
Toshihiro Shimizu 890ddd
		  ,
Toshihiro Shimizu 890ddd
		  m_isOfflineRender(true)
Toshihiro Shimizu 890ddd
	{
Toshihiro Shimizu 890ddd
	} // By definition
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TVectorRenderData(const TVectorRenderData &other,
Toshihiro Shimizu 890ddd
					  const TAffine &aff,
Toshihiro Shimizu 890ddd
					  const TRect &clippingRect,
Toshihiro Shimizu 890ddd
					  const TPalette *palette,
Toshihiro Shimizu 890ddd
					  const TColorFunction *cf = 0)
Toshihiro Shimizu 890ddd
		: m_cf(cf), m_palette(palette), m_aff(aff), m_clippingRect(clippingRect), m_tCheckInk(other.m_tCheckInk), m_tCheckPaint(other.m_tCheckPaint), m_colorCheckIndex(other.m_colorCheckIndex), m_alphaChannel(other.m_alphaChannel), m_antiAliasing(other.m_antiAliasing), m_isImagePattern(other.m_isImagePattern), m_drawRegions(other.m_drawRegions), m_tcheckEnabled(other.m_tcheckEnabled), m_inkCheckEnabled(other.m_inkCheckEnabled), m_paintCheckEnabled(other.m_paintCheckEnabled), m_blackBgEnabled(other.m_blackBgEnabled), m_isIcon(other.m_isIcon), m_is3dView(other.m_is3dView), m_show0ThickStrokes(other.m_show0ThickStrokes), m_regionAntialias(other.m_regionAntialias), m_isOfflineRender(other.m_isOfflineRender) {} //!< Constructs from explicit primary context settings while
Toshihiro Shimizu 890ddd
																																																																																																																																																																																			//!  copying the rest from another instance.
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
	TVectorRenderData(const TAffine &aff,
Toshihiro Shimizu 890ddd
					  const TRect &clippingRect,
Toshihiro Shimizu 890ddd
					  const TPalette *palette,
Toshihiro Shimizu 890ddd
					  const TColorFunction *cf,
Toshihiro Shimizu 890ddd
					  bool alphaChannel = false,
Toshihiro Shimizu 890ddd
					  bool antiAliasing = true,
Toshihiro Shimizu 890ddd
					  bool is3dView = false)
Toshihiro Shimizu 890ddd
		: m_cf(cf), m_palette(palette), m_aff(aff), m_clippingRect(clippingRect), m_tCheckInk(TPixel::Black), m_tCheckPaint(TPixel(128, 128, 128)), m_colorCheckIndex(-1), m_alphaChannel(alphaChannel), m_antiAliasing(antiAliasing), m_isImagePattern(false), m_drawRegions(true), m_tcheckEnabled(false), m_inkCheckEnabled(false), m_paintCheckEnabled(false), m_blackBgEnabled(false), m_isIcon(false), m_is3dView(is3dView), m_show0ThickStrokes(true), m_regionAntialias(false), m_isOfflineRender(false) {} //!< Constructs settings with default ViewerSettings.
Toshihiro Shimizu 890ddd
																																																																																																																													//!  \deprecated   Use constructors with explicit settings type tag.
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#endif // TVECTORRENDERDATA_H