| #pragma once |
| |
| #ifndef _TRASTERFX_ |
| #define _TRASTERFX_ |
| |
| |
| #include "tnotanimatableparam.h" |
| |
| |
| #include "tfx.h" |
| #include "trasterfxrenderdata.h" |
| #include <QOffscreenSurface> |
| |
| #undef DVAPI |
| #undef DVVAR |
| #ifdef TFX_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| #ifdef _MSC_VER |
| #pragma warning(disable : 4251) |
| #endif |
| |
| |
| |
| |
| |
| class TFlash; |
| class TPalette; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TRenderSettings { |
| public: |
| |
| enum ResampleQuality { |
| HighResampleQuality = |
| 1, |
| ImprovedResampleQuality = |
| 2, |
| StandardResampleQuality = |
| 3, |
| Triangle_FilterResampleQuality, |
| Mitchell_FilterResampleQuality, |
| Cubic5_FilterResampleQuality, |
| Cubic75_FilterResampleQuality, |
| Cubic1_FilterResampleQuality, |
| Hann2_FilterResampleQuality, |
| Hann3_FilterResampleQuality, |
| Hamming2_FilterResampleQuality, |
| Hamming3_FilterResampleQuality, |
| Lanczos2_FilterResampleQuality, |
| Lanczos3_FilterResampleQuality, |
| Gauss_FilterResampleQuality, |
| ClosestPixel_FilterResampleQuality, |
| Bilinear_FilterResampleQuality |
| }; |
| |
| |
| enum FieldPrevalence { |
| NoField, |
| EvenField, |
| OddField |
| }; |
| |
| public: |
| |
| |
| TAffine m_affine; |
| |
| |
| std::vector<TRasterFxRenderDataP> |
| m_data; |
| |
| TRasterP m_mark; |
| |
| |
| double m_gamma; |
| |
| double m_timeStretchFrom, |
| |
| m_timeStretchTo; |
| |
| double m_stereoscopicShift; |
| |
| |
| |
| int m_bpp; |
| |
| |
| |
| int m_maxTileSize; |
| |
| |
| |
| int m_shrinkX, |
| |
| m_shrinkY; |
| |
| |
| ResampleQuality m_quality; |
| FieldPrevalence |
| m_fieldPrevalence; |
| |
| bool m_stereoscopic; |
| |
| bool |
| m_isSwatch; |
| |
| |
| bool m_userCachable; |
| |
| |
| |
| |
| |
| |
| bool m_applyShrinkToViewer; |
| |
| |
| |
| TRectD m_cameraBox; |
| |
| int *m_isCanceled; |
| |
| |
| |
| |
| |
| std::shared_ptr<QOffscreenSurface> m_offScreenSurface; |
| |
| public: |
| TRenderSettings(); |
| ~TRenderSettings(); |
| |
| bool operator==(const TRenderSettings &rhs) const; |
| bool operator!=(const TRenderSettings &rhs) const; |
| |
| |
| |
| std::string toString() const; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TRasterFx : public TFx { |
| class TRasterFxImp; |
| TRasterFxImp *m_rasFxImp; |
| |
| protected: |
| virtual void doCompute(TTile &tile, double frame, |
| const TRenderSettings &settings) = 0; |
| |
| virtual void doDryCompute(TRectD &rect, double frame, |
| const TRenderSettings &info); |
| |
| public: |
| TRasterFx(); |
| ~TRasterFx(); |
| |
| virtual void compute(TTile &tile, double frame, const TRenderSettings &info); |
| |
| virtual void compute(TFlash &flash, int frame); |
| |
| void allocateAndCompute(TTile &tile, const TPointD &pos, |
| const TDimension &size, TRasterP templateRas, |
| double frame, const TRenderSettings &info); |
| |
| virtual bool doGetBBox(double frame, TRectD &bBox, |
| const TRenderSettings &info) = 0; |
| |
| bool getBBox(double frame, TRectD &bBox, const TRenderSettings &info); |
| |
| virtual bool isCachable() const { return true; } |
| |
| virtual void transform(double frame, int port, const TRectD &rectOnOutput, |
| const TRenderSettings &infoOnOutput, |
| TRectD &rectOnInput, TRenderSettings &infoOnInput); |
| |
| virtual bool canHandle(const TRenderSettings &info, double frame) = 0; |
| virtual TAffine handledAffine(const TRenderSettings &info, double frame); |
| |
| static TRasterP applyAffine(TTile &tileOut, const TTile &tileIn, |
| const TRenderSettings &info); |
| |
| |
| void enableCache(bool on); |
| bool isCacheEnabled() const; |
| |
| |
| |
| std::string getAlias(double frame, |
| const TRenderSettings &info) const override; |
| |
| virtual void dryCompute(TRectD &rect, double frame, |
| const TRenderSettings &info); |
| |
| virtual int getMemoryRequirement(const TRectD &rect, double frame, |
| const TRenderSettings &info); |
| |
| |
| |
| |
| static int memorySize(const TRectD &rect, int bpp); |
| |
| virtual bool allowUserCacheOnPort(int port) { return true; } |
| |
| virtual bool isPlugin() const { return false; }; |
| |
| private: |
| friend class FxResourceBuilder; |
| }; |
| |
| class TZeraryColumnFx; |
| |
| class TPluginInterface { |
| public: |
| virtual bool isPlugin() const { return false; }; |
| virtual bool isPluginZerary() const { return false; }; |
| }; |
| |
| |
| |
| #ifdef _WIN32 |
| template class DVAPI TSmartPointerT<TRasterFx>; |
| template class DVAPI TDerivedSmartPointerT<TRasterFx, TFx>; |
| #endif |
| |
| |
| |
| class DVAPI TRasterFxP final : public TDerivedSmartPointerT<TRasterFx, TFx> { |
| public: |
| TRasterFxP() {} |
| TRasterFxP(TRasterFx *fx) : DerivedSmartPointer(fx) {} |
| TRasterFxP(TFx *fx) : DerivedSmartPointer(TFxP(fx)) {} |
| TRasterFxP(TFxP fx) : DerivedSmartPointer(fx) {} |
| operator TFxP() { return TFxP(m_pointer); } |
| }; |
| |
| |
| |
| #ifdef _WIN32 |
| template class DVAPI TFxPortT<TRasterFx>; |
| #endif |
| typedef TFxPortT<TRasterFx> TRasterFxPort; |
| |
| |
| |
| |
| |
| class DVAPI TGeometryFx : public TRasterFx { |
| public: |
| TGeometryFx(); |
| |
| virtual TAffine getPlacement(double frame) = 0; |
| virtual TAffine getParentPlacement(double frame) = 0; |
| |
| void doCompute(TTile &tile, double frame, |
| const TRenderSettings &info) override; |
| void compute(TFlash &flash, int frame) override; |
| |
| bool doGetBBox(double frame, TRectD &bbox, |
| const TRenderSettings &info) override; |
| |
| virtual bool checkTimeRegion() const { return false; } |
| |
| std::string getAlias(double frame, |
| const TRenderSettings &info) const override; |
| |
| void transform(double frame, int port, const TRectD &rectOnOutput, |
| const TRenderSettings &infoOnOutput, TRectD &rectOnInput, |
| TRenderSettings &infoOnInput) override; |
| }; |
| |
| |
| |
| #ifdef _WIN32 |
| template class DVAPI TSmartPointerT<TGeometryFx>; |
| template class DVAPI TDerivedSmartPointerT<TGeometryFx, TFx>; |
| #endif |
| |
| |
| |
| class DVAPI TGeometryFxP final |
| : public TDerivedSmartPointerT<TGeometryFx, TFx> { |
| public: |
| TGeometryFxP() {} |
| TGeometryFxP(TGeometryFx *fx) : DerivedSmartPointer(fx) {} |
| TGeometryFxP(TFx *fx) : DerivedSmartPointer(fx) {} |
| TGeometryFxP(TFxP fx) : DerivedSmartPointer(fx) {} |
| TGeometryFxP(TRasterFx *fx) : DerivedSmartPointer(TRasterFxP(fx)) {} |
| TGeometryFxP(TRasterFxP fx) : DerivedSmartPointer(fx) {} |
| |
| operator TRasterFxP() { return TRasterFxP(m_pointer); } |
| }; |
| |
| |
| |
| #ifdef _WIN32 |
| template class DVAPI TFxPortT<TGeometryFx>; |
| #endif |
| |
| class DVAPI TGeometryPort final : public TFxPortT<TGeometryFx> { |
| public: |
| TGeometryPort() : TFxPortT<TGeometryFx>(true) {} |
| TAffine getPlacement(double frame) { return m_fx->getPlacement(frame); } |
| }; |
| |
| |
| |
| |
| |
| class DVAPI NaAffineFx final : public TGeometryFx { |
| FX_DECLARATION(NaAffineFx) |
| public: |
| ~NaAffineFx() {} |
| NaAffineFx(bool isDpiAffine = false); |
| |
| TFx *clone(bool recursive) const override; |
| |
| bool canHandle(const TRenderSettings &info, double frame) override { |
| return true; |
| } |
| |
| void compute(TFlash &flash, int frame) override; |
| |
| TAffine getPlacement(double frame) override { return m_aff; } |
| TAffine getParentPlacement(double frame) override { return TAffine(); } |
| |
| void setAffine(const TAffine &aff) { |
| assert(aff != TAffine()); |
| m_aff = aff; |
| } |
| bool isDpiAffine() const { return m_isDpiAffine; } |
| std::string getPluginId() const override { return std::string(); } |
| |
| protected: |
| TRasterFxPort m_port; |
| |
| private: |
| TAffine m_aff; |
| bool m_isDpiAffine; |
| |
| |
| NaAffineFx(const NaAffineFx &); |
| NaAffineFx &operator=(const NaAffineFx &); |
| }; |
| |
| |
| |
| |
| |
| void DVAPI addRenderCache(const std::string &alias, TImageP image); |
| void DVAPI removeRenderCache(const std::string &alias); |
| |
| |
| |
| #ifdef _MSC_VER |
| #pragma warning(push) |
| #pragma warning(disable : 4251) |
| #endif |
| |
| #ifdef _MSC_VER |
| #pragma warning(pop) |
| #endif |
| |
| #endif |