Mobile API Reference  MicroStrategy 2019
FormatFill.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : FormatFill.h
3 // AUTHOR : Liang Liu, Bing Huang
4 // CREATION : 2008-09-25
5 // Copyright (C) MicroStrategy Incorporated 2008
6 // All Rights Reserved
7 //==============================================================================================
8 #ifndef MsiChart_FormatFill_h
9 #define MsiChart_FormatFill_h
10 
11 #include "PDCHeader/PDCvector"
12 #include "Base/Base/BaseString.h"
13 #include "Synch/Defines/SmartPtr.h"
14 #include "RGBColor.h"
15 #include "Rect2D.h"
16 #include "../Common.h"
17 #include <map>
18 
19 struct _cairo;
20 typedef struct _cairo cairo_t;
21 
22 struct _cairo_surface;
23 typedef struct _cairo_surface cairo_surface_t;
24 
25 struct tagVARIANT;
26 typedef struct tagVARIANT VARIANT;
27 
28 namespace MsiChart
29 {
30  extern const RGBColor gBlack;
31  extern const RGBColor gWhite;
32 
34  typedef enum
35  {
40 
42  typedef enum
43  {
44  // Make the values consistent with the corresponding enum in DSSCOMMater_i.h
45  FT_SIMPLE = 0,
49  FT_PATTERN = 101
50  }EnumFillType; // Need not include Bevel.
51 
52 
54  typedef enum
55  {
56  // FT_Texture and FT_Picture
61 
62  // FT_TEXTURE ONLY
65  }EnumFillFlip;
66 
67  typedef enum{
77 
80  {
84  , mAngle(0)
85  , mHorizontalOffset(50)
86  , mVerticalOffset(50)
88  , mEndAlpha(0){}
91  std::vector<unsigned char> mStepAlpha;
92  std::vector<RGBColor> mStepGraphColor;
93  std::vector<float> mStepLocation;
94  Int32 mAngle; // 0~360
95  unsigned char mHorizontalOffset; // 0~100
96  unsigned char mVerticalOffset; // 0~100
97  unsigned char mGradientType; // EnumGradientType
98  unsigned char mEndAlpha;
99  };
100 
103  {
107  , mPatternId(28){}
110  unsigned char mPatternId;
111  };
112 
114  /*struct GraphFillTexture
115  {
116  GraphFillTexture()
117  : mFillFlip(FF_NO_FLIPPING){}
118  unsigned char mFillFlip; // EnumFillFlip
119  MBase::String mTextureFile;
120  };*/
121 
124  {
129  , mNameLength(0){}
130  unsigned char mFillFlip; // EnumFillFlip
131  unsigned char mScaleType;
132  unsigned char mPictureFormat;
133  unsigned char mNameLength;
136  };
137 
140  {
143  , mDepth(0)
144  , mLightAngle(270)
145  , mIntensity(10) {}
146  unsigned char mFillBevelType;
147  unsigned char mDepth;
149  unsigned char mIntensity;
150  };
151 
152  class ChartContext;
153 
161  {
162  public:
165  FormatFill(const RGBColor& irSimpleColor = gWhite, unsigned char iAlpha = 255);
166 
173  bool GetOptions(Int32 iPropertyId, CComVariant* opValue) const;
174 
181  void MakeDarker(float iFactor);
186  void RestoreColor();
191  void FillSimple(ChartContext* ipChartContext) const;
197  void FillGradient(ChartContext* ipChartContext, const Rect2D& irBoundingRect) const;
202  void FillPattern(ChartContext* ipChartContext) const;
208  void FillEdgeType(ChartContext* ipChartContext, const std::vector<Point2D>& irPolygon) const;
215  void FillDonutOrSphere(ChartContext* ipChartContext, const Rect2D& irBoundingRect, bool iIsCircularShape) const;
216 
225  void EnhancedSeriesEffect(Int32 iTransparency, Int32 iBevelType, Int32 iDepth, Int32 iBevelAngle, Int32 iIntensity);
226  //lizhang, de41340, 20160908, add this method to check whether two formatfill is equal, specially for legend marker with threshold color
227  bool IsFormatFillEqual(FormatFill::Ptr iComparedFormat);
228  inline void SetResolvedInDataSet(const bool iFlag ,const EnumFormatFillMembers iMember);
229  inline bool IsResolvedInDataSet(const EnumFormatFillMembers iMember) const;
230 #ifndef _VE_CE
231 
235  void ApplyRadialGradientForSurface(CGContextRef iCGContextRef) const;
236 #endif
237 
238  //private:
239  static float hRatioInRectangle(const Rect2D& irRect, Int32 iAngle, const FPoint2D& irAnchorPoint, FPoint2D& orStartPoint, FPoint2D& orEndPoint);
240 
241  private:
253  bool hGetAreaDepth(const std::vector<FPoint2D>& irPolygon, float& orMaxDepth) const;
254 
262  void hGetNewPolygon(const std::vector<FPoint2D>& irPolygon, Int32 iCurrent, std::vector<FPoint2D>& orPolygon) const;
271  bool hGetNewAreaDepth(const std::vector<FPoint2D>& irPolygon, float& orMaxDepth) const;
272 
281  void hGetAngularBisectorIntersectionPoint(const FPoint2D& irA, const FPoint2D& irB, const FPoint2D& irC, float irDepth, FPoint2D& orPointStart, FPoint2D& orPointEnd) const;
282 
289  bool hPointInRange(const FPoint2D& irPoint, const FPoint2D& irA, const FPoint2D& irB, const FPoint2D& irC, const FPoint2D& irD) const;
290 
299  bool hGetBisectorPointAndDepth(const FPoint2D& irA, const FPoint2D& irB, const FPoint2D& irC, const FPoint2D& irD, FPoint2D& orBisectorPoint, float& orDistance) const;
300 
307  float hGetTriangleAreaDouble(const FPoint2D& irA, const FPoint2D& irB, const FPoint2D& irC) const;
308 
314  bool hIsFPointsEqual(const FPoint2D& irA, const FPoint2D& irB) const;
315 
316  // data members
317  public:
318  unsigned char mFillType;
319  unsigned char mAlpha;
323  //GraphFillTexture mFillTexture; ///< Stores texture options which is used when mFillType is FT_TEXTURE.
327 
329  };
330  inline void FormatFill::SetResolvedInDataSet(const bool iFlag ,const EnumFormatFillMembers iMember)
331  {
332  mClassMemberMap ^= iFlag << iMember;
333  }
335  {
336  return (mClassMemberMap & 1 << iMember) != 0;
337  }
338 }
339 #endif
GraphFillGradient()
Definition: FormatFill.h:81
Definition: FormatFill.h:63
FormatFill(const RGBColor &irSimpleColor=gWhite, unsigned char iAlpha=255)
Constructor.
unsigned char mFillType
Fill type should be a value in EnumFillType.
Definition: FormatFill.h:318
void EnhancedSeriesEffect(Int32 iTransparency, Int32 iBevelType, Int32 iDepth, Int32 iBevelAngle, Int32 iIntensity)
Definition: FormatFill.h:58
Definition: FormatFill.h:160
unsigned char mFillBevelType
Definition: FormatFill.h:146
EnumFormatFillMembers
Definition: FormatFill.h:67
static float hRatioInRectangle(const Rect2D &irRect, Int32 iAngle, const FPoint2D &irAnchorPoint, FPoint2D &orStartPoint, FPoint2D &orEndPoint)
Definition: FormatFill.h:75
Int32 mLightAngle
Definition: FormatFill.h:148
void FillGradient(ChartContext *ipChartContext, const Rect2D &irBoundingRect) const
bool GetOptions(Int32 iPropertyId, CComVariant *opValue) const
std::vector< unsigned char > mStepAlpha
Definition: FormatFill.h:91
RGBColor mForegroundColor
Definition: FormatFill.h:108
void MakeDarker(float iFactor)
unsigned char mEndAlpha
Definition: FormatFill.h:98
GraphFillPicture()
Definition: FormatFill.h:125
Definition: FormatFill.h:60
Definition: FormatFill.h:73
RGBColor mStartGraphColor
Definition: FormatFill.h:89
GraphFillPattern mFillPattern
Stores pattern options which is used when mFillType is FT_PATTERN.
Definition: FormatFill.h:322
unsigned char mHorizontalOffset
Definition: FormatFill.h:95
Definition: FormatFill.h:69
const RGBColor gWhite
Definition: FormatLine.h:111
Definition: FormatFill.h:47
struct _cairo cairo_t
Definition: BezierCurve.h:16
void FillSimple(ChartContext *ipChartContext) const
Definition: FormatFill.h:48
bool IsFormatFillEqual(FormatFill::Ptr iComparedFormat)
RGBColor mBackgroundColor
Definition: FormatFill.h:109
unsigned char mVerticalOffset
Definition: FormatFill.h:96
RGBColor mEndGraphColor
Definition: FormatFill.h:90
void SetResolvedInDataSet(const bool iFlag, const EnumFormatFillMembers iMember)
Definition: FormatFill.h:330
#define Int32
Definition: BasicTypes.h:20
GraphFillPicture mFillPicture
Stores picture options which is used when mFillType is FT_PICTURE.
Definition: FormatFill.h:324
unsigned char mDepth
Definition: FormatFill.h:147
unsigned char mGradientType
Definition: FormatFill.h:97
GraphFillGradient mFillGradient
Stores gradient options which is used when mFillType is FT_GRADIENT.
Definition: FormatFill.h:321
MBase::StrongArrayPtr< char > mPictureFilePtr
Definition: FormatFill.h:134
Definition: FormatFill.h:71
Definition: DSSIPhoneEnums.h:1781
Definition: FormatFill.h:45
Keep texture options.
Definition: FormatFill.h:123
bool mDarkerColor
Definition: FormatFill.h:326
Definition: DSSIPhoneEnums.h:1739
Definition: FormatFill.h:49
unsigned char mFillFlip
Definition: FormatFill.h:130
unsigned char mAlpha
Alpha should be an integer in range 0~255.
Definition: FormatFill.h:319
Definition: FormatFill.h:46
Int32 mClassMemberMap
Definition: FormatFill.h:328
struct _cairo_surface cairo_surface_t
Definition: FormatFill.h:23
void FillPattern(ChartContext *ipChartContext) const
Definition: ChartContext.h:542
unsigned char mNameLength
Definition: FormatFill.h:133
EnumFillType
Enumeration of FormatFill type.
Definition: FormatFill.h:42
Keep bevel options.
Definition: FormatFill.h:139
GraphFillBevel mFillBevel
Stores gradient options which is is used for Bevel.
Definition: FormatFill.h:325
Definition: FormatFill.h:64
Definition: FormatFill.h:59
std::vector< float > mStepLocation
Definition: FormatFill.h:93
Definition: ABLPlot.h:21
bool IsResolvedInDataSet(const EnumFormatFillMembers iMember) const
Definition: FormatFill.h:334
unsigned char mIntensity
Definition: FormatFill.h:149
Definition: FormatFill.h:36
Keep pattern options.
Definition: FormatFill.h:102
TripleId mTripleId
Definition: FormatFill.h:135
void FillDonutOrSphere(ChartContext *ipChartContext, const Rect2D &irBoundingRect, bool iIsCircularShape) const
EnumFillFlip
Enumeration of fliping type.
Definition: FormatFill.h:54
Definition: Msi_variant.h:147
Definition: FormatFill.h:70
MSynch::SmartPtr< FormatFill > Ptr
Definition: FormatFill.h:163
keep gradient options.
Definition: FormatFill.h:79
unsigned char mScaleType
Definition: FormatFill.h:131
GraphFillPattern()
Definition: FormatFill.h:104
EnumRadientGradientUsage
Enumeration for radient gradient usage.
Definition: FormatFill.h:34
Definition: Msi_ccomvariant.h:24
unsigned char mPatternId
Definition: FormatFill.h:110
std::vector< RGBColor > mStepGraphColor
Definition: FormatFill.h:92
Definition: FormatFill.h:74
RGBColor mSimpleColor
This color is used when mFillType is FT_SIMPLE.
Definition: FormatFill.h:320
Int32 mAngle
Definition: FormatFill.h:94
Definition: DSSIPhoneEnums.h:1764
Definition: RGBColor.h:21
Definition: DSSIPhoneEnums.h:817
unsigned char mPictureFormat
Definition: FormatFill.h:132
void ApplyRadialGradientForSurface(CGContextRef iCGContextRef) const
const RGBColor gBlack
Definition: FormatLine.h:110
void FillEdgeType(ChartContext *ipChartContext, const std::vector< Point2D > &irPolygon) const
Use four Int32 values to represent a 2D rectangle.
Definition: Rect2D.h:25
Definition: FormatFill.h:37
Definition: FormatFill.h:38
GraphFillBevel()
Definition: FormatFill.h:141
Definition: FormatFill.h:72
Definition: Common.h:397
Definition: FormatFill.h:68
Definition: FormatFill.h:57