/////////////////////////////////////////////////////////////////////////////// // 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 OD_GS_SR_VECTORIZE_DEVICE #define OD_GS_SR_VECTORIZE_DEVICE #include "TD_PackPush.h" #include "GsSrBaseClasses.h" #include "rendering/SrTriangleRendererData.h" class OdGsSrVectorizeView; class OdSrUpdateManager; class OdGsSrVectorizerDevice : public OdGsSrBaseDevice { friend class OdGsSrVectorizeView; friend class OdSrUpdateManager; public: OdGsSrVectorizerDevice(bool isBitmap = false); ~OdGsSrVectorizerDevice() override; void update(OdGsDCRect* pRect) override; OdGsModelPtr createModel() override; bool get_EnableSoftwareHLR() const; void put_EnableSoftwareHLR(bool enableSoftwareHLR); bool get_DrawTransparency() const; void put_DrawTransparency(bool drawTransparency); void initMetrics(); bool supportPartialUpdate() const override; void scanLines(OdUInt8* pBytes, OdUInt32 index, OdUInt32 numLines) const; const OdUInt8* scanLines() const override; private: const ODCOLORREF* m_paletteColors = nullptr; OdUInt16 m_numPaletteColors = 0; OdUInt8Array m_scanLinesArray; OdUInt8* m_pScanLinesBuffer; OdUInt32 m_width; OdUInt32 m_height; OdUInt32 m_scanLineLength; bool m_isBitmap = false; OdSrTextureParams m_textureParams; bool m_hlrEnabled = false; bool m_bDrawTransparency = true; public: /** \details Checks raster image compatibility. \param pImage [in] Pointer to raster image for check. \returns true if the raster image has one of the following color depth values: * 1 * 4 * 8 * 24 * 32 */ bool isRasterImageProcessible(const OdGiRasterImage* pImage) const; /** \details Prepares raster image for processing. \param pImage [in] Pointer to raster image. \param bTransparent [in] Flag that specifies whether transparency is enabled. \param rasterOrigin [in] Bottom-left raster image corner coordinate. \param rasterU [in] X-axis of raster image. \param rasterV [in] Y-axis of raster image. */ /** \details Prepares raster image for processing. \param pImage [in] Pointer to raster image. \param bTransparent [in] Transparency is enabled. */ void setRasterImage(const OdGiRasterImage* pImage, bool bTransparent = false); const OdSrTextureParams& textureParams() const; /** \details Finalizes raster image processing. */ void clearRasterImage(); /** \details Checks whether the raster image is available. \returns true if raster image is available. */ bool hasRasterImage() const { //return OdGsBitmapVectorizeDevice::hasRasterImage(); return m_textureParams.pRasterScanLines != nullptr; } OdUInt8Array& frameBuffer(); void setInvalidRectsDirectly(const OdGsDCRectArray& rects); bool containsInvalidRectsTol(OdGsSrVectorizeView& view, OdInt32 pixTolerance); OdSrUpdateManager* m_updateManager; void fillBackgroundRect(const OdGsDCRect& rect); void invertYRect(OdGsDCRect& dcRect) const; void movePictureRect(const OdGsDCRect& rect, OdInt32 x, OdInt32 y); inline const OdUInt8* getPixPtr(int x, int y) const { return m_pScanLinesBuffer + m_scanLineLength * y + x * 3; } inline OdUInt8* getPixPtr(int x, int y) { return m_pScanLinesBuffer + m_scanLineLength * y + x * 3; } }; #include "TD_PackPop.h" #endif // OD_GS_SR_VECTORIZE_DEVICE