tahoma2d/toonz/sources/include/tregionprop.h

94 lines
2.1 KiB
C
Raw Normal View History

2016-05-17 03:04:11 +12:00
#pragma once
2016-03-19 06:57:51 +13:00
#ifndef TREGIONPROP_H
#define TREGIONPROP_H
#include "tgeometry.h"
#include "tregionoutline.h"
#include "tsimplecolorstyles.h"
#undef DVAPI
#undef DVVAR
#ifdef TVRENDER_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
//============================================================================//
2016-06-15 18:43:10 +12:00
// forward declarations
2016-03-19 06:57:51 +13:00
class TColorStyle;
class TRegion;
class TVectorRenderData;
class TInputStreamInterface;
class TOutputStreamInterface;
template <class T>
class TRasterPT;
class TPixelRGBM32;
typedef TPixelRGBM32 TPixel32;
typedef TRasterPT<TPixel32> TRaster32P;
//============================================================================//
2016-06-15 18:43:10 +12:00
// TRegionProp //
2016-03-19 06:57:51 +13:00
//============================================================================//
2016-06-15 18:43:10 +12:00
class TRegionProp {
const TRegion *const m_region;
2016-03-19 06:57:51 +13:00
protected:
2016-06-15 18:43:10 +12:00
bool m_regionChanged;
int m_styleVersionNumber;
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
TRegionProp(const TRegion *region);
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual ~TRegionProp() {}
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
//! Note: update internal data if isRegionChanged()
virtual void draw(const TVectorRenderData &rd) = 0;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
const TRegion *getRegion() const { return m_region; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual const TColorStyle *getColorStyle() const = 0;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual void notifyRegionChange() { m_regionChanged = true; }
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
virtual TRegionProp *clone(const TRegion *region) const = 0;
2016-03-19 06:57:51 +13:00
private:
2016-06-15 18:43:10 +12:00
// not implemented
TRegionProp(const TRegionProp &);
TRegionProp &operator=(const TRegionProp &);
2016-03-19 06:57:51 +13:00
};
//-------------------------------------------------------------------
class OutlineRegionProp final : public TRegionProp {
2016-06-15 18:43:10 +12:00
double m_pixelSize;
TOutlineStyleP m_colorStyle;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
TRegionOutline m_outline;
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
//-------------------------------------------------------------------
2016-03-19 06:57:51 +13:00
2016-06-15 18:43:10 +12:00
void computeRegionOutline();
2016-03-19 06:57:51 +13:00
public:
2016-06-15 18:43:10 +12:00
OutlineRegionProp(const TRegion *region, const TOutlineStyleP regionStyle);
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
void draw(const TVectorRenderData &rd) override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
const TColorStyle *getColorStyle() const override;
2016-03-19 06:57:51 +13:00
2016-06-19 20:06:29 +12:00
TRegionProp *clone(const TRegion *region) const override;
2016-03-19 06:57:51 +13:00
};
#endif