/////////////////////////////////////////////////////////////////////////////// // 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 ODEXGSOPENGLVECTORIZEDEVICE #define ODEXGSOPENGLVECTORIZEDEVICE #include "TD_PackPush.h" #include "GsOpenGLVectorizer.h" #include "CommonOpenGLProps.h" #include "ExGsXWindowConnection.h" #include // Comment it, if you want compile with non-streamed version of vectorizer #include "GsOpenGLStreamVectorizer.h" #ifdef OD_OGL_ENABLEMETASTREAM OD_OPENGL_DEFINE_COMMON_PROPS(ExGsOpenGLVectorizeDeviceBase, OdGsOpenGLStreamVectorizeDevice, OdCommonDeviceProps); typedef OdGsOpenGLStreamVectorizeView ExGsOpenGLVectorizeViewBase; #else OD_OPENGL_DEFINE_COMMON_PROPS(ExGsOpenGLVectorizeDeviceBase, OdGsOpenGLVectorizeDevice, OdCommonDeviceProps); typedef OdGsOpenGLVectorizeView ExGsOpenGLVectorizeViewBase; #endif /** \details This class implements OpenGL Vectorizer Device objects for X11 platform. Library: Source code provided. */ class ExGsOpenGLVectorizeDevice : public ExGsOpenGLVectorizeDeviceBase { protected: bool m_bContextCreated; mutable ExGsXWindowConnection m_xConnection; GLXContext m_context; friend class ExGsOpenGLVectorizeView; public: /** \details Returns a handle to current display for which an OpenGL context is created. \returns Handle to current display for which an OpenGL context is created (can be cast to pointer to Display). \remarks If this property isn't set, the vectorizer chooses a default display. */ OdIntPtr getXDisplay() const; /** \details Sets current display for which an OpenGL context is created. \param dp [in] Handle to current display for which an OpenGL context is created. \remarks If this property isn't set, the vectorizer chooses a default display. */ void setXDisplay(OdIntPtr dp); /** \details Returns a handle to a window for which an OpenGL context is created. \returns Handle to a window for which an OpenGL context is created (can be cast to Window). \remarks If this property isn't set and the GLXContext property isn't set, the vectorizer fails to create an OpenGL context. */ OdIntPtr getXWindow() const; /** \details Sets a window for which an OpenGL context is created. \param win [in] Handle to a window for which an OpenGL context is created. \remarks If this property isn't set and the GLXContext property isn't set, the vectorizer fails to create an OpenGL context. */ void setXWindow(OdIntPtr win); /** \details Returns a handle to an existing XVisualInfo with which an OpenGL context is created. \returns Handle to XVisualInfo with which an OpenGL context is created (can be cast to pointer to XVisualInfo). \remarks If this property isn't set, the vectorizer chooses the best parameters internally. */ OdIntPtr chooseVisual() const; /** \details Sets a visual info with which an OpenGL context is created. \param vinfo [in] Handle to XVisualInfo with which an OpenGL context is created. \remarks If this property isn't set and the GLXContext property isn't set, the vectorizer fails to create an OpenGL context. */ void setChooseVisual(OdIntPtr vinfo); /** \details Returns Linux OpenGL context created internally by the renderer. \returns Handle to Linux OpenGL context (can be cast to GLXContext). \remarks If this property isn't set, the vectorizer chooses the best parameters internally. */ OdIntPtr getGLXContext() const; /** \details Sets Linux OpenGL context created internally by the renderer. \param ctx [in] Handle to Linux OpenGL context created internally by the renderer. \remarks If this property isn't set and the GLXContext property isn't set, the vectorizer fails to create an OpenGL context. */ void setGLXContext(OdIntPtr ctx); /** \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. */ OdGiRasterImagePtr snapshotRegion(const OdGsDCRect &area, bool bCrop) const; /** \details Returns height of a window. \returns Window height in pixels. */ long int windowHeight() const; protected: ODRX_USING_HEAP_OPERATORS(ExGsOpenGLVectorizeDeviceBase); ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(ExGsOpenGLVectorizeDevice); ExGsOpenGLVectorizeDevice(); virtual ~ExGsOpenGLVectorizeDevice(); void update(OdGsDCRect* pUpdatedRect); void updateScreen(); /** \details Creates a context for this Device object. */ virtual void createContext(); virtual void deleteContext(); virtual void preReleaseResource(); virtual void postReleaseResource(); #ifdef OD_OGL_ENABLEMETASTREAM bool supportMultithreading() const { return gsMultithreadEnabled(); } #endif bool checkExtensionFuncSupport(OpenGLExtension extIdx) const; void *getExtensionFuncPtrFromListInt(const char *pFuncName) const; }; /** \details This class implements OpenGL Vectorizer View objects for X11 platform. Library: Source code provided. */ class ExGsOpenGLVectorizeView : public ExGsOpenGLVectorizeViewBase { /** \details Returns a device that owns this view. \returns Pointer a device that contains this view. */ ExGsOpenGLVectorizeDevice* device() { return static_cast(OdGsOpenGLVectorizeView::device()); } bool m_bSelecting; public: /** \details Default constructor for the ExGsOpenGLVectorizeView class. */ ExGsOpenGLVectorizeView(); /** \details Invokes the specified OdGsSelectionReactor object for the specified selection area (or point) in this view. \param points [in] Array of points. \param numPoints [in] Number of points. \param pReactor [in] Pointer to the reactor. \param mode [in] Selection mode. */ void select(const OdGePoint2d* points, int numPoints, OdGsSelectionReactor* pReactor, OdGsView::SelectionMode mode); /** \details Processes polyline data. \param numPoints [in] Number of points in the polyline. \param vertexList [in] Array of vertices that make up the polyline. \sa */ void polylineOut(OdInt32 numPoints, const OdGePoint3d* vertexList); /** \details Processes mesh data. \param numRows [in] Number of rows. \param numColumns [in] Number of columns. \param vertexList [in] Array of vertices. \param pEdgeData [in] Pointer to additional edge data. \param pFaceData [in] Pointer to additional face data. \param pVertexData [in] Pointer to additional vertex data. \sa */ void meshProc(OdInt32 numRows, OdInt32 numColumns, const OdGePoint3d* vertexList, const OdGiEdgeData* pEdgeData = 0, const OdGiFaceData* pFaceData = 0, const OdGiVertexData* pVertexData = 0); /** \details Processes shell data. \param numVertices [in] Number of vertices. \param vertexList [in] Array of vertices. \param faceListSize [in] Number of entries in faceList. \param faceList [in] Array of numbers that define the faces. \param pEdgeData [in] Pointer to additional edge data. \param pFaceData [in] Pointer to additional face data. \param pVertexData [in] Pointer to additional vertex data. \sa */ void shellProc(OdInt32 numVertices, const OdGePoint3d* vertexList, OdInt32 faceListSize, const OdInt32* faceList, const OdGiEdgeData* pEdgeData = 0, const OdGiFaceData* pFaceData = 0, const OdGiVertexData* pVertexData = 0); /** \details Processes raster images data. \param origin [in] Lower-left corner. \param u [in] Image width vector. \param v [in] Image height vector. \param pImage [in] Pointer to the RasterImage object. \param uvBoundary [in] Array of image boundary points (may not be null). \param numBoundPts [in] Number of boundary points. \param transparency [in] True if and only if image transparency is on. \param brightness [in] Image brightness [0.0 .. 100.0]. \param contrast [in] Image contrast [0.0 .. 100.0]. \param fade [in] Image fade value [0.0 .. 100.0]. \sa */ void rasterImageProc(const OdGePoint3d& origin, const OdGeVector3d& u, const OdGeVector3d& v, const OdGiRasterImage* pImage, const OdGePoint2d* uvBoundary, OdUInt32 numBoundPts, bool transparency = false, double brightness = 50.0, double contrast = 50.0, double fade = 0.0); /** \details Processes metafile data. \param origin [in] Metafile origin. \param u [in] Metafile width vector. \param v [in] Metafile height vector. \param pMetafile [in] Pointer to the metafile object. \param dcAligned [in] Reserved. \param allowClipping [in] Reserved. */ void metafileProc(const OdGePoint3d& origin, const OdGeVector3d& u, const OdGeVector3d& v, const OdGiMetafile* pMetafile, bool dcAligned = true, bool allowClipping = false); //void ownerDrawDc( // const OdGePoint3d& origin, // const OdGeVector3d& u, // const OdGeVector3d& v, // const OdGiSelfGdiDrawable* pDrawable, // bool dcAligned = true, // bool allowClipping = false); }; #include "TD_PackPop.h" #endif // ODEXGSOPENGLVECTORIZEDEVICE