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
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #ifndef INC_NODESHADOWCONTROLLER
00101 #define INC_NODESHADOWCONTROLLER
00102
00103 #ifdef BUILDSHADOWS
00104
00105
00106
00107
00108
00109
00110
00111 enum ShadowType
00112 {
00113 SHADOWTYPE_NONE = 0,
00114 SHADOWTYPE_WALL,
00115 SHADOWTYPE_FLOOR,
00116 SHADOWTYPE_GLOW,
00117 SHADOWTYPE_FEATHER
00118 } ;
00119
00120
00121 typedef enum
00122 {
00123 smOFFSETX = 0x0001,
00124 smOFFSETY = 0x0002,
00125 smPENUMBRA = 0x0004,
00126 smNAME = 0x0008,
00127 smTYPE = 0x0010,
00128 smFLOORANGLE = 0x0020,
00129 smFLOORHEIGHT = 0x0040,
00130 smSCALE = 0x0080,
00131 smGLOWWIDTH = 0x0100,
00132 smFEATHERWIDTH = 0x0200,
00133 smBIASGAIN = 0x0400,
00134 smDARKNESS = 0x0800
00135 } ShadowMaskBits;
00136
00137 const UINT32 SHADOWMASK_ALL = 0xFFF;
00138
00139 typedef struct tagShadowFieldMask
00140 {
00141 tagShadowFieldMask()
00142 {
00143 OffsetX = FALSE;
00144 OffsetY = FALSE;
00145 Penumbra = FALSE;
00146 Name = FALSE;
00147 Type = FALSE;
00148 FloorAngle = FALSE;
00149 FloorHeight = FALSE;
00150 Scale = FALSE;
00151 GlowWidth = FALSE;
00152 FeatherWidth = FALSE;
00153 BiasGain = FALSE;
00154 Darkness = FALSE;
00155 }
00156
00157 tagShadowFieldMask(UINT32 flagbits)
00158 {
00159 OffsetX = ((flagbits & smOFFSETX) == smOFFSETX);
00160 OffsetY = ((flagbits & smOFFSETY) == smOFFSETY);
00161 Penumbra = ((flagbits & smPENUMBRA) == smPENUMBRA);
00162 Name = ((flagbits & smNAME) == smNAME);
00163 Type = ((flagbits & smTYPE) == smTYPE);
00164 FloorAngle = ((flagbits & smFLOORANGLE) == smFLOORANGLE);
00165 FloorHeight = ((flagbits & smFLOORHEIGHT) == smFLOORHEIGHT);
00166 Scale = ((flagbits & smSCALE) == smSCALE);
00167 GlowWidth = ((flagbits & smGLOWWIDTH) == smGLOWWIDTH);
00168 FeatherWidth = ((flagbits & smFEATHERWIDTH) == smFEATHERWIDTH);
00169 BiasGain = ((flagbits & smBIASGAIN) == smBIASGAIN);
00170 Darkness = ((flagbits & smDARKNESS) == smDARKNESS);
00171 }
00172
00173 BOOL OffsetX : 1;
00174 BOOL OffsetY : 1;
00175 BOOL Penumbra : 1;
00176 BOOL Name : 1;
00177 BOOL Type : 1;
00178 BOOL FloorAngle : 1;
00179 BOOL FloorHeight : 1;
00180 BOOL Scale : 1;
00181 BOOL GlowWidth : 1;
00182 BOOL FeatherWidth : 1;
00183 BOOL BiasGain : 1;
00184 BOOL Darkness : 1;
00185 } ShadowFieldMask;
00186
00187
00188 #define MAXSHADOWHEIGHT 1.5
00189 #define MAXSHADOWANGLE (69 * (PI / 180.0))
00190
00191
00192 #include "pathpcs.h"
00193 #include "nodepostpro.h"
00194
00195 class RenderRegion;
00196 class String_32;
00197 class NodeRect;
00198 class CCAttrMap;
00199
00200 class NodeShadow;
00201
00202 class ExtendParams;
00203
00204 class AttrFillGeometry;
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215 class NodeShadowController : public NodeEffect
00216 {
00217 CC_DECLARE_DYNAMIC( NodeShadowController )
00218 public:
00219
00220 NodeShadowController();
00221 ~NodeShadowController();
00222
00223 NodeShadowController(Node* ContextNode,
00224 AttachNodeDirection Direction,
00225 BOOL Locked=FALSE,
00226 BOOL Mangled=FALSE,
00227 BOOL Marked=FALSE,
00228 BOOL Selected=FALSE
00229 );
00230
00231
00232 virtual Node* SimpleCopy();
00233 void CopyNodeContents(NodeShadowController* pNewNode);
00234 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00235
00236
00237 virtual DocRect GetBlobBoundingRect();
00238 virtual void Transform(TransformBase&);
00239
00240
00241 virtual void PreExportRender( RenderRegion* pRender );
00242 virtual BOOL ExportRender( RenderRegion* pRender );
00243 virtual void RenderEorDrag( RenderRegion* );
00244 virtual BOOL ChildrenAreEorDragRenderedByMe() { return TRUE; }
00245
00246
00247 DocRect GetEorDragBoundingRect() { return GetInsideBoundingRect(); }
00248
00249 virtual void RenderTinyBlobs(RenderRegion* pRender);
00250
00251
00252 virtual String Describe(BOOL Plural, BOOL Verbose);
00253 virtual UINT32 GetNodeSize() const;
00254
00255
00256 virtual ChangeCode OnChildChange(ObjChangeParam* pParam);
00257 virtual BOOL AllowOp(ObjChangeParam *pParam, BOOL SetOpPermissionState = TRUE,
00258 BOOL DoPreTriggerEdit = TRUE);
00259
00260
00261 virtual BOOL CanBecomeA(BecomeA* pBecomeA);
00262 virtual BOOL DoBecomeA(BecomeA* pBecomeA);
00263
00264 BOOL ApplyShadowTransform(Path* pTargetPath);
00265
00266
00267 virtual BOOL OnClick( DocCoord, ClickType, ClickModifiers, Spread* );
00268
00269
00270 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00271 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00272
00273 NodeShadow* GetShadow() const;
00274 NodeRenderableInk* GetShadowedNode() const;
00275
00276
00277 virtual NodeRenderableInk* GetInkNodeFromController() const;
00278
00279
00280 MILLIPOINT GetPenumbraWidth() const {return m_PenumbraWidth;}
00281 void SetPenumbraWidth(MILLIPOINT NewWidth) { if (NewWidth > 0) m_PenumbraWidth = NewWidth;
00282 else m_PenumbraWidth = 0; }
00283
00284 MILLIPOINT GetOffsetX() const { return m_OffsetX; }
00285 MILLIPOINT GetOffsetY() const { return m_OffsetY; }
00286 void SetOffsetX(MILLIPOINT xx) { m_OffsetX = xx; }
00287 void SetOffsetY(MILLIPOINT yy) { m_OffsetY = yy; }
00288
00289
00290
00291
00292 void SetShadowType(ShadowType NewType) { m_ShadowType = NewType; }
00293 ShadowType GetShadowType() { return m_ShadowType; }
00294
00295 String_256 GetShadowName() { return m_sShadowName; }
00296 void SetNewShadowName(String_256 sNewName) { m_sShadowName = sNewName; }
00297
00298 BOOL HasShadowSelectionChanged() { return m_ShadowSelectionChanged; }
00299 void ResetShadowSelectionChange() { m_ShadowSelectionChanged = FALSE; }
00300
00301 virtual BOOL PostImport();
00302 BOOL PostDuplicate(UndoableOperation* pOp);
00303
00304 BOOL RegenerateNode(UndoableOperation * pOp, BOOL bCacheRender = FALSE,
00305 BOOL bInformParents = TRUE);
00306
00307
00308 virtual BOOL PromoteHitTestOnChildrenToMe() const { return FALSE; }
00309 virtual BOOL ShouldITransformWithChildren() const { return TRUE; }
00310 virtual BOOL CanSelectAsCompoundParent() {return FALSE;}
00311 virtual BOOL NeedsTransparency() const {return TRUE;}
00312 virtual BOOL IsController() { return TRUE;}
00313 virtual BOOL IsAShadowController() const { return TRUE;}
00314 virtual BOOL AllowSelectInside() const {return TRUE;}
00315 virtual BOOL IsPassThroughEffect() const {return TRUE;}
00316
00317
00318 virtual void SelectInRect(const DocRect& Rect, SelStateAction st);
00319
00320 virtual BOOL CompareState(NodeEffect* pPPNode);
00321 virtual BOOL CompareState(NodeEffect* pPPNode, ShadowFieldMask mask);
00322 virtual DocRect GetChildBoundingRect(BOOL bIncludeAttrs = TRUE);
00323 virtual void InvalidateBoundingRect(BOOL InvalidateChildBounds = FALSE);
00324
00325 #ifdef NEW_SHADOW_RENDER
00326 public:
00327 virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00328 virtual void RenderAfterSubtree(RenderRegion* pRender);
00329
00330 virtual BOOL ReleaseCached(BOOL bAndParents = TRUE,
00331 BOOL bAndChildren = TRUE,
00332 BOOL bSelf = TRUE,
00333 BOOL bAndDerived = TRUE);
00334 virtual BOOL IsCapturingChildren();
00335 virtual void ReleaseStackedShadows();
00336 virtual double GetPixelsPerInch();
00337 virtual double GetPixelWidth();
00338 NodeShadowController* FindBottomShadowController();
00339
00340 protected:
00341 virtual BOOL FindCachedEffect(CBitmapCache* pBitmapCache);
00342 virtual BOOL RenderCachedEffect(CBitmapCache* pBitmapCache, RenderRegion* pRenderRegion);
00343
00344 private:
00345 BOOL IsTopShadowController();
00346 NodeShadow* FindBottomShadow();
00347 NodeShadow* FindShadowAbove(NodeShadow* pCurrentShadow);
00348 BOOL IsInShadowStack();
00349
00350 #endif
00351
00352
00353 public:
00354
00355
00356
00357 void ShowDebugTreeDetails() const;
00358 void GetDebugDetails( StringBase* Str );
00359
00360
00361
00362
00363 INT32 FloorAngleToINT32(double Angle);
00364 double FloorAngleFromINT32(INT32 Angle);
00365
00366 double GetFloorShadowAngle() { return m_FloorShadowAngle; }
00367 float GetFloorShadowHeight() { return m_FloorShadowHeight; }
00368 DocCoord GetFloorShadowVector();
00369 void SetFloorShadowAngle(double Angle) { m_FloorShadowAngle = Angle; }
00370 void SetFloorShadowHeight(float Height) { m_FloorShadowHeight = Height; }
00371 void SetFloorShadowVector(const DocCoord& dcControlVector);
00372
00373 DocCoord GetWallShadowOffset();
00374 float GetWallShadowScale() { return m_Scale; }
00375 void SetWallShadowOffset(const DocCoord& dcOffset, BOOL UpdateNodeShadow);
00376 void SetWallShadowScale(float NewScale) { m_Scale = NewScale; }
00377
00378 MILLIPOINT GetGlowWidth() { return m_GlowWidth; }
00379 void SetGlowWidth(MILLIPOINT NewWidth) { m_GlowWidth = NewWidth; }
00380
00381 MILLIPOINT GetFeatherWidth() { return m_FeatherWidth; }
00382 void SetFeatherWidth(MILLIPOINT NewWidth) { m_FeatherWidth = NewWidth; }
00383
00384 UINT32 GetShadowTransp();
00385
00386 void ResetShadowSettings();
00387
00388 INT32 ComplexHide(UndoableOperation* pOp, Node* pNextInRange);
00389
00390
00391 virtual BOOL IsValidEffectAttr(NodeAttribute* pAttr) const {return FALSE;}
00392 virtual NodeRenderableInk* GetObjectToApplyTo(CCRuntimeClass* AttrType);
00393
00394
00395
00396 public:
00397 virtual BOOL IsTypeExtendible() const { return TRUE; }
00398 virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00399 virtual void Extend(const ExtendParams& ExtParams);
00400
00401
00402 virtual BOOL EndBlendStep(BlendNodeParam* pParam);
00403 virtual NodeRenderableInk* CreateTreeFromNodeToBlend(NodeRenderableInk* pNode, CCAttrMap* pAttrMap);
00404
00405 protected:
00406
00407 BOOL BlendParameters (NodeShadowController * pStart, NodeShadowController * pEnd, BlendNodeParam * pParam, CCAttrMap* pMap);
00408
00409 BOOL BlendParameters(NodeShadowController * pStart, BlendNodeParam * pParam);
00410
00411
00412 protected:
00413 MILLIPOINT m_OffsetX;
00414 MILLIPOINT m_OffsetY;
00415 MILLIPOINT m_PenumbraWidth;
00416
00417 BOOL m_ShadowSelectionChanged;
00418
00419 String_256 m_sShadowName;
00420 ShadowType m_ShadowType;
00421
00422 DocRect m_PreviousRect;
00423
00424 double m_FloorShadowAngle;
00425
00426
00427
00428 float m_FloorShadowHeight;
00429 float m_Scale;
00430 MILLIPOINT m_GlowWidth;
00431 MILLIPOINT m_FeatherWidth;
00432
00433 BOOL m_PerformedExtend;
00434
00436
00437 Path m_GlowDragPath;
00438
00439
00440 public:
00441
00442
00443 static const ShadowType DefaultType;
00444 static const MILLIPOINT DefaultWallOffsetX;
00445 static const MILLIPOINT DefaultWallOffsetY;
00446 static const MILLIPOINT DefaultGlowWidth;
00447 static const MILLIPOINT DefaultFeatherWidth;
00448 static const double DefaultFloorAngle;
00449 static const float DefaultFloorHeight;
00450 static const MILLIPOINT DefaultBlurSize;
00451 static const double DefaultDarkness;
00452 static const double DefaultScale;
00453
00454 static MILLIPOINT DefaultPixelsPerInch;
00455 };
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466 class ShadowNodeTreeFactory : public CompoundNodeTreeFactory
00467 {
00468 CC_DECLARE_DYNCREATE(ShadowNodeTreeFactory);
00469
00470 public:
00471 ShadowNodeTreeFactory();
00472 ~ShadowNodeTreeFactory();
00473
00474
00475 virtual NodeCompound * CreateNode(List *pList, UndoableOperation * pOp = NULL);
00476
00477
00478 MILLIPOINT GetPenumbraWidth() const {return m_PenumbraWidth;}
00479
00480 void SetPenumbraWidth(MILLIPOINT NewWidth) { if (NewWidth > 0) m_PenumbraWidth = NewWidth;
00481 else m_PenumbraWidth = 0; }
00482
00483 MILLIPOINT GetOffsetX() const { return m_OffsetX; }
00484 MILLIPOINT GetOffsetY() const { return m_OffsetY; }
00485 void SetOffsetX(MILLIPOINT xx) { m_OffsetX = xx; }
00486 void SetOffsetY(MILLIPOINT yy) { m_OffsetY = yy; }
00487
00488 void SetShadowType(ShadowType NewType) { m_ShadowType = NewType; }
00489 ShadowType GetShadowType() { return m_ShadowType; }
00490
00491 void SetFloorShadowAngle(double Angle) { m_FloorShadowAngle = Angle; }
00492 void SetFloorShadowHeight(float Height) { m_FloorShadowHeight = Height; }
00493 double GetFloorShadowAngle() { return m_FloorShadowAngle; }
00494 float GetFloorShadowHeight() { return m_FloorShadowHeight; }
00495
00496 float GetWallShadowScale() { return m_Scale; }
00497 void SetWallShadowScale(float NewScale) { m_Scale = NewScale; }
00498
00499 MILLIPOINT GetGlowWidth() { return m_GlowWidth; }
00500 void SetGlowWidth(MILLIPOINT GlowWidth) { m_GlowWidth = GlowWidth; }
00501
00502 MILLIPOINT GetFeatherWidth() { return m_FeatherWidth; }
00503 void SetFeatherWidth(MILLIPOINT FeatherWidth) { m_FeatherWidth = FeatherWidth; }
00504
00505
00506 void SetUpAttributeList(Node * pShadow);
00507
00508 private:
00509 ShadowType m_ShadowType;
00510
00511 MILLIPOINT m_OffsetX;
00512 MILLIPOINT m_OffsetY;
00513 MILLIPOINT m_PenumbraWidth;
00514 double m_FloorShadowAngle;
00515 float m_FloorShadowHeight;
00516 float m_Scale;
00517 MILLIPOINT m_GlowWidth;
00518 MILLIPOINT m_FeatherWidth;
00519
00520 List m_AttributeList;
00521 } ;
00522
00523 #endif // BUILDSHADOWS
00524
00525 #endif // include