CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
TrVecBaseModule.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, Open Design Alliance (the "Alliance").
3// All rights reserved.
4//
5// This software and its documentation and related materials are owned by
6// the Alliance. The software may only be incorporated into application
7// programs owned by members of the Alliance, subject to a signed
8// Membership Agreement and Supplemental Software License Agreement with the
9// Alliance. The structure and organization of this software are the valuable
10// trade secrets of the Alliance and its suppliers. The software is also
11// protected by copyright law and international treaty provisions. Application
12// programs incorporating this software must include the following statement
13// with their copyright notices:
14//
15// This application incorporates Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 by Open Design Alliance.
18// All rights reserved.
19//
20// By use of this software, its documentation or related materials, you
21// acknowledge and accept the above terms.
23// TrVec module
24
25#ifndef ODBASETRVECMODULE
26#define ODBASETRVECMODULE
27
28#include "TD_PackPush.h"
29
30#include "Gs/GsBaseModule.h"
32
33// Forward declaration
35
39struct OdTrVectorizerPropertyResolver : public OdRxObject
40{
42};
43
48
53{
54 virtual void hostUpdate(OdGsDCRect* pRect) = 0;
55};
56
61class OdTrVectorizerModuleHost : public OdRxObject
62{
63 protected:
66 public:
73 public:
75
77 { m_pRenderClient = pRenderClient; m_pPropResolver = pPropsResolver; }
79
81
83 virtual void generateProperties(OdRxDictionary* /*pInfo*/) const {}
84
85 virtual void configureForPlatform(OdTrVisRenderClient * /*pRenderClient*/, DeviceSetupType /*devType*/) {}
86
88
89 virtual bool onRenderingBegin(OdGsDCRect* /*pUpdatedRect*/ = NULL, OdTrVectorizerUpdateHost* /*pUpdateHost*/ = NULL) { return true; }
90 virtual void onRenderingEnd(OdGsDCRect* /*pUpdatedRect*/ = NULL, OdTrVectorizerUpdateHost* /*pUpdateHost*/ = NULL) {}
91
92 virtual bool hasDirectRenderBuffer(bool* /*bTransparent*/ = NULL) const { return false; }
93 virtual OdUInt8 *getDirectRenderBuffer(OdUInt32* /*pWidth*/, OdUInt32* /*pHeight*/, OdUInt32* /*pFormat*/ = NULL, OdUInt32* /*pAlignment*/ = NULL) { return NULL; }
94};
95
100
101#define ODRX_DECLARE_PROPERTY_TRV(PropName) \
102 struct _##PropName##_PropDesc : public OdRxObjectImpl<OdRxPropDesc> \
103 { \
104 OdTrVectorizerPropertyResolverPtr m_pResolver; \
105 static OdRxObjectPtr createObject(const OdTrVectorizerPropertyResolver *pResolver); \
106 static inline OdString _name(); \
107 OdString name() const; \
108 OdRxObjectPtr prop_get(const void* pThis) const; \
109 void prop_put(void* pThis, OdRxObject* pVal); \
110 };
111
112#define ODRX_GENERATE_PROPERTY_TRV(PropName) \
113 pInfo->putAt(_##PropName##_PropDesc::_name(), _##PropName##_PropDesc::createObject(m_pPropResolver));
114
115#define ODRX_INHERIT_PROPERTIES_TRV(BASE_CLASS) \
116 BASE_CLASS::generateProperties(pInfo);
117
118#define ODRX_DEFINE_PROPERTY_METHODS_PREFIX_TRV(ClassPrefix, PropName, PropHolder, getMethodName, putMethodName, accessFn) \
119 OdRxObjectPtr ClassPrefix _##PropName##_PropDesc::createObject(const OdTrVectorizerPropertyResolver *pResolver) \
120 { \
121 OdRxObjectPtr pThis = OdRxObjectPtr(new _##PropName##_PropDesc, kOdRxObjAttach); \
122 static_cast<_##PropName##_PropDesc*>(pThis.get())->m_pResolver = pResolver; \
123 return pThis; \
124 } \
125 inline OdString ClassPrefix _##PropName##_PropDesc::_name() \
126 { \
127 static OdString sName(OD_T(#PropName)); \
128 return sName; \
129 } \
130 OdString ClassPrefix _##PropName##_PropDesc::name() const \
131 { \
132 return _name(); \
133 } \
134 OdRxObjectPtr ClassPrefix _##PropName##_PropDesc::prop_get(const void* pThis) const \
135 { \
136 return (OdRxObject*)OdRxVariantValue((static_cast<PropHolder*>(m_pResolver->hostByPropsDict((OdRxDictionary*)pThis)))->getMethodName()); \
137 } \
138 void ClassPrefix _##PropName##_PropDesc::prop_put(void* pThis, OdRxObject* pVal) \
139 { \
140 (static_cast<PropHolder*>(m_pResolver->hostByPropsDict((OdRxDictionary*)pThis)))->putMethodName(OdRxVariantValue(pVal)->accessFn()); \
141 }
142
143#define ODRX_DEFINE_PROPERTY_PREFIX_TRV(ClassPrefix, PropName, PropHolder, accessFn) \
144 ODRX_DEFINE_PROPERTY_METHODS_PREFIX_TRV(ClassPrefix, PropName, PropHolder, get_##PropName, put_##PropName, accessFn)
145
162
163#include "TD_PackPop.h"
164
165#endif // ODBASETRVECMODULE
OdSmartPtr< OdRxDictionary > OdRxDictionaryPtr
Definition Gs.h:93
unsigned int OdUInt32
unsigned char OdUInt8
OdSmartPtr< OdTrVectorizerPropertyResolver > OdTrVectorizerPropertyResolverPtr
OdSmartPtr< OdTrVectorizerModuleHost > OdTrVectorizerModuleHostPtr
OdSmartPtr< OdTrVisRendition > OdTrVisRenditionPtr
virtual OdTrVectorizerPropertyResolverPtr createPropertyResolver()
virtual OdSmartPtr< OdGsViewImpl > createVectorizeView()
virtual OdSmartPtr< OdGsBaseVectorizeDevice > createVectorizeDevice(OdTrVectorizerModuleHost *pModuleHost, OdTrVectorizerModuleHost::DeviceSetupType creationHint)
virtual void releasePropertyResolver()
virtual OdUInt8 * getDirectRenderBuffer(OdUInt32 *, OdUInt32 *, OdUInt32 *=NULL, OdUInt32 *=NULL)
void setRenderClient(OdTrVisRenderClient *pRenderClient, OdTrVectorizerPropertyResolver *pPropsResolver)
OdTrVisRenderClient * renderClient() const
virtual bool hasDirectRenderBuffer(bool *=NULL) const
virtual void onRenderingEnd(OdGsDCRect *=NULL, OdTrVectorizerUpdateHost *=NULL)
virtual void configureForPlatform(OdTrVisRenderClient *, DeviceSetupType)
virtual void generateProperties(OdRxDictionary *) const
OdTrVisRenderClient * m_pRenderClient
virtual OdTrVisRenditionPtr createRendition()
virtual OdRxDictionaryPtr createPropertiesContainer() const
virtual DeviceSetupType deviceSetupOverride() const
OdTrVectorizerPropertyResolverPtr m_pPropResolver
virtual bool onRenderingBegin(OdGsDCRect *=NULL, OdTrVectorizerUpdateHost *=NULL)
virtual OdTrVectorizerModuleHost * hostByPropsDict(OdRxDictionary *pInfo) const =0
virtual void hostUpdate(OdGsDCRect *pRect)=0