/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef EXGSGDIVECTORIZEDEVICE #define EXGSGDIVECTORIZEDEVICE #include "TD_PackPush.h" #include "../win/ExGsWin32Device.h" #include "Gs/GsBaseInclude.h" #include "Gs/GsBaseModel.h" #include "IntArray.h" #include "Ge/GeCircArc3d.h" #include "Ge/GeEllipArc3d.h" #include "Ge/GeInterval.h" #include "Gi/GiXform.h" #include "Gi/GiOrthoClipper.h" #include "Gi/GiPerspectivePreprocessor.h" #include "Gi/GiMetafiler.h" #include "Gi/GiHLRemover.h" #include "Gi/GiPlotGenerator.h" #include "Gi/GiConveyorPassingImpl.h" #include "ExGiGDIViewportClipper.h" #include "ExGiGDIGeometry.h" #include "../MetafileTransformStack.h" #include "../TtfFontsCache.h" #include "../WinComposite/ExGsCompositeModuleInterface.h" #include #include "ExGiGDIDC.h" class ExGDIVectorizeView; typedef OdArray > POINTArray; /** \details This class is the base class for Win32 GDI Vectorizer Device objects. Library: Source code provided. */ class ExGsGDISimpleVectorizeDevice : public OdGsBaseVectorizeDevice , public ExGiGDIGeometry { protected: ODRX_USING_HEAP_OPERATORS(OdGsBaseVectorizeDevice); OdGiPlotGeneratorPtr m_pPlotstyler; OdGiConveyorConnector m_toGDI; OdGiConveyorConnector m_toPlotGen; public: /** \details Default constructor for the ExGsGDISimpleVectorizeDevice class. */ ExGsGDISimpleVectorizeDevice(); /** \details Sets the logical palette to be used by this Device object. \param logicalPalette [in] Logical palette. \param numColors [in] Number of colors in palette. */ void setLogicalPalette(const ODCOLORREF* logicalPalette, int numColors) override; /** \details Sets the background color of the GUI window of this Device object. \param backgroundColor [in] Background color. */ bool setBackgroundColor(ODCOLORREF color) override; /** \details Notification function called whenever the size of the GUI window for this Device object has changed. \param outputRect [in] New size of the output rectangle in device coordinates (pixels). \remarks This function should not be called if this Device object has a width and/or height of 0. */ void onSize(const OdGsDCRect& outputRect) override; OdGiConveyorInput& input(); OdGiConveyorInput& plotGenInput(); OdGiPlotGenerator& plotGenerator(); }; /** \details A data type that represents a smart pointer to an object. */ typedef ExGsCompositeClientDevice ExGsBaseGDIVectorizeDevice; /** \details This class implements Win32 GDI Vectorizer Device objects. Library: Source code provided. */ class ExGsGDIVectorizeDevice : public ExGsBaseGDIVectorizeDevice , public ExGsWin32Device , public OdTtfFontsCacheCallback { class HDCStore { ExGiGDIDC* m_hdc; ExGiGDIDC *createDC(OdUInt8 nTranspMode, OdUInt8 nRasterMode) { ExGiGDIDC::ExGDIDCTransparencyMode mode = ExGiGDIDC::kNoTransparency; if( nTranspMode == ExGiGDIDC::kDirectTransparency ) mode = ExGiGDIDC::kDirectTransparency; else if( nTranspMode == ExGiGDIDC::kMirrorTransparency ) mode = ExGiGDIDC::kMirrorTransparency; if (nRasterMode && mode != ExGiGDIDC::kMirrorTransparency) mode = ExGiGDIDC::kRasterTransparency; return m_hdc = new ExGiGDIDC( mode ); } public: //HDC& operator=(const HDC &hdc) { m_hdc = hdc; return m_hdc; } ExGiGDIDC* getExDC() const { return m_hdc; } HDC getHDC() const { return m_hdc->targetDC(); } HDCStore( OdUInt8 nTranspMode, OdUInt8 nRasterMode ) { createDC(nTranspMode, nRasterMode); } HDCStore( HDC hdc, OdUInt8 nTranspMode, OdUInt8 nRasterMode ) { createDC(nTranspMode, nRasterMode)->setDC( hdc ); } virtual ~HDCStore() { delete m_hdc; }; void setSizes( int w, int h ) { m_hdc->setSizes( w, h ); } }; class HDCAutoDestroyStore : public HDCStore { public: //HDC& operator=(const HDC &hdc) { return HDCStore::operator=(hdc);} ExGiGDIDC* getExDC() { return HDCStore::getExDC(); } HDC getHDC() const { return HDCStore::getHDC(); } HDCAutoDestroyStore(HDC hdc, OdUInt8 nTranspMode, OdUInt8 nRasterMode ) : HDCStore(hdc, nTranspMode, nRasterMode) { } ~HDCAutoDestroyStore() override { ::DeleteDC( getHDC() ); }; void setSizes( int w, int h ) { HDCStore::setSizes( w, h ); } }; void beginPaint(); void endPaint(); POINTArray m_dcPoints; std::unique_ptr m_hOffscreenDC; HBITMAP m_hbmScreen; bool m_bClearScreen; bool m_bUseSoftwareHLR; bool m_bUseTextOut; bool m_bUseTtfCache; bool m_bContextValid; double m_dMinTTFTextSize; OdGsBaseDeviceMTHelpers m_deviceSync; OdTtfFontsCachePtr m_pTtfCache; HDC createDrawDc(); void deleteDrawDc(); void flushDrawDc(); void initDrawDcOffset(bool bSet = true); protected: void HDCWasChanged() override; bool supportPartialUpdate() const override; bool supportMultithreading() const { return checkMtRegenEnabled(userGiContext()); } OdUInt8 m_nTransparencyMode, m_nRasterMode; public: /** \details Returns the offscreen device context for the Vectorizer Device object. */ inline ExGiGDIDC* drawDc() { return (m_hOffscreenDC.get()) ? (m_hOffscreenDC->getExDC()) : NULL; } /** \details Retrieves a set of device properties. \returns Smart pointer to the dictionary containing device properties. */ OdRxDictionaryPtr properties() override { return this; } /** \details Represents the "BlocksCacheEnabled" property of the device. \remarks The property enables caching of a hierarchical blocks structure. If a drawing contains many block inserts with similar settings, it is possible to vectorize entities inside this block once and use a single metafile for each entity during rendering. In this case vectorization is faster and memory usage is lower, but it can cause some rendering performance slowdown since additional transformations are applied. This feature is also useful to enable the ability to highlight entities inside blocks. This property takes effect only if geometry cache is turned on. */ OD_COMMONDEVPROP_BlocksCacheEnabled_DevRedirect(); /** \details Represents the "DynamicSubEntHltEnabled" property of the device. \remarks The subentity highlighting mode enables the ability to cache geometry markers for entity geometry parts. These parts of the entity geometry can be highlighted independently from all other entity geometry. If it is turned on, a subentity marker is stored inside a metafile and the renderer is able to check whether the marked part of the geometry must be highlighted. This property takes effect only if geometry cache is turned on. */ OD_COMMONDEVPROP_DynamicSubEntHltEnabled_DevRedirect(); /** \details Sets a color converter used by the device. \param pCC [in] Pointer to color converter callback. \remarks For more information, see */ void setColorConverter(const OdColorConverterCallback *pCC) override { OdCommonDeviceProps::setColorConverter(pCC); ExGiGDIGeometry::m_colorConverter.setColorConverterCallback(getColorConverter()); } /** \details Returns MT synchronization helpers. \returns Reference to the OdGsBaseDeviceMTHelpers instance representing multithreading helpers. */ OdGsBaseDeviceMTHelpers &mtDeviceSync() { return m_deviceSync; } ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(ExGsGDIVectorizeDevice); public: using ExGsBaseGDIVectorizeDevice::m_logPalette; /** \details Default constructor for the ExGsGDIVectorizeDevice class. */ ExGsGDIVectorizeDevice(); /** \details Destructor for the ExGsGDIVectorizeDevice class. */ ~ExGsGDIVectorizeDevice() override; /** \details Notification function called whenever the size of the GUI window for the Device object has changed. \param outputRect [in] New size of the output rectangle in device coordinates (pixels). */ void onSize(const OdGsDCRect& outputRect) override; /** \details Returns the handle to the device context associated with this Vectorizer Device object. \returns Handle to the corresponding device context. */ HDC hdc() const { return m_hDC; } /** \details Returns current state of ClearScreen flag. \returns true if the ClearScreen flag is enabled, false otherwise. \remarks By default vectorization devices clear their rendering surface with a specified background color. This property can be set to false to prevent surface filling by the background color. This feature is useful in the case when multiple devices are used to render onto a single rendering surface. */ bool clearScreen() const { return m_bClearScreen; } /** \details Sets new state of ClearScreen flag. \param clearScreen [in] New flag state. \remarks By default vectorization devices clear their rendering surface with a specified background color. This property can be set to false to prevent surface filling by the background color. This feature is useful in the case when multiple devices are used to render onto a single rendering surface. */ void setClearScreen(bool clearScreen) { m_bClearScreen = clearScreen; } /** \details Returns the EnableSoftwareHLR flag for this Vectorizer device. \returns true if the EnableSoftwareHLR flag is enabled, false otherwise. \remarks 2D vectorization devices support the HiddenLine rendering mode using the software hidden lines removal algorithm. This flag can be used to enable vectorization of viewports with the HiddenLine rendering mode using this algorithm. In the flag isn't enabled, viewports with the HiddenLine rendering mode are vectorized in the Wireframe rendering mode. */ bool useSoftwareHLR() const { return m_bUseSoftwareHLR; } /** \details Controls the EnableSoftwareHLR flag for this Vectorizer device. \param useSoftwareHLR [in] Enables or disables Software HLR. \remarks 2D vectorization devices support the HiddenLine rendering mode using the software hidden lines removal algorithm. This flag can be used to enable vectorization of viewports with the HiddenLine rendering mode using this algorithm. In the flag isn't enabled, viewports with the HiddenLine rendering mode are vectorized in the Wireframe rendering mode. */ void setUseSoftwareHLR(bool useSoftwareHLR) { m_bUseSoftwareHLR = useSoftwareHLR; } /** \details Checks whether the UseTextOut flag is set for this Vectorizer Device object. \returns true if the UseTextOut flag is enabled, false otherwise. \remarks This option improves quality of rendered TrueType fonts in WinGDI vectorizer using WinAPI calls to draw output text, so output text is more smooth and qualitative. If this option is disabled, text is vectorized and looks angular. */ bool useTextOut() const { return m_bUseTextOut; } /** \details Controls the UseTextOut flag for this Vectorizer Device object. \param useTextOut [in] Controls flag. \remarks This option improves quality of rendered TrueType fonts in WinGDI vectorizer using WinAPI calls to draw output text, so output text is more smooth and qualitative. If this option is disabled, text is vectorized and looks angular. */ void setUseTextOut(bool useTextOut) { m_bUseTextOut = useTextOut; } /** \details Returns current state of UseTTFCache flag. \returns true if the UseTTFCache flag is enabled, false otherwise. \remarks TrueType fonts cache is useful for rendering drawings which contain a lot of text. If TrueType fonts cache is enabled, each font character used inside the drawing is cached as a separate metafile. This feature reduces memory usage, but rendering can be little bit slower if it is turned on. */ bool useTtfCache() const { return m_bUseTtfCache; } /** \details Sets new state of UseTTFCache flag. \param bSet [in] New flag state. \remarks TrueType fonts cache is useful for rendering drawings which contain a lot of text. If TrueType fonts cache is enabled, each font character used inside the drawing is cached as a separate metafile. This feature reduces memory usage, but rendering can be little bit slower if it is turned on. */ void setUseTtfCache(bool useTtfCache) { m_bUseTtfCache = useTtfCache; } /** \details Returns minimal TrueType Text size with which text still not rendered as simplified geometry. \returns The minimal TrueType Text size in pixels. \remarks This value minimal TrueType text size (in pixels) with which TrueType text is rendered as text. If text height (in pixels) is less than minimal TrueType text size, text is rendered as filled rectangle for rendering optimization purposes. Setting this property to zero means disabling small TrueType texts rendering optimization; for example, this is useful for rendering into WMF/EMF metafiles. */ double minimalTTFTextSize() const { return m_dMinTTFTextSize; } /** \details Controls the minimal TrueType Text size for this Vectorizer Device object. \param dMinTTFTextSize [in] The minimal TrueType Text size in pixels. \remarks This value minimal TrueType text size (in pixels) with which TrueType text is rendered as text. If text height (in pixels) is less than minimal TrueType text size, text is rendered as filled rectangle for rendering optimization purposes. Setting this property to zero means disabling small TrueType texts rendering optimization; for example, this is useful for rendering into WMF/EMF metafiles. */ void setMinimalTTFTextSize(double dMinTTFTextSize) { m_dMinTTFTextSize = dMinTTFTextSize; } /** \details Checks whether the GradientsAsBitmap flag is enabled for this Vectorizer Device object. \returns true if the GradientsAsBitmap flag is set for this Vectorizer Device object. \remarks Some print drivers don't support gradients or they render gradients into intermediate bitmaps with an opaque background that can overlap visible geometry. This option enables conversion of gradients into bitmaps with a transparent background before printing. Not all print drivers support transparent bitmaps, but this option is useful for some of them, for example, XPS Document Writer supports transparent bitmaps. This option can be also used for on-screen rendering to improve quality of rendered gradients. Since 4.3.0 release it is enabled by default for on-screen rendering and plotting. */ bool gradientsAsBitmap() const { return m_bGradientAsBitmap; } /** \details Controls the GradientsAsBitmap flag for this Vectorizer Device object. \param bSet [in] Controls flag. \remarks Some print drivers don't support gradients or they render gradients into intermediate bitmaps with an opaque background that can overlap visible geometry. This option enables conversion of gradients into bitmaps with a transparent background before printing. Not all print drivers support transparent bitmaps, but this option is useful for some of them, for example, XPS Document Writer supports transparent bitmaps. This option can be also used for on-screen rendering to improve quality of rendered gradients. Since 4.3.0 release it is enabled by default for on-screen rendering and plotting. */ void setGradientsAsBitmap(bool bSet) { m_bGradientAsBitmap = bSet; } /** \details Checks whether the GradientsAsPolys flag is enabled for this Vectorizer Device object. \returns true if the GradientsAsPolys flag is set for this Vectorizer Device object, false otherwise. \remarks Some print drivers don't support gradients or they render gradients into intermediate bitmaps with an opaque background which can overlap visible geometry. This option enables conversion of gradients into a set of simple polygons which is supported by any printing driver. */ bool gradientsAsPolygons() const { return m_bGradientAsPolys; } /** \details Controls the GradientsAsPolys flag for this Vectorizer Device object. \param bSet [in] Controls flag. \remarks Some print drivers don't support gradients or they render gradients into intermediate bitmaps with an opaque background which can overlap visible geometry. This option enables conversion of gradients into a set of simple polygons which is supported by any printing driver. */ void setGradientsAsPolygons(bool bSet) { m_bGradientAsPolys = bSet; } /** \details Returns the GradientsAsPolys threshold for this Vectorizer Device object. \returns GradientsAsPolys threshold value. \remarks The threshold coefficient for conversion of gradients into polygons. The coefficient represents the maximum deviation of color components between separately generated color polygons. Increasing the coefficient minimizes the number of generated polygons. Decreasing the coefficient increases the number of generated polygons and output gradient quality. */ OdUInt8 gradientsAsPolygonsThreshold() const { return m_nGradientAsPolysSubdivideTreshold; } /** \details Controls the GradientsAsPolys threshold for this Vectorizer Device object. \param nThreshold [in] New threshold for GradientsAsPolys value. \remarks The threshold coefficient for conversion of gradients into polygons. The coefficient represents the maximum deviation of color components between separately generated color polygons. Increasing the coefficient minimizes the number of generated polygons. Decreasing the coefficient increases the number of generated polygons and output gradient quality. */ void setGradientsAsPolygonsThreshold(OdUInt8 nThreshold) { m_nGradientAsPolysSubdivideTreshold = nThreshold; } /** \details Updates screen display. */ void updateScreen() override; // old style update is used when gs model is disabled /** \details Updates the GUI window (or its region) associated with the device object. \param pUpdatedRect [in] A pointer to the rectangle object that represents the window region to be updated. \remarks The method affects all OdGsView objects owned by the device object, and so it displays the correct image on the GUI window (or its region). If the pointer to a window region (the pUpdatedRect parameter value) is NULL, the whole window is updated. \sa Redrawing Content of a Device */ void update(OdGsDCRect* pUpdatedRect = 0) override; /** \details Checks whether the device supports partial updating. \returns true if the device supports partial updating, false otherwise. */ bool isSupportPartialUpdate() const {return supportPartialUpdate();} // Snapshot support /** \details Gets a snapshot of the current device. \param pImage [out] Receives a snapshot image. \param region [in] Region from which to take a snapshot. */ void getSnapShot(OdGiRasterImagePtr &pImage, const OdGsDCRect ®ion) override; /** \details Gets a snapshot of the graphics view that belongs in the current device. \param pImage [out] Receives a snapshot image. \param region [in] Region from which to take a snapshot. \param pView [in] Pointer to a graphics view from which to take a snapshot. */ void getSnapShot(OdGiRasterImagePtr &pImage, const OdGsDCRect ®ion, OdGsView *pView); /** \details Gets snapshot parameters of the current device. \returns Smart pointer to the OdGiRasterImage instance that contains image-related parameters that are used for creating snapshots. */ virtual OdGiRasterImagePtr snapshotImageParams() const; /** \details Gets a snapshot of the current device. \param area [in] Area from which to take a snapshot. \returns Smart pointer to the OdGiRasterImage instance that represents the created snapshot. */ virtual OdGiRasterImagePtr snapshotRegion(const OdGsDCRect &area, bool bCrop) const; // TtfFonts cache support //DOM-IGNORE-BEGIN /** \details Returns TTF fonts cache. \returns Pointer to the OdTtfFontsCache instance containing information about character cache and other font-related data. */ OdTtfFontsCache *ttfFontsCache() { return m_pTtfCache.get(); } OdRxObjectPtr tfcNewMetafile(void *pSessionId) override; OdGiConveyorGeometry *tfcBeginMetafile(OdRxObject *pMetafile, void *pSessionId) override; void tfcFinalizeMetafile(OdRxObject *pMetafile, void *pSessionId) override; void tfcPlayMetafile(const OdGeMatrix3d &xForm, const OdRxObject *pMetafile, void *pSessionId) const override; //DOM-IGNORE-END //Transparency support /** \details Retrieves a mode representing transparency support by the device. \returns A value representing transparency support that can be one of the following: * 0 - No transparency support. * 1 - Transparency using additional DC. * 2 - Transparency using the same DC. For more information, see ExGiGDIDC::ExGDIDCTransparencyMode. */ OdUInt8 getTransparencyMode() const { return m_nTransparencyMode; } /** \details Sets a mode representing transparency support by the device. \param nMode [in] Transparency mode. \remarks A value representing transparency support can be one of the following: * 0 - No transparency support. * 1 - Transparency using additional DC. * 2 - Transparency using the same DC. For more information, see ExGiGDIDC::ExGDIDCTransparencyMode. */ void setTransparencyMode( OdUInt8 nMode ) { m_nTransparencyMode = nMode; } OdUInt8 getRasterMode() const { return m_nRasterMode; } void setRasterMode(OdUInt8 nMode) { m_nRasterMode = nMode; } protected: void createContext() override; ODRX_USING_HEAP_OPERATORS(ExGsBaseGDIVectorizeDevice); }; #ifndef ROUND #define ROUND(X) long((X) + .5) #endif //DOM-IGNORE-BEGIN /** \details This class is the base class for Win32 GDI Vectorizer Device objects. Library: Source code provided. */ class ExGDIVectorizeGeometryDestGeom : public OdGiConveyorPassingImpl { OdGiConveyorConnector* m_pGDIViewPlayEntryPoint; public: void setGDIViewPlayEntryPoint(OdGiConveyorConnector* pGDIViewPlayEntryPoint) { m_pGDIViewPlayEntryPoint = pGDIViewPlayEntryPoint; } OdGiConveyorGeometry& destGeometry() const { if ( m_pGDIViewPlayEntryPoint == NULL ) return OdGiEmptyGeometry::kVoid; return m_pGDIViewPlayEntryPoint->geometry(); } }; //DOM-IGNORE-END /** \details This class implements Win32 GDI Vectorizer View objects. Library: Source code provided. */ class ExGDIVectorizeView : public OdGsBaseVectorizeViewMT { OdGiConveyorConnector m_mfPlayEntryPoint; ExGDIVectorizeGeometryDestGeom m_GeometryDestForPlaying; OdGiXformPtr m_pMfPlay; OdGiOrthoClipperPtr m_pZClip; OdGiXformPtr m_pPerspXform; OdGiPerspectivePreprocessorPtr m_pPerspPrepr; OdGiHLRemoverPtr m_pHLR; OdGiGDIViewportClippingPtr m_pVptClipper; OdGiMetafilerPtr m_pMetafiler; bool m_bCurHLTState; // !dynamicSubEntHltEnabled bool m_bCurHiddenState; // !dynamicSubEntHltEnabled OdGsMarker m_gsHLTMarker; // dynamicSubEntHltEnabled bool m_bProcessingTTF; bool m_bCurTTFState; MetafileTransformStack m_mfTransformStack; bool m_bInexactSelection; OdGiConveyorGeometry *m_pPrevSelGeom; protected: /** \details Sets the current lineweight in pixels. \param lineWeight [in] Lineweight. */ void setLineWeightPixels(int lineWeight); /** \details Detaches or attaches current geometry conveyor screen output. \param bEnable [in] New geometry conveyor screen output state. */ void enableScreenOutput(bool bEnable); public: /** \details Returns the ExGsGDIVectorizeDevice object associated with this Vectorizer View object. \returns Pointer to a parent device. */ ExGsGDIVectorizeDevice* device() { return static_cast(OdGsBaseVectorizeView::device()); } /** \details Default constructor for the ExGDIVectorizeView class. */ ExGDIVectorizeView(); /** \details Returns the output from this Vectorizer View object geometry conveyor. */ OdGiConveyorOutput& screenOutput() { return m_pVptClipper->output(); } /** \details Initializes the paint process for this Vectorizer Device object. \param targetDC [in] Handle to the target device context. */ void beginPaint(HDC targetDC); /** \details Terminates the paint process for this Vectorize Device object. \remarks Deletes all objects and resets all settings associated with this Vectorize Device object. */ void endPaint(); // to update conveyor if view is perspective /** \details Sets the camera parameters for this Viewport object. \param position [in] Camera position. \param target [in] Camera target. \param upVector [in] Camera up vector. \param fieldWidth [in] Projection plane (field) width. \param fieldHeight [in] Projection plane (field) height. \param projectionType [in] Projection type. \remarks This method defines the transfomation from WCS coordinates to normalized device coordinates. All parameters are in WCS coordinates. projectionType must be one of the following: NameValue kParallel 0 kPerspective 1
*/ void setView(const OdGePoint3d & position, const OdGePoint3d& target, const OdGeVector3d& upVector, double fieldWidth, double fieldHeight, Projection projectionType = kParallel) override; /** \details Pushes current viewport clipping region into clipping stack. \param bForceWinClip [in] Specifies whether to force using the WinGDI clipper. */ void pushViewportClipping(bool bForceWinClip = false); /** \details Pops current viewport clipping region from clipping stack. \param bForceWinClip [in] Specifies whether to force using the WinGDI clipper. */ void popViewportClipping(bool bForceWinClip = false); /** \details Checks whether WinGDI clipper is currently used. \returns true if WinGDI clipper is used, false otherwise. */ bool isViewportClippingWinClip(); /** \details Sets viewport's common data before display() call. */ void loadViewport() override; /** \details Begins the view vectorization procedure. */ void beginViewVectorization() override; /** \details Ends the view vectorization procedure. */ void endViewVectorization() override; /** \details Pushes a clipping boundary onto the stack, which can possibly affect the display of subsequent primitives. Use the popClipBoundary() to remove this clipping boundary from the stack. \param pBoundary [in] Pointer to a clipping boundary. \sa */ void pushClipBoundary(OdGiClipBoundary* pBoundary) override; /** \details Pushes a clipping boundary onto the stack, which can possibly affect the display of subsequent primitives. Use the popClipBoundary() to remove this clipping boundary from the stack. \param pBoundary [in] Pointer to a clipping boundary. \param pClipInfo [in] Clipping details. \sa */ void pushClipBoundary(OdGiClipBoundary* pBoundary, OdGiAbstractClipBoundary* pClipInfo) override; /** \details Pops a top clipping boundary from the stack. This method should be used after a successful pushClipBoundary() method call from the worldDraw or viewportDraw of a drawable object. \sa */ void popClipBoundary() override; /** \details Runs selection procedure inside the Viewport object. \param pts [in] Selection points in device coordinate space. \param nPoints [in] Count of selection points. \param pReactor [in] Selection callback pointer. \param mode [in] Selection mode. \sa */ void select(const OdGePoint2d* pts, int nPoints, OdGsSelectionReactor* pReactor, OdGsView::SelectionMode mode) override; /** \details Sets the render mode for this Viewport object. \param mode [in] Render mode. \remarks mode must be one of the following: NameValueDescription kBoundingBox -1 Bounding box. For internal use only k2DOptimized 0 Standard display. Optimized for 2D kWireframe 1 Standard display. Uses 3D pipeline kHiddenLine 2 Wireframe display. Hidden lines removed kFlatShaded 3 Faceted display. One color per face kGouraudShaded 4 Smooth shaded display. Colors interpolated between vertices kFlatShadedWithWireframe 5 Faceted display with wireframe overlay kGouraudShadedWithWireframe 6 Smooth shaded display with wireframe overlay
*/ void setMode(RenderMode mode) override; /** \details Method that is called when entity traits are modified. */ void onTraitsModified() override; /** \details Method that is called when render type is changed. \param renderType [in] Render type. \remarks mode must be one of the following: NameValueDescription kUserBg1 -3 User-defined background rendering type without Z-buffer kUserBg2 -2 User-defined background rendering type with own Z-buffer kUserBg3 -1 User-defined background rendering type with Z-buffer kMain 0 Use main Z-buffer kSprite 1 Use alternate Z-buffer (for sprites) kDirect 2 Render on device directly kHighlight 3 Render on device directly (skipping frame buffer and Z-buffer) kHighlightSelection 4 Render on device directly using highlighting style (skipping frame buffer and Z-buffer) kDirectTopmost 5 Render on top of all other render types without Z-buffer kContrast 6 Render with contrast style kCount 7 Number of primary predefined RenderType's kUserFg1 8 User-defined foreground rendering type with Z-buffer kUserFg2 9 User-defined foreground rendering type with own Z-buffer kUserFg3 10 Second user-defined foreground rendering type without Z-buffer
*/ void renderTypeOnChange(OdGsModel::RenderType renderType) override; /** \details Updates internal flags, related to current lineweights override state. \param lwdOverride [in] Current lineweights override state. */ void updateLineweightOverride(const OdGiLineweightOverride &lwdOverride) override; // override viewport frame rendering /** \details Draws the frame (border) for the viewport. */ void drawViewportFrame() override; /** \details Pushes palette override into palette overrides stack. \param pOverride [in] New palette override. \returns True if palette overrides are supported by underlying vectorization pipeline. */ bool pushPaletteOverride(const OdGiPalette* pOverride) override; /** \details Pop palette override from palette overrides stack. */ void popPaletteOverride() override; /** \details Updates internal data, related to current palette override state. \param pPalette [in] Current palette override state. */ void updatePaletteOverride(const OdGiPalette *pPalette) override; // virtual override, to let entities know that they're drawn for dragging // (overrides OdGiCommonDraw::isDragging() ) /** \details Checks whether the DrawDragging flag is set for this Vectorizer Device object. \returns true if the DrawDragging flag is set, false otherwise. \remarks The property informs the vectorizer that dragging is in progress. Vectorizer can modify geometry behavior and optimize rendering in this case. */ bool isDragging() const override; /** \details Passes to the visualization framework an object that can visualize itself. \param origin [in] Object origin. \param u [in] Object width vector. \param v [in] Object height vector. \param pDrawable [in] Pointer to the drawable. \param dcAligned [in] Reserved. \param allowClipping [in] Reserved. \remarks The visualization framework uses this function to visualize Ole2Frame entities. \remarks ownerDrawDc is not conveyor primitive, so the ODA visualization framework performs no processing (transformation, linetyping, or clipping) for this object. All coordinates are in Model coordinates. */ void ownerDrawDc( const OdGePoint3d& origin, const OdGeVector3d& u, const OdGeVector3d& v, const OdGiSelfGdiDrawable* pDrawable, bool dcAligned = true, bool allowClipping = false) override; // caching /** \details Creates a new GsMetafile (cache) object. \returns Returns a SmartPointer to the newly created object. */ OdRxObjectPtr newGsMetafile() override; /** \details Begins vectorization to the specified GsMetafile (cache) object. \param pMetafile [in] Pointer to the metafile. */ void beginMetafile(OdRxObject* pMetafile) override; /** \details Ends vectorization to the specified GsMetafile (cache) object. \param pMetafile [in] Pointer to the metafile. */ void endMetafile(OdRxObject* pMetafile) override; /** \details Plays (draws) the specified Metafile (cache) object. \param pMetafile [in] Pointer to the metafile. */ void playMetafile(const OdRxObject* pMetafile) override; /** \details Pushes a transformation matrix for a metafile onto the stack. The resulting transformation is created by multiplying the specified transform matrix by the existing one. This allows you to easily adjust an entity coordinate system. Use the popMetafileTransform() to remove this transform matrix from the stack when you are finished with this transformation. \param mtx [in] Transformation matrix. \param uFlags [in] Metafile transform flags. \remarks This method takes effect only if the passed flags parameter has the OdGsBaseVectorizer::kSharedRefUpdate flag set to true. */ void pushMetafileTransform(const OdGeMatrix3d& mtx, OdUInt32 uFlags = 0) override; /** \details Pops a transformation from the stack. This method should be used after a successful pushMetafileTransform() method call to restore previous transform state. \param uFlags [in] Metafile transform flags. */ void popMetafileTransform(OdUInt32 uFlags = 0) override; /** \details Retrieves the block insert transform, which is the model-to-world coordinate transform. \returns Model-to-world transform matrix. */ const OdGeMatrix3d &metafileTransform() const override; bool useMetafileAsGeometry() const override { return m_bInexactSelection && isModelCacheEnabled() && !const_cast(this)->device()->useTextOut(); } OdGiConveyorOutput& outputForMetafileGeometry() override { return m_pMfPlay->output(); } void setTransformForMetafileGeometry(const OdGeMatrix3d& mtx) override; OdGeMatrix3d getTransformForMetafileGeometry() const override; const OdGeMatrix3d &getMetafileTransform() const { return m_mfTransformStack.metafileTransform(); } /** \details Checks whether the model cache is enabled. \returns true if model cache is enabled, false otherwise. */ inline bool isModelCacheEnabled() const { return view().cachedDrawables() != 0; } /** \details Returns current highlight branch. \returns Pointer to current highlight branch. */ const OdGsStateBranch* getCurrentHLTBranch() const { return currentStateBranch(); } /** \details Processes text data. \param position [in] Position of the text. \param normal [in] Normal to a plane where text lies. Used to define v parameter as normal.crossProduct(direction). \param direction [in] Direction vector that is interpreted as u parameter. \param msg [in] Message string. \param length [in] Message length. \param raw [in] If and only if true, escape sequences, such as %%P, will not be converted to special characters. \param pTextStyle [in] Pointer to the TextStyle for the text. \sa */ void text(const OdGePoint3d& position, const OdGeVector3d& normal, const OdGeVector3d& direction, const OdChar* msg, OdInt32 length, bool raw, const OdGiTextStyle* pTextStyle) override; // Snapshot support /** \details Gets a snapshot of the current device. \param pImage [out] Receives a snapshot image. \param region [in] Region from which to take a snapshot. */ void getSnapShot(OdGiRasterImagePtr &pImage, const OdGsDCRect ®ion) override; //DOM-IGNORE-BEGIN // TtfFonts cache support OdRxObjectPtr tfcNewMetafile(); OdGiConveyorGeometry *tfcBeginMetafile(OdRxObject *pMetafile); void tfcFinalizeMetafile(OdRxObject *pMetafile); void tfcPlayMetafile(const OdGeMatrix3d &xForm, const OdRxObject *pMetafile) const; //DOM-IGNORE-END /** \details Updates the linetyper node for the conveyor. \param bRemove [in] Flag that specifies whether to remove or add a linetyper node from/to the conveyor. */ void updateLineTyper(bool bRemove); // Background rendering compatibility protected: void display(bool update) override; private: bool isNeedActionWithLineTyper(); void addLineTyperBeforeMetafile(); void removeLineTyperBeforeMetafile(); bool m_bIsLineTyperWasAddedAfterMetafile; void addLineTyperAfterMetafile(); void removeLineTyperAfterMetafile(); }; #include "TD_PackPop.h" #endif //#ifndef EXGSGDIVECTORIZEDEVICE