CFx SDK Documentation  2022 SP0
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__
scale
Definition: DimVarDefs.h:1684
#define ODGI_EXPORT
Definition: GiExport.h:35
ODGI_EXPORT OdGiPsFillstyles & odgiGetPsFillstylesManager()
ODGI_EXPORT OdGiPsLinetypes & odgiGetPsLinetypesManager(OdUInt32 nDefs=OdGiPsLinetypes::kPsDefs)
#define ODRGB(r, g, b)
Definition: OdPlatform.h:884
#define ODCOLORREF
Definition: OdPlatform.h:883
unsigned int OdUInt32
unsigned short OdUInt16
unsigned char OdUInt8
bool fsRigth(OdPs::FillStyle fs) const
OdGiRasterImagePtr internalMakeImage(const OdUInt8 *pPixels, OdUInt32 nWidth, OdUInt32 nHeight, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
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
const PsFillstyleGDI & getGDIDefinition(OdPs::FillStyle psFs) const
const PsFillstyleOGL * getOpenGLDefinitions() const
const OdHatchPattern & getGiDefinition(OdPs::FillStyle psFs, OdHatchPattern &pPat, double scale) const
const PsFillstyleOGL & getOpenGLDefinition(OdPs::FillStyle psFs) const
const PsFillstyleGDI * getGDIDefinitions() const
const OdHatchPattern * getGiDefinitions(OdHatchPattern *pPats, double scale, OdUInt32 nFirst=OdPs::kFsSolid+1, OdUInt32 nPats=OdPs::kFsLast - OdPs::kFsSolid - 1) const
OdUInt8Array rasterizeFillstyle(OdPs::FillStyle psFs, OdUInt32 nOffsetX=0, OdUInt32 nOffsetY=0, OdUInt32 nWidth=32, OdUInt32 nHeight=32, OdUInt8 fpValue=0xFF) const
void internalFillHatchDef(OdPs::FillStyle psFs, OdHatchPattern &pPat, double scale) const
OdUInt32 fsCorr(OdPs::FillStyle fs) const
const PsLinetypeDef * getPsDefinitions() const
void internalInitOpenGLLinetypes()
const PsLinetypeGDI & getGDIDefinition(OdPs::LineType psLtp) const
const PsLinetypeDef & getPsDefinition(OdPs::LineType psLtp) const
const PsLinetypeOGL & getOpenGLDefinition(OdPs::LineType psLtp) const
OdUInt8Array rasterizeLinetype(OdPs::LineType psLtp, OdUInt32 numRepititions=1, OdUInt8 ltpValue=0xFF) const
OdArray< OdGiLinetype > m_giLinetypeDefs
const PsLinetypeGDI * getGDIDefinitions() const
const PsLinetypeOGL * getOpenGLDefinitions() const
OdGiPsLinetypes(bool bInitialize=true, OdUInt32 nDefs=kGiDefs|kGDIDefs|kOpenGLDefs)
void uninitialize(OdUInt32 nDefs=kPsDefs|kGiDefs|kGDIDefs|kOpenGLDefs)
OdGiRasterImagePtr rasterizeLinetypeImage(OdPs::LineType psLtp, OdUInt32 numRepititions=1, OdUInt32 numLevels=1, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
OdMutex * m_pMutex
OdGiRasterImagePtr internalMakeImage(const OdUInt8 *pPixels, OdUInt32 nWidth, OdUInt32 numLevels=1, ODCOLORREF backgroundColor=ODRGB(0, 0, 0), ODCOLORREF foregroundColor=ODRGB(255, 255, 255)) const
const OdArray< OdGiLinetype > & getGiDefinitions() const
void initialize(OdUInt32 nDefs=kPsDefs)
const OdGiLinetype & getGiDefinition(OdPs::LineType psLtp) const
bool isInitialized(OdUInt32 nDefs=kPsDefs) const
void internalInitGDILinetypes()
void internalInitGiLinetypes()
LineType
Definition: PlotStyles.h:89
@ kLtpLast
Definition: PlotStyles.h:123
FillStyle
Definition: PlotStyles.h:53
@ kFsLast
Definition: PlotStyles.h:65
@ kFsSolid
Definition: PlotStyles.h:54
OdUInt32 patternLength() const