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