/////////////////////////////////////////////////////////////////////////////// // 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. /////////////////////////////////////////////////////////////////////////////// // SWR2DModule.cpp : Defines the initialization routines for the DLL. #include "OdaCommon.h" #include "Gi/GiRasterWrappers.h" #include "Gs/Gs.h" #include "RxDynamicModule.h" #include "DynamicLinker.h" #include "Gs/GsBaseInclude.h" #include "Gs/GsBaseModel.h" #include "Ge/GeEllipArc3d.h" #include "../MetafileTransformStack.h" #include #include "vectorization/GsSrVectorizeDevice.h" #include "vectorization/GsSrVectorizeView.h" #include "CommonDeviceProps.h" #if defined(ODA_WINDOWS) && !defined(_WINRT) #include "ExGsBitmapDevice.h" #include "win/ExGsScreenDevice.h" #include "win/ExGsWin32Device.h" class _ExSRD2ScreenDevice : public ExGsWin32Device, public OdGsSrVectorizerDevice { public: ODRX_USING_HEAP_OPERATORS(OdGsSrVectorizerDevice); void createContext() override {} // no any context creation required*/ // virtual void deleteContext() {} // no any context deletion required*/ }; class ExSRD2ScreenDevice : public ExGsScreenDevice<_ExSRD2ScreenDevice> { public: static OdGsDevicePtr createObject() { return OdRxObjectImpl::createObject(); } ODRX_DECLARE_PROPERTY(EnableSoftwareHLR) ODRX_DECLARE_PROPERTY(DrawTransparency) OdRxDictionaryPtr properties() override { return this; } void update(OdGsDCRect* pUpdatedRect) override { ExGsScreenDevice<_ExSRD2ScreenDevice>::update(pUpdatedRect); BITMAPINFO* pHeader; OdUInt8Array headerMemCont; headerMemCont.resize(sizeof(BITMAPINFOHEADER) /*+ pImg->paletteDataSize()*/); pHeader = (BITMAPINFO*)headerMemCont.getPtr(); pHeader->bmiHeader.biBitCount = (WORD)colorDepth(); pHeader->bmiHeader.biClrImportant = 0; pHeader->bmiHeader.biClrUsed = 0; pHeader->bmiHeader.biCompression = BI_RGB; pHeader->bmiHeader.biHeight = height(); pHeader->bmiHeader.biPlanes = 1; pHeader->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); pHeader->bmiHeader.biSizeImage = 0; pHeader->bmiHeader.biWidth = width(); pHeader->bmiHeader.biXPelsPerMeter = 0; pHeader->bmiHeader.biYPelsPerMeter = 0; // pImg->paletteData((OdUInt8*)pHeader->bmiColors); StretchDIBits( m_hDC, 0, 0, width(), height(), 0, 0, width(), height(), scanLines(), pHeader, DIB_RGB_COLORS, SRCCOPY); } ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(ExSRD2ScreenDevice); }; #endif // defined(ODA_WINDOWS) && !defined(_WINRT) #if !(defined(ODA_WINDOWS) && !defined(_WINRT)) // #else // WIN32 //DD:EXPORT_ON typedef OdGsSrVectorizeView OdGsSrVectorizeViewSafe; class ExSRD2ScreenDevice : public OdGsSrVectorizerDevice, public OdCommonDeviceProps { ODRX_USING_HEAP_OPERATORS(OdGsSrVectorizerDevice); public: static OdGsDevicePtr createObject() { return OdRxObjectImpl::createObject(); } ODRX_DECLARE_PROPERTY(EnableSoftwareHLR) ODRX_DECLARE_PROPERTY(DrawTransparency) OdRxDictionaryPtr properties() { return (OdRxDictionary*)this; } ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(ExSRD2ScreenDevice); //virtual ~ExSRD2ScreenDevice() {} }; // CORE-11600 problem with bmpout of OLE on Linux //typedef OdGsBitmapVectorizeView ExGsBitmapVectorizeView; #endif // WIN32 ODRX_BEGIN_DYNAMIC_PROPERTY_MAP(ExSRD2ScreenDevice) #if defined(ODA_WINDOWS) && !defined(_WINRT) && !defined(ODA_WINDOWS_GCC) ODRX_INHERIT_PROPERTIES(ExGsScreenDevice<_ExSRD2ScreenDevice>); #else ODRX_INHERIT_PROPERTIES(OdCommonDeviceProps); #endif ODRX_GENERATE_PROPERTY(EnableSoftwareHLR) ODRX_GENERATE_PROPERTY(DrawTransparency) ODRX_END_DYNAMIC_PROPERTY_MAP(ExSRD2ScreenDevice) ODRX_DEFINE_PROPERTY_PREFIX(ExSRD2ScreenDevice::, EnableSoftwareHLR, ExSRD2ScreenDevice, getBool) ODRX_DEFINE_PROPERTY_PREFIX(ExSRD2ScreenDevice::, DrawTransparency, ExSRD2ScreenDevice, getBool) class ExSoftwareRendering2dDevice : public OdGsSrVectorizerDevice, public OdCommonDeviceProps { OdUInt32 m_outColDepth; ODRX_DECLARE_DYNAMIC_PROPERTY_MAP(ExSoftwareRendering2dDevice); ODRX_DECLARE_PROPERTY(EnableSoftwareHLR) ODRX_DECLARE_PROPERTY(DrawTransparency) ODRX_DECLARE_PROPERTY(RasterImage) ODRX_DECLARE_PROPERTY(BitPerPixel) ODRX_USING_HEAP_OPERATORS(OdGsSrVectorizerDevice); public: ExSoftwareRendering2dDevice() : OdGsSrVectorizerDevice(true /*isBitmapDevice*/), m_outColDepth(24) {} virtual ~ExSoftwareRendering2dDevice() override {} OdRxDictionaryPtr properties() override { return (OdRxDictionary*)this; } static OdGsDevicePtr createObject() { return OdRxObjectImpl::createObject(); } OdGiRasterImagePtr getRasterImage() { return (OdGiRasterImage*)this; } void putRasterImage(OdGiRasterImage*) {} OdUInt32 get_BitPerPixel() const { return m_outColDepth; } void put_BitPerPixel(OdUInt32 colDepth) { m_outColDepth = colDepth; } }; ODRX_BEGIN_DYNAMIC_PROPERTY_MAP(ExSoftwareRendering2dDevice) ODRX_INHERIT_PROPERTIES(OdCommonDeviceProps) ODRX_GENERATE_PROPERTY(RasterImage) ODRX_GENERATE_PROPERTY(BitPerPixel) ODRX_GENERATE_PROPERTY(EnableSoftwareHLR) ODRX_GENERATE_PROPERTY(DrawTransparency) ODRX_END_DYNAMIC_PROPERTY_MAP(ExSoftwareRendering2dDevice) ODRX_DEFINE_PROPERTY_OBJECT_PREFIX(ExSoftwareRendering2dDevice::, RasterImage, ExSoftwareRendering2dDevice, getRasterImage().get, putRasterImage, OdGiRasterImage) ODRX_DEFINE_PROPERTY_PREFIX(ExSoftwareRendering2dDevice::, BitPerPixel, ExSoftwareRendering2dDevice, getInt32) ODRX_DEFINE_PROPERTY_PREFIX(ExSoftwareRendering2dDevice::, EnableSoftwareHLR, ExSoftwareRendering2dDevice, getBool) ODRX_DEFINE_PROPERTY_PREFIX(ExSoftwareRendering2dDevice::, DrawTransparency, ExSoftwareRendering2dDevice, getBool) class SoftwareRendering2DModule : public OdGsBaseModule { protected: void initApp() override { OdGsBaseModule::initApp(); // Add extra initializations here... } void uninitApp() override { // Add extra uninitializations here... OdGsBaseModule::uninitApp(); } OdSmartPtr createDeviceObject() override { return ExSRD2ScreenDevice::createObject(); } OdSmartPtr createViewObject() override { return OdRxObjectImpl::createObject(); } OdSmartPtr createBitmapDeviceObject() override { return ExSoftwareRendering2dDevice::createObject(); } OdSmartPtr createBitmapViewObject() override { return OdRxObjectImpl::createObject(); } }; ODRX_DEFINE_DYNAMIC_MODULE(SoftwareRendering2DModule); //DD:EXPORT_OFF