CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
GsBaseVectorizeDevice.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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
24#ifndef ODGSBASEVECTORIZEDEVICE_INC
25#define ODGSBASEVECTORIZEDEVICE_INC
26
27#include "TD_PackPush.h"
28#include "Gs/GsBaseModule.h"
29#include "Gs/GsDCRectArray.h"
31#include "Gs/GsModel.h"
32#include "GsOverlayDefs.h"
33#include "SlotManager.h"
34#include "ThreadsCounter.h"
35
36#include "Gs/GsUpdateManager.h"
37
42
43class OdGiPathNode;
46
48class OdGsViewImpl;
49
55
72{
73 friend class OdGsViewImpl;
75
76 friend class OdGsBaseModule;
77 OdGsBaseModulePtr m_pModule;
78 OdSlotManager m_slotManager;
79protected:
89
91
93 enum
94 {
95 kFirstFlag = 1,
96
97 kInvalid = kFirstFlag << 0,
98 kSortRenderTypes = kFirstFlag << 1,
99 kSpatialIndexDisabled = kFirstFlag << 2,
100 kDynamicHighlight = kFirstFlag << 3,
101 kDynamicSubhighlight = kFirstFlag << 4,
102 kSupportBlocks = kFirstFlag << 5,
103 kSupportOverlays = kFirstFlag << 6,
104 kSupportComposition = kFirstFlag << 7,
105 kEnableComposition = kFirstFlag << 8,
106 kMtDisplay = kFirstFlag << 9,
107 kUseSectionGeometryMap = kFirstFlag << 10,
108 kUseVpLtypeScaleMult = kFirstFlag << 11,
109 kUseVpFilterFunction = kFirstFlag << 12,
110 kCullingVolumeEnabled = kFirstFlag << 13,
111 kDisplayOffLayers = kFirstFlag << 14,
112 kSupportInteractiveView = kFirstFlag << 15,
113 kHighlightTwoPass = kFirstFlag << 16,
114 kSupportSelectionStyles = kFirstFlag << 17,
115 kSuppressHide = kFirstFlag << 18, //Indicates that GS should not skip hidden entities, device will hide they by himself
116
117 kLastFlag = kSuppressHide
118 };
119
121 {
124 GsDeviceOverlayData() : m_bHasInvalidRectsInVports(false) {}
125 };
127 {
128 public:
130 bool hasInvalidRects(OdUInt32 nOverlays = kGsAllOverlays) const;
131 bool mergeInvalidRects(OdGsDCRect* pRect, OdUInt32 nOverlays = kGsAllOverlays) const;
132 bool containsInvalidRects(const OdGsViewImpl &view, bool bIfHas = false, OdUInt32 nOverlays = kGsAllOverlays) const;
133 };
135
136 void registerOverlay(OdGsViewImpl *pView, const OdGsModel *pModel);
137 void unregisterOverlay(OdGsViewImpl *pView, const OdGsModel *pModel);
138
139 virtual void onOverlayActivated(OdGsOverlayId nOverlay);
140 virtual void onOverlayDeactivated(OdGsOverlayId nOverlay);
141public:
145 bool invalid() const { return GETBIT(m_flags, kInvalid); }
150 void setInvalid(bool bSet) { SETBIT(m_flags, kInvalid, bSet); }
155 void setValid(bool bFlag);
156
157public:
166 virtual bool supportPartialUpdate() const;
167
171 virtual bool supportPartialScreenUpdate() const;
172
177 void onViewAdded(OdGsView* pView);
178public:
180
185
190
196 void setUserGiContext(OdGiContext* pUserGiContext);
197
202
208
213 int height() const;
214
219 int width() const;
220
225 int hOffset() const;
226
231 int vOffset() const;
232
239
246 void invalidate(const OdGsDCRect &screenRect);
247
256 virtual void invalidate(OdUInt32 nOverlays);
257
266 virtual void invalidate(OdUInt32 nOverlays, const OdGsDCRect &screenRect);
267
275 void invalidate(const OdGsViewImpl *pView, const OdGsDCRect &screenRect);
276
284 void invalidate(const OdGsModel *pModel, const OdGsDCRect &screenRect);
285
293
296
302 bool isValid() const;
303
314 virtual void update(OdGsDCRect* pUpdatedRect);
315
319 virtual void updateGeometry();
320 virtual void updateScreen();
321
331 void onSize(const OdGsDCRect& outputRect);
332
336 const OdGsDCRect& outputRect() const;
337
342 void getSize(OdGsDCRect& outputRect) const;
343
348
353
366 int bitsPerPixel,
367 int xPixels,
368 int yPixels);
369
370
381 const OdGsClientViewInfo* pViewInfo = 0,
382 bool enableLayerVisibilityPerView = false);
383
389 void addView(OdGsView* pView);
390
397 void insertView(int viewIndex, OdGsView* pView);
398
406 bool eraseView(OdGsView* pView);
407
411 int numViews() const;
412
417 OdGsView* viewAt(int viewIndex);
418
423 const OdGsView* viewAt(int viewIndex) const;
424
429 OdGsViewImpl* viewImplAt(int viewIndex);
430
435 const OdGsViewImpl* viewImplAt(int viewIndex) const;
436
444 bool eraseView(int viewIndex);
445
450
455 bool setBackgroundColor(ODCOLORREF backgroundColor);
456
461
471 void setLogicalPalette(const ODCOLORREF* logicalPalette, int numColors);
472
481 void getSnapShot(OdGiRasterImagePtr &pImage, const OdGsDCRect &region);
482
487 ODCOLORREF getColor(OdUInt16 colorIndex) const;
488
493
497 const ODCOLORREF* getPalette() const;
498
503 const ODCOLORREF* getLogicalPalette(int &numColors) const;
504
512
527 bool isModelCompatible(OdGsModel* pModel) const;
528
532 const OdGsView* rootView() const;
533
534 // renderTypes support
535 bool sortRenderTypes() const;
536 void setSortRenderTypes(bool flag);
538 OdGsModel::RenderType transientRenderType() const;
539 void setTransientRenderType(OdGsModel::RenderType renderType);
540 // overlays support
541
547 bool supportOverlays() const;
548
554 void setSupportOverlays(bool bFlag);
555
561
567
578
584 bool isSpatialIndexDisabled() const;
585
590 void disableSpatialIndex(bool bSet);
591
597 bool isCullingVolumeEnabled() const;
598
603 void enableCullingVolume(bool bSet);
604
610 bool supportHighlightTwoPass() const;
611
616 void setSupportHighlightTwoPass(bool bOn);
617
623 bool isMtDisplay() const;
624
630 bool supportDynamicHighlight() const;
631
637 bool supportDynamicSubhighlight() const;
638
644 bool supportSelectionStyles() const;
645
651 bool supportBlocks() const;
652
660 bool supportComposition() const;
661
669 bool compositionEnabled() const;
670
677 void enableComposition(bool bSet);
678
684 bool isDisplayOffLayersEnabled() const;
685
690 void enableDisplayOffLayers(bool bSet);
691
699 bool isValidViewportId(const OdUInt32 acgiId) const
700 {
701 return m_slotManager.contains(acgiId);
702 }
703
704 bool useVpLtypeScaleMult() const { return GETBIT(m_flags, kUseVpLtypeScaleMult); }
705 bool useVpFilterFunction() const { return GETBIT(m_flags, kUseVpFilterFunction); }
706
711
716
721 OdRxObject* mtServices() { return m_mtServices; }
722
727
733
739 virtual bool isSupportDeviceStateSaving() const;
740
747 bool saveDeviceState(OdGsFiler *pFiler) const;
748
756
763 virtual bool saveClientDeviceState(OdGsFiler *pFiler) const;
764
771 virtual bool loadClientDeviceState(OdGsFiler *pFiler);
772
773 virtual bool saveLinkedDeviceState(OdGsFiler *pFiler) const;
774 virtual bool loadLinkedDeviceState(OdGsFiler *pFiler);
775
783 bool supportInteractiveViewMode() const { return GETBIT( m_flags, kSupportInteractiveView ); }
784
791 void setSupportInteractiveViewMode( bool bSet ) { SETBIT( m_flags, kSupportInteractiveView, bSet ); }
792
797 OdGsUpdateManagerPtr getUpdateManager( bool createIfNotExist = false );
798
804
808 OdGsUpdateManager* updateManager() { return m_pUpdateManager.get(); }
809
814 bool isSuppressHide() const { return GETBIT( m_flags, kSuppressHide ); }
815
816protected:
818public:
819 OdRxObjectPtr deviceSelfReference() { return m_pDeviceRef; }
820
821protected:
822 friend class DisplayScheduler;
823 friend class OdGsNodeContext;
824 virtual bool supportParallelDisplay() const { return false; }
826 void viewUpdateScreen(OdGsBaseVectorizeView* pView, bool bUpdate);
829
830public:
832private:
833 OdRxObjectPtr m_mtServices;
834 OdRefCounter m_vectThreadIndex;
835 OdMutexPtr m_mtInvalidate;
836 OdMutexPtr m_mtSectionGeometryMap;
837 mutable OdMutex m_mtInvalidRects;
838 OdDbBaseDatabaseRawPtrArray m_aDbMtRenderingOn;
839};
840
842{
844}
845
847{
849}
850
852{
854}
855
857{
859}
860
862{
864}
865
867{
869}
870
872{
874}
875
877{
879}
880
882{
884}
885
887{
889}
890
892{
893 return GETBIT(m_flags, kMtDisplay);
894}
895
897{
899}
900
902{
904}
905
907{
909}
910
912{
914}
915
917{
919}
920
922{
924}
925
927{
929}
930
932{
934}
935
937{
939}
940
942{
944}
945
947{
948 m_transientRenderType = renderType;
949}
950
951inline const
953{
954 return m_outputRect;
955}
956
957inline
959{
960 outputRect = this->outputRect();
961}
962
963inline
965{
966 return m_logPalette[colorIndex];
967}
968
969inline
971{
972 return m_logPalette.getPtr();
973}
974
975inline
977{
978 numColors = (int)m_logPalette.size();
979 return m_logPalette.getPtr();
980}
981
982#include "TD_PackPop.h"
983
984#endif // ODGSBASEVECTORIZEDEVICE_INC
false
Definition: DimVarDefs.h:165
OdArray< OdRxObject *, OdMemoryAllocator< OdRxObject * > > OdDbBaseDatabaseRawPtrArray
OdArray< ODCOLORREF, OdMemoryAllocator< ODCOLORREF > > ODGSPALETTE
OdSmartPtr< OdGiTransientManager > OdGiTransientManagerPtr
#define GS_TOOLKIT_EXPORT
Definition: GsExport.h:37
OdGsOverlayId
Definition: GsOverlayDefs.h:42
@ kGsAllOverlays
Definition: GsOverlayDefs.h:57
int OdRefCounter
Definition: OdMutex.h:487
#define ODCOLORREF
Definition: OdPlatform.h:933
unsigned int OdUInt32
unsigned short OdUInt16
#define SETBIT(flags, bit, value)
Definition: OdaDefs.h:516
#define GETBIT(flags, bit)
Definition: OdaDefs.h:517
size_type size() const
Definition: OdArray.h:1247
const T * getPtr() const
Definition: OdArray.h:1600
bool mergeInvalidRects(OdGsDCRect *pRect, OdUInt32 nOverlays=kGsAllOverlays) const
bool containsInvalidRects(const OdGsViewImpl &view, bool bIfHas=false, OdUInt32 nOverlays=kGsAllOverlays) const
void clearInvalidRects(OdUInt32 nOverlays=kGsAllOverlays)
bool hasInvalidRects(OdUInt32 nOverlays=kGsAllOverlays) const
bool eraseView(int viewIndex)
ODCOLORREF getBackgroundColor()
virtual bool isSupportDeviceStateSaving() const
void onDisplayChange(int bitsPerPixel, int xPixels, int yPixels)
void setSupportHighlightTwoPass(bool bOn)
bool isValidViewportId(const OdUInt32 acgiId) const
const OdGsDCRect & outputRect() const
int isOverlayRequireUpdate(OdGsOverlayId overlayId) const
GsDeviceOverlayDataContainer m_overlayData
virtual void update(OdGsDCRect *pUpdatedRect)
OdGsModel::RenderType transientRenderType() const
void unregisterOverlay(OdGsViewImpl *pView, const OdGsModel *pModel)
void setTransientRenderType(OdGsModel::RenderType renderType)
OdGsModel::RenderType m_transientRenderType
const OdGsViewImpl * viewImplAt(int viewIndex) const
void onSize(const OdGsDCRect &outputRect)
virtual bool supportParallelDisplay() const
virtual void updateScreen()
GsVectPerformanceData m_vectPerfData
OdSmartPtr< OdGiContext > m_pUserContext
void setUpdateManager(OdGsUpdateManagerPtr pManager)
const ODCOLORREF * getPalette() const
void enableDisplayOffLayers(bool bSet)
void onViewAdded(OdGsView *pView)
void invalidate(const OdGsViewImpl *pView, const OdGsDCRect &screenRect)
bool saveDeviceState(OdGsFiler *pFiler) const
bool isModelCompatible(OdGsModel *pModel) const
void invalidate(const OdGsDCRect &screenRect)
virtual OdGsOverlayId renderTypeOverlay(OdGsModel::RenderType renderType) const
OdRxObjectPtr getSectionGeometryMap()
const OdGsView * rootView() const
void setLogicalPalette(const ODCOLORREF *logicalPalette, int numColors)
bool setBackgroundColor(ODCOLORREF backgroundColor)
void collectInvalidRectsFromVports(OdGsOverlayId nOverlay, GsDeviceOverlayData &d) const
void invalidate(const OdGsModel *pModel, const OdGsDCRect &screenRect)
OdGsModelPtr createModel()
virtual void onOverlayActivated(OdGsOverlayId nOverlay)
OdGsUpdateManagerPtr getUpdateManager(bool createIfNotExist=false)
void getSize(OdGsDCRect &outputRect) const
ODCOLORREF getPaletteBackground() const
const ODCOLORREF * getLogicalPalette(int &numColors) const
OdGsView * viewAt(int viewIndex)
virtual OdUInt32 renderTypeWeight(OdGsModel::RenderType renderType) const
virtual bool supportPartialScreenUpdate() const
void setSupportInteractiveViewMode(bool bSet)
void viewUpdateScreen(OdGsBaseVectorizeView *pView, bool bUpdate)
OdGsUpdateManagerPtr m_pUpdateManager
virtual void onOverlayDeactivated(OdGsOverlayId nOverlay)
bool eraseView(OdGsView *pView)
virtual void invalidate(OdUInt32 nOverlays, const OdGsDCRect &screenRect)
virtual bool saveLinkedDeviceState(OdGsFiler *pFiler) const
void registerOverlay(OdGsViewImpl *pView, const OdGsModel *pModel)
void setValid(bool bFlag)
ODCOLORREF getColor(OdUInt16 colorIndex) const
bool loadDeviceState(OdGsFiler *pFiler)
OdGsOverlayId gsModelOverlay(const OdGsModel *pModel) const
virtual bool supportPartialUpdate() const
void addView(OdGsView *pView)
ODRX_DECLARE_MEMBERS(OdGsBaseVectorizeDevice)
virtual bool loadLinkedDeviceState(OdGsFiler *pFiler)
const OdGsDCRectArray * invalidRects(OdGsOverlayId overlayId) const
const OdGsView * viewAt(int viewIndex) const
OdGiTransientManagerPtr m_transientManager
void setSupportOverlays(bool bFlag)
void getInvalidRectsFromVports(OdUInt32 nOverlays=kGsAllOverlays)
virtual void updateGeometry()
OdArray< OdGsViewPtr > m_views
void setUserGiContext(OdGiContext *pUserGiContext)
OdGiContext * userGiContext() const
virtual void invalidate(OdUInt32 nOverlays)
virtual bool loadClientDeviceState(OdGsFiler *pFiler)
void invalidateRegion(const OdGiPathNode &path)
const OdGsDCRectArray & invalidRects() const
OdGsUpdateManager * updateManager()
virtual bool saveClientDeviceState(OdGsFiler *pFiler) const
OdGsViewPtr createView(const OdGsClientViewInfo *pViewInfo=0, bool enableLayerVisibilityPerView=false)
void setTransientManager(OdGiTransientManager *pManager)
void insertView(int viewIndex, OdGsView *pView)
virtual OdGiSectionGeometryManager * getSectionGeometryManager()
OdGiTransientManager * transientManager()
OdRxDictionaryPtr properties()
void getSnapShot(OdGiRasterImagePtr &pImage, const OdGsDCRect &region)
OdGsViewImpl * viewImplAt(int viewIndex)
virtual void getSize(OdGsDCRect &outputRect) const =0
virtual const ODCOLORREF * getLogicalPalette(int &numColors) const =0
Definition: Gs.h:140
bool contains(OdSlotId slotId) const
Definition: SlotManager.h:93
const T * get() const
Definition: SmartPtr.h:339