00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef INC_MI32_MATTE_H
00043 #define INC_MI32_MATTE_H
00044
00045 #ifndef INC_MI32_COLOR_H
00046 #include <mi32/color.h>
00047 #endif
00048
00049 #ifndef INC_MI32_SERIALIZABLEE_H
00050 #include <mi32/serializable.h>
00051 #endif
00052
00053 #ifndef INC_MI32_SCRNUNIT_H
00054 #include <mi32/scrnunit.h>
00055 #endif
00056
00057 #ifndef INC_MI32_MISTRING_H
00058 #include <mi32/mistring.h>
00059 #endif
00060
00061 #ifndef GENERATING_DOXYGEN_OUTPUT
00062 namespace MGD {
00063 class CONTEXT;
00064 }
00065 #endif
00066
00067
00068 class MATTE : public SERIALIZABLE {
00069 public:
00070
00071 enum DRAWFLAGS {
00072 DRAWFLAG_None = 0,
00073 DRAWFLAG_DrawInsideExtents = 0x00000001
00074 };
00075
00076 enum FILLMODE {
00077 FILLMODE_None = 0,
00078 FILLMODE_Solid = 1,
00079 FILLMODE_Gradient,
00080 FILLMODE_Radial
00081 };
00082
00083 enum SPREADMODE {
00084 SPREADMODE_RGB = 0,
00085 SPREADMODE_HISCW,
00086 SPREADMODE_HISCCW,
00087 SPREADMODE_HBSCW,
00088 SPREADMODE_HBSCCW
00089 };
00090
00091 enum BORDER {
00092 BORDER_None = 0,
00093 BORDER_Solid = 1,
00094 BORDER_Double = 2,
00095 BORDER_Inset = 3,
00096 BORDER_Outset = 4,
00097 BORDER_Groove = 5,
00098 BORDER_Ridge = 6,
00099 BORDER_EtchedIn = 7,
00100 BORDER_EtchedOut = 8,
00101 BORDER_Rounded = 9,
00102 BORDER_CartoScript = 10
00103 };
00104
00105 class FORM;
00106
00108 MATTE();
00109
00111 MATTE (const MATTE&);
00112
00114 virtual ~MATTE();
00115
00116 MATTE& operator= (
00117 const MATTE& rhs
00118 );
00119
00121 virtual ERRVALUE SerialRead (
00122 SERIALIZER& serializer
00123 );
00124
00125 virtual ERRVALUE SerialWrite (
00126 SERIALIZER& serializer,
00127 const char* tagname
00128 ) const;
00129
00134 ERRVALUE Draw (
00135 MGD::CONTEXT& gc,
00136 const LRECT2D& rect,
00137 double MapScale = 1.0,
00138 DRAWFLAGS flags = DRAWFLAG_None
00139 );
00140
00145 ERRVALUE DrawBackground (
00146 MGD::CONTEXT& gc,
00147 const LRECT2D& rect,
00148 double MapScale = 1.0,
00149 DRAWFLAGS flags = DRAWFLAG_None
00150 );
00151
00156 ERRVALUE DrawBorder (
00157 MGD::CONTEXT& gc,
00158 const LRECT2D& rect,
00159 double MapScale = 1.0,
00160 DRAWFLAGS flags = DRAWFLAG_None
00161 );
00162
00167 ERRVALUE DrawDropShadow (
00168 MGD::CONTEXT& gc,
00169 const LRECT2D& rect,
00170 double MapScale = 1.0,
00171 DRAWFLAGS flags = DRAWFLAG_None
00172 );
00173
00174
00175
00176
00178 const COLOR& GetBackgroundColor (
00179 ) const {
00180 return m_BGColor1;
00181 }
00182
00184 const COLOR& GetBackgroundColor2 (
00185 ) const {
00186 return m_BGColor2;
00187 }
00188
00190 FILLMODE GetBackgroundFillMode (
00191 ) const {
00192 return m_BGFillMode;
00193 }
00194
00195 double GetBackgroundGradientAngle (
00196 ) const {
00197 return m_BGGradientAngle;
00198 }
00199
00200 SPREADMODE GetBackgroundGradientSpreadMode (
00201 ) const {
00202 return m_BGSpreadMode;
00203 }
00204
00205 const MISTRING& GetBorderCartoScript (
00206 ) const {
00207 return m_BorderCartoScript;
00208 }
00209
00211 const COLOR& GetBorderColor (
00212 ) const {
00213 return m_BorderColor;
00214 }
00215
00218 double GetBorderSize (
00219 ) const {
00220 return m_BorderSize;
00221 }
00222
00224 BORDER GetBorderStyle (
00225 ) const {
00226 return m_BorderStyle;
00227 }
00228
00230 bool GetDropShadowBlend (
00231 ) const {
00232 return (m_DSBlend);
00233 }
00234
00236 const COLOR& GetDropShadowColor (
00237 ) const {
00238 return m_DSColor;
00239 }
00240
00245 void GetExtraExtents (
00246 double& x1,
00247 double& y1,
00248 double& x2,
00249 double& y2
00250 ) const;
00251
00253 double GetDropShadowDirection (
00254 ) const {
00255 return m_DSDirection;
00256 }
00257
00259 double GetDropShadowSize (
00260 ) const {
00261 return m_DSSize;
00262 }
00263
00265 double GetMarginBottom (
00266 ) const {
00267 return m_MarginBottom;
00268 }
00269
00271 double GetMarginLeft (
00272 ) const {
00273 return m_MarginLeft;
00274 }
00275
00277 double GetMarginRight (
00278 ) const {
00279 return m_MarginRight;
00280 }
00281
00283 double GetMarginTop (
00284 ) const {
00285 return m_MarginTop;
00286 }
00287
00290 SCREENUNIT GetDisplayUnits (
00291 ) const {
00292 return m_SizeUnits;
00293 }
00294
00295 bool IsBorderRoundedRect (
00296 ) const {
00297 return m_BorderRoundRect;
00298 }
00299
00302 bool NeedsTransparency (
00303 ) const;
00304
00305
00306
00308 void SetBackgroundColor (
00309 const COLOR& color
00310 ) {
00311 m_BGColor1 = color;
00312 }
00313
00315 void SetBackgroundColor2 (
00316 const COLOR& color
00317 ) {
00318 m_BGColor2 = color;
00319 }
00320
00322 void SetBackgroundFillMode (
00323 FILLMODE mode
00324 ) {
00325 m_BGFillMode = mode;
00326 }
00327
00328 void SetBackgroundGradientAngle (
00329 double angle
00330 ) {
00331 m_BGGradientAngle = angle;
00332 }
00333
00334 void SetBackgroundGradientSpreadMode (
00335 SPREADMODE mode
00336 ) {
00337 m_BGSpreadMode = mode;
00338 }
00339
00340 void SetBorderCartoScript (
00341 const MISTRING& script
00342 ) {
00343 m_BorderCartoScript = script;
00344 }
00345
00347 void SetBorderColor (
00348 const COLOR& color
00349 ) {
00350 m_BorderColor = color;
00351 }
00352
00356 void SetBorderIsRoundedRect (
00357 bool bRound
00358 ) {
00359 m_BorderRoundRect = bRound;
00360 }
00361
00363 void SetBorderSize (
00364 double size
00365 ) {
00366 m_BorderSize = size;
00367 }
00368
00370 void SetBorderStyle (
00371 BORDER style
00372 ) {
00373 m_BorderStyle = style;
00374 }
00375
00377 void SetDropShadowBlend (
00378 bool blend
00379 ) {
00380 m_DSBlend = blend;
00381 }
00382
00384 void SetDropShadowColor (
00385 const COLOR& color
00386 ) {
00387 m_DSColor = color;
00388 }
00389
00391 void SetDropShadowDirection (
00392 double dir
00393 ) {
00394 m_DSDirection = dir;
00395 }
00396
00398 void SetDropShadowSize (
00399 double size
00400 ) {
00401 m_DSSize = size;
00402 }
00403
00405 void SetMarginBottom (
00406 double dist
00407 ) {
00408 m_MarginBottom = dist;
00409 }
00410
00412 void SetMarginLeft (
00413 double dist
00414 ) {
00415 m_MarginLeft = dist;
00416 }
00417
00419 void SetMarginRight (
00420 double dist
00421 ) {
00422 m_MarginRight = dist;
00423 }
00424
00426 void SetMarginTop (
00427 double dist
00428 ) {
00429 m_MarginTop = dist;
00430 }
00431
00434 void SetDisplayUnits (
00435 SCREENUNIT units
00436 ) {
00437 m_SizeUnits = units;
00438 }
00439
00440
00441
00446 void SetSolidBackground (
00447 const COLOR& color
00448 ) {
00449 m_bSolidBackground = true;
00450 m_PageColor = color;
00451 return;
00452 }
00453
00455 void SetDirtyBackground (
00456 ) {
00457 m_bSolidBackground = false;
00458 return;
00459 }
00460
00461 void SetMarginsInset (
00462 bool inset
00463 ) {
00464 m_bMarginsInset = inset;
00465 }
00466
00467 bool WillDraw (
00468 ) const;
00469
00470 private:
00471 #ifndef GENERATING_DOXYGEN_OUTPUT
00472 COLOR m_BGColor1;
00473 COLOR m_BGColor2;
00474 FILLMODE m_BGFillMode;
00475 double m_BGGradientAngle;
00476 SPREADMODE m_BGSpreadMode;
00477 double m_MarginLeft;
00478 double m_MarginRight;
00479 double m_MarginTop;
00480 double m_MarginBottom;
00481 SCREENUNIT m_SizeUnits;
00482 COLOR m_DSColor;
00483 double m_DSDirection;
00484 double m_DSSize;
00485 bool m_DSBlend;
00486 COLOR m_BorderColor;
00487 double m_BorderSize;
00488 BORDER m_BorderStyle;
00489 bool m_BorderRoundRect;
00490 MISTRING m_BorderCartoScript;
00491 bool m_bMarginsInset;
00492 COLOR m_PageColor;
00493 bool m_bSolidBackground;
00494
00495 static const SERIALIZERITEM* SerialGetItemDef (
00496 SERIALIZER& serializer
00497 );
00498
00499 friend class MATTEPRIV;
00500 #endif // GENERATING_DOXYGEN_OUTPUT
00501 };
00502
00503 #endif