CFx SDK Documentation  2020SP3
GiPlotStyleDefs.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, 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 Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 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 __ODGIPSDEFS_H__
25 #define __ODGIPSDEFS_H__
26 
27 #include "TD_PackPush.h"
28 
29 #include "GiExport.h"
30 #include "UInt8Array.h"
31 #include "Gi/GiRasterImage.h"
32 #include "Ps/PlotStyles.h"
33 #include "Gi/GiLinetype.h"
34 #include "HatchPattern.h"
35 
42 {
43  public:
47  enum DefType
48  {
49  kPsDefs = 0, // PlotStyle linetype definitions in internal format.
50  kGiDefs = 1, // PlotStyle linetype definitions in Gi format.
51  kGDIDefs = 2, // PlotStyle linetype definitions in Windows GDI-compatible format.
52  kOpenGLDefs = 4 // PlotStyle linetype definitions in OpenGL-compatible format.
53  };
54 
59  {
60  int m_numDashes; // Number of dashes in PlotStyle linetype.
61  double m_dashLength[10]; // Lengths of dashes and gaps in PlotStyle linetype.
62 
66  double patternLength() const;
67  };
72  {
73  OdUInt32 m_numDashes; // Number of dashes in PlotStyle linetype.
74  OdUInt32 m_dashLength[20]; // Lengths of dashes and gaps in PlotStyle linetype.
75 
83  void clean();
84  };
89  {
90  OdUInt16 m_patternLength; // Linetype pattern factor (multiplier).
91  OdUInt16 m_pattern; // 16-bit linetype pattern.
92  };
93  protected:
94  static const PsLinetypeDef g_psLinetypeDefs[OdPs::kLtpLast - 1];
96  PsLinetypeGDI m_gdiLinetypeDef[OdPs::kLtpLast];
97  PsLinetypeOGL m_oglLinetypeDef[OdPs::kLtpLast];
99  volatile bool m_bIsInit[4];
100  public:
101  OdGiPsLinetypes(bool bInitialize = true, OdUInt32 nDefs = kGiDefs | kGDIDefs | kOpenGLDefs);
103 
108  bool isInitialized(OdUInt32 nDefs = kPsDefs) const;
113  void initialize(OdUInt32 nDefs = kPsDefs);
118  void uninitialize(OdUInt32 nDefs = kPsDefs | kGiDefs | kGDIDefs | kOpenGLDefs);
119 
129 
139 
149  OdUInt8Array rasterizeLinetype(OdPs::LineType psLtp, OdUInt32 numRepititions = 1, OdUInt8 ltpValue = 0xFF) const;
150 
160  ODCOLORREF backgroundColor = ODRGB(0, 0, 0),
161  ODCOLORREF foregroundColor = ODRGB(255, 255, 255)) const;
162 
172 
182  protected:
186  OdGiRasterImagePtr internalMakeImage(const OdUInt8 *pPixels, OdUInt32 nWidth, OdUInt32 numLevels = 1,
187  ODCOLORREF backgroundColor = ODRGB(0, 0, 0),
188  ODCOLORREF foregroundColor = ODRGB(255, 255, 255)) const;
189  private:
190  void internalDebugMe();
191 };
192 
198 
205 {
206  public:
210  typedef OdUInt16 PsFillstyleGDI[8];
214  typedef OdUInt8 PsFillstyleOGL[128];
215  protected:
216  inline OdUInt32 fsCorr(OdPs::FillStyle fs) const { return fs - OdPs::kFsSolid; }
217  inline bool fsRigth(OdPs::FillStyle fs) const { return (fs >= OdPs::kFsSolid) && (fs < OdPs::kFsLast); }
218  static const PsFillstyleGDI g_gdiFillstyleDef[OdPs::kFsLast - OdPs::kFsSolid];
219  static const PsFillstyleOGL g_oglFillstyleDef[OdPs::kFsLast - OdPs::kFsSolid];
220  public:
223 
243 
257  OdUInt32 nWidth = 32, OdUInt32 nHeight = 32, OdUInt8 fpValue = 0xFF) const;
258 
270  OdUInt32 nWidth = 32, OdUInt32 nHeight = 32,
271  ODCOLORREF backgroundColor = ODRGB(0, 0, 0),
272  ODCOLORREF foregroundColor = ODRGB(255, 255, 255)) const;
273 
277  const PsFillstyleGDI *getGDIDefinitions() const;
282  const PsFillstyleGDI &getGDIDefinition(OdPs::FillStyle psFs) const;
283 
287  const PsFillstyleOGL *getOpenGLDefinitions() const;
292  const PsFillstyleOGL &getOpenGLDefinition(OdPs::FillStyle psFs) const;
293  protected:
294  void internalFillHatchDef(OdPs::FillStyle psFs, OdHatchPattern &pPat, double scale) const;
296  ODCOLORREF backgroundColor = ODRGB(0, 0, 0),
297  ODCOLORREF foregroundColor = ODRGB(255, 255, 255)) const;
298  private:
299  void internalDebugMe() const;
300 };
301 
306 
307 #include "TD_PackPop.h"
308 
309 #endif //#ifndef __ODGIPSDEFS_H__
OdGiPsLinetypes::PsLinetypeDef::m_numDashes
int m_numDashes
Definition: GiPlotStyleDefs.h:60
OdGiPsLinetypes::PsLinetypeOGL::m_patternLength
OdUInt16 m_patternLength
Definition: GiPlotStyleDefs.h:90
OdGiPsLinetypes::kPsDefs
@ kPsDefs
Definition: GiPlotStyleDefs.h:49
OdGiPsLinetypes::getOpenGLDefinitions
const PsLinetypeOGL * getOpenGLDefinitions() const
OdGiPsLinetypes::getPsDefinition
const PsLinetypeDef & getPsDefinition(OdPs::LineType psLtp) const
OdGiLinetype
Definition: GiLinetype.h:89
GiRasterImage.h
OdUInt8
unsigned char OdUInt8
Definition: OdPlatformSettings.h:759
OdGiPsLinetypes::PsLinetypeOGL::m_pattern
OdUInt16 m_pattern
Definition: GiPlotStyleDefs.h:91
OdGiPsLinetypes::PsLinetypeDef
Definition: GiPlotStyleDefs.h:59
scale
scale
Definition: DimVarDefs.h:1684
OdPs::kFsLast
@ kFsLast
Definition: PlotStyles.h:65
OdGiPsFillstyles::getGiDefinition
const OdHatchPattern & getGiDefinition(OdPs::FillStyle psFs, OdHatchPattern &pPat, double scale) const
OdGiPsLinetypes::internalMakeImage
OdGiRasterImagePtr internalMakeImage(const OdUInt8 *pPixels, OdUInt32 nWidth, OdUInt32 numLevels=1, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
PlotStyles.h
OdGiPsFillstyles
Definition: GiPlotStyleDefs.h:205
OdGiPsFillstyles::getOpenGLDefinition
const PsFillstyleOGL & getOpenGLDefinition(OdPs::FillStyle psFs) const
OdGiPsLinetypes::PsLinetypeGDI
Definition: GiPlotStyleDefs.h:72
OdGiPsLinetypes::OdGiPsLinetypes
OdGiPsLinetypes(bool bInitialize=true, OdUInt32 nDefs=kGiDefs|kGDIDefs|kOpenGLDefs)
odgiGetPsFillstylesManager
ODGI_EXPORT OdGiPsFillstyles & odgiGetPsFillstylesManager()
OdPs::kLtpLast
@ kLtpLast
Definition: PlotStyles.h:123
OdGiPsLinetypes::isInitialized
bool isInitialized(OdUInt32 nDefs=kPsDefs) const
OdArray< OdGiLinetype >
TD_PackPop.h
OdGiPsFillstyles::internalFillHatchDef
void internalFillHatchDef(OdPs::FillStyle psFs, OdHatchPattern &pPat, double scale) const
OdUInt16
unsigned short OdUInt16
Definition: OdPlatformSettings.h:760
ODRGB
#define ODRGB(r, g, b)
Definition: OdPlatform.h:884
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
ODGI_EXPORT
#define ODGI_EXPORT
Definition: GiExport.h:35
OdGiPsFillstyles::getGiDefinitions
const OdHatchPattern * getGiDefinitions(OdHatchPattern *pPats, double scale, OdUInt32 nFirst=OdPs::kFsSolid+1, OdUInt32 nPats=OdPs::kFsLast - OdPs::kFsSolid - 1) const
OdGiPsLinetypes::getOpenGLDefinition
const PsLinetypeOGL & getOpenGLDefinition(OdPs::LineType psLtp) const
OdGiPsFillstyles::OdGiPsFillstyles
OdGiPsFillstyles()
OdGiPsLinetypes::internalInitGDILinetypes
void internalInitGDILinetypes()
OdGiPsFillstyles::fsRigth
bool fsRigth(OdPs::FillStyle fs) const
Definition: GiPlotStyleDefs.h:217
OdSmartPtr< OdGiRasterImage >
OdGiPsFillstyles::rasterizeFillstyleImage
OdGiRasterImagePtr rasterizeFillstyleImage(OdPs::FillStyle psFs, OdUInt32 nOffsetX=0, OdUInt32 nOffsetY=0, OdUInt32 nWidth=32, OdUInt32 nHeight=32, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
OdGiPsFillstyles::getGDIDefinition
const PsFillstyleGDI & getGDIDefinition(OdPs::FillStyle psFs) const
OdGiPsFillstyles::getOpenGLDefinitions
const PsFillstyleOGL * getOpenGLDefinitions() const
OdGiPsLinetypes::internalInitOpenGLLinetypes
void internalInitOpenGLLinetypes()
OdPs::kFsSolid
@ kFsSolid
Definition: PlotStyles.h:54
OdGiPsFillstyles::getGDIDefinitions
const PsFillstyleGDI * getGDIDefinitions() const
OdPs::LineType
LineType
Definition: PlotStyles.h:89
OdGiPsLinetypes::PsLinetypeOGL
Definition: GiPlotStyleDefs.h:89
OdGiPsLinetypes::getGDIDefinitions
const PsLinetypeGDI * getGDIDefinitions() const
OdGiPsLinetypes::getGDIDefinition
const PsLinetypeGDI & getGDIDefinition(OdPs::LineType psLtp) const
OdGiPsFillstyles::rasterizeFillstyle
OdUInt8Array rasterizeFillstyle(OdPs::FillStyle psFs, OdUInt32 nOffsetX=0, OdUInt32 nOffsetY=0, OdUInt32 nWidth=32, OdUInt32 nHeight=32, OdUInt8 fpValue=0xFF) const
OdGiPsLinetypes::~OdGiPsLinetypes
~OdGiPsLinetypes()
OdGiPsLinetypes
Definition: GiPlotStyleDefs.h:42
OdGiPsLinetypes::getPsDefinitions
const PsLinetypeDef * getPsDefinitions() const
TD_PackPush.h
GiLinetype.h
OdGiPsLinetypes::m_giLinetypeDefs
OdArray< OdGiLinetype > m_giLinetypeDefs
Definition: GiPlotStyleDefs.h:95
OdGiPsLinetypes::getGiDefinitions
const OdArray< OdGiLinetype > & getGiDefinitions() const
OdGiPsLinetypes::PsLinetypeGDI::patternLength
OdUInt32 patternLength() const
OdGiPsFillstyles::internalMakeImage
OdGiRasterImagePtr internalMakeImage(const OdUInt8 *pPixels, OdUInt32 nWidth, OdUInt32 nHeight, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
OdGiPsLinetypes::PsLinetypeGDI::m_numDashes
OdUInt32 m_numDashes
Definition: GiPlotStyleDefs.h:73
OdGiPsLinetypes::rasterizeLinetypeImage
OdGiRasterImagePtr rasterizeLinetypeImage(OdPs::LineType psLtp, OdUInt32 numRepititions=1, OdUInt32 numLevels=1, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
GiExport.h
odgiGetPsLinetypesManager
ODGI_EXPORT OdGiPsLinetypes & odgiGetPsLinetypesManager(OdUInt32 nDefs=OdGiPsLinetypes::kPsDefs)
UInt8Array.h
OdGiPsLinetypes::m_pMutex
OdMutex * m_pMutex
Definition: GiPlotStyleDefs.h:98
OdGiPsFillstyles::~OdGiPsFillstyles
~OdGiPsFillstyles()
HatchPattern.h
OdGiPsLinetypes::PsLinetypeGDI::clean
void clean()
ODCOLORREF
#define ODCOLORREF
Definition: OdPlatform.h:883
OdGiPsLinetypes::rasterizeLinetype
OdUInt8Array rasterizeLinetype(OdPs::LineType psLtp, OdUInt32 numRepititions=1, OdUInt8 ltpValue=0xFF) const
OdGiPsLinetypes::DefType
DefType
Definition: GiPlotStyleDefs.h:48
OdGiPsLinetypes::initialize
void initialize(OdUInt32 nDefs=kPsDefs)
OdGiPsLinetypes::getGiDefinition
const OdGiLinetype & getGiDefinition(OdPs::LineType psLtp) const
OdPs::FillStyle
FillStyle
Definition: PlotStyles.h:53
OdGiPsLinetypes::uninitialize
void uninitialize(OdUInt32 nDefs=kPsDefs|kGiDefs|kGDIDefs|kOpenGLDefs)
OdGiPsFillstyles::fsCorr
OdUInt32 fsCorr(OdPs::FillStyle fs) const
Definition: GiPlotStyleDefs.h:216
OdMutex
Definition: OdMutex.h:50
OdGiPsLinetypes::PsLinetypeDef::patternLength
double patternLength() const
OdGiPsLinetypes::internalInitGiLinetypes
void internalInitGiLinetypes()