DgnColorMap.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 
11 #include "ColorUtil.h"
12 
14 
16 
17 //=======================================================================================
21 //=======================================================================================
22 struct DgnColorMap : public RefCountedBase
23 {
24 public:
25 
26 // NOTE: INDEX_Count is padded beyond INDEX_ByLevel so the color entries and be used as a "light-weight" BSIColorDescr...
27 enum Entries
28  {
29  INDEX_ColorCount = 256,
30  INDEX_Background = 255,
31  INDEX_Invalid = -1,
32  };
33 
34 private:
35  virtual void MakeClassAbstract() = 0;
36 public:
37 public:
38 
42 DGNPLATFORM_EXPORT UInt32* GetTbgrColorsP ();
43 
47 DGNPLATFORM_EXPORT void GetRgbColors (RgbColorDef* colors); // Background color is index 0
48 
52 DGNPLATFORM_EXPORT void GetHsvColors (HsvColorDef* colors); // Background color is index 0
53 
59 DGNPLATFORM_EXPORT IntColorDef const& GetColor (int index);
60 
66 DGNPLATFORM_EXPORT UInt32 FindClosestMatch (IntColorDef const& colorDef, HsvColorDef* preComputedHSVTable = NULL);
67 
71 DGNPLATFORM_EXPORT StatusInt SetForFile (DgnFileP dgnFile, WCharCP name);
72 
75 static DGNPLATFORM_EXPORT DgnColorMapPtr CreateFromRgbColors (RgbColorDef const* colors);
76 
79 static DGNPLATFORM_EXPORT DgnColorMapPtr CreateFromTbgrColors (UInt32 const* colors);
80 
83 static DGNPLATFORM_EXPORT DgnColorMapPtr CreateDefaultForFileType (DgnFileFormatType format);
84 
91 static DGNPLATFORM_EXPORT DgnColorMapP GetForDisplay (DgnModelRefP modelRef);
92 
97 static DGNPLATFORM_EXPORT DgnColorMapP GetForFile (DgnFileP dgnFile);
98 
105 static DGNPLATFORM_EXPORT StatusInt GetColorTableDescription (WCharP name, int bufferSize, DgnFileP dgnFile);
106 
117 static DGNPLATFORM_EXPORT StatusInt ExtractElementColorInfo (IntColorDef* colorDef, UInt32* colorIndex, bool* isTrueColor, WStringP bookName, WStringP colorName, UInt32 elementColor, DgnFileR dgnFile);
118 
130 static DGNPLATFORM_EXPORT UInt32 CreateElementColor (IntColorDef const& colorDef, WCharCP bookName, WCharCP colorName, DgnFileR dgnFile);
131 };
132 
Definition: DgnPlatform.h:1496
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
wchar_t * WCharP
Definition: Bentley.h:225
Entries
Definition: DgnColorMap.h:27
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
A DgnFile is an in-memory representation of a physical file, regardless of its format.
Definition: DgnFile.h:308
wchar_t const * WCharCP
Definition: Bentley.h:224
DgnFileFormatType
Known file formats supported by DgnPlatform.
Definition: DgnPlatform.r.h:1043
uint32_t UInt32
Definition: Bentley.r.h:128
#define NULL
Definition: Bentley.h:157
RefCountedPtr< DgnColorMap > DgnColorMapPtr
Definition: DgnColorMap.h:15
A DgnModelRef provides access to a model in a Bentley::DgnPlatform::DgnFile.
Definition: DgnModelRef.h:172
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
Reference counted class for storing information about a MicroStation color table. ...
Definition: DgnColorMap.h:22
Union that allows a color to be accessed as a UInt32 (in form TBGR), RgbColorDef, or RgbaColorDef...
Definition: ColorUtil.h:81
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
int StatusInt
Definition: Bentley.h:222
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
Definition: DgnPlatform.r.h:339
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.