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 #ifndef INC_NODESHADOW
00099 #define INC_NODESHADOW
00100
00101 #ifdef BUILDSHADOWS
00102
00103 #include "nodecont.h"
00104 #include "nodebmp.h"
00105
00106
00107
00108
00109
00110
00111
00112 #include "pathpcs.h"
00113
00114
00115
00116 class NodeShadowController;
00117 class TrapsList;
00118 class CShadowerFlat;
00119 class CBitmapShadow;
00120 class ExtendParams;
00121 class NodeShadowPassback;
00122
00123 class GRenderRegion;
00124 class GRenderRegionWrapper;
00125 class BitmapTranspFillAttribute;
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138 class NodeShadow : public NodeRenderableInk
00139 {
00140
00141 CC_DECLARE_DYNCREATE(NodeShadow);
00142
00143 public:
00144 NodeShadow();
00145 ~NodeShadow();
00146
00147 NodeShadow(Node* ContextNode,
00148 AttachNodeDirection Direction,
00149 BOOL Locked = FALSE,
00150 BOOL Mangled = FALSE,
00151 BOOL Marked = FALSE,
00152 BOOL Selected = FALSE
00153 );
00154
00155
00156 BOOL SetUpShape();
00157 virtual Node* SimpleCopy();
00158 void CopyNodeContents(NodeShadow* NodeCopy);
00159 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00160
00161 virtual BOOL IsAShadow() const { return TRUE; }
00162
00163
00164 virtual BOOL CanAttrBeAppliedToMe(CCRuntimeClass* pAttribClass);
00165
00166
00167 virtual DocRect GetBoundingRect(BOOL DontUseAttrs = FALSE, BOOL HitTest = FALSE);
00168 virtual DocRect GetBlobBoundingRect();
00169
00170
00171 virtual void Render( RenderRegion* pRender );
00172 virtual void RenderEorDrag( RenderRegion* );
00173
00174 virtual void PreExportRender( RenderRegion* pRender );
00175 virtual BOOL ExportRender( RenderRegion* pRender );
00176
00177
00178 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00179 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00180 virtual BOOL CanWriteChildrenWeb(BaseCamelotFilter* pFilter);
00181 virtual BOOL CanWriteChildrenNative(BaseCamelotFilter* pFilter);
00182
00183
00184 virtual void RenderObjectBlobs(RenderRegion* pRender);
00185 virtual void RenderTinyBlobs(RenderRegion* pRender);
00186
00187
00188 virtual void Transform( TransformBase& );
00189
00190
00191 virtual UINT32 GetNodeSize() const;
00192 virtual String Describe(BOOL Plural, BOOL Verbose);
00193 virtual BOOL NeedsTransparency() const {return TRUE;}
00194
00195
00196 virtual BOOL CanBecomeA(BecomeA* pBecomeA);
00197 virtual BOOL DoBecomeA(BecomeA* pBecomeA);
00198
00199
00200 void ShowDebugTreeDetails() const;
00201 void GetDebugDetails( StringBase* Str );
00202
00203
00204 virtual BOOL OnClick( DocCoord, ClickType, ClickModifiers, Spread*);
00205 virtual BOOL OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00206
00207
00208 virtual BOOL Snap(DocCoord* pDocCoord);
00209 virtual BOOL Snap(DocRect* pDocRect,const DocCoord& PrevCoord,const DocCoord& CurCoord);
00210 virtual BOOL SnapToCoords(DocCoord* pDocCoord);
00211
00212 void DeleteCurrentShadowStuff();
00213 void DeleteCache();
00214 void DeleteAndRefreshCache();
00215 virtual NodeCompound* GetParentController() const;
00216
00217 virtual BOOL PostImport();
00218 BOOL PostDuplicate(UndoableOperation* pOp);
00219
00220 virtual BOOL NeedsParent(Node* pNode) const;
00221
00222 virtual BOOL AllowOp(ObjChangeParam *pParam, BOOL SetOpPermissionState = TRUE,
00223 BOOL DoPreTriggerEdit = TRUE);
00224
00225 virtual BOOL MarqueeSelectNode() const { return FALSE; }
00226
00227 virtual BOOL ReleaseCached( BOOL bAndParents = TRUE,
00228 BOOL bAndChildren = TRUE,
00229 BOOL bSelf = TRUE,
00230 BOOL bAndDerived = TRUE);
00231
00232 protected:
00233 void InitialiseMemberVars();
00234 virtual void RenderBitmap(RenderRegion* pRender);
00235
00236 public:
00237 BOOL GenerateShadow();
00238
00239 BOOL GenerateShadowForBlends(List * pList, RenderRegion * pRegion);
00240
00241 void UpdateAfterWallOffset();
00242
00243 BOOL GenerateShadowBitmap(KernelBitmap* pSilhouetteBmp, const double pixBlurDiameter);
00244 BOOL GenerateSelectionBitmap(Range * pSelRng);
00245 void HaveChangedShadow() { m_bHaveTransformed = TRUE; }
00246 void SetBitmapShadowRendering(BOOL OnOrOff) { m_RenderBitmaps = OnOrOff; }
00247 BOOL AmDoingACopy() { return m_bAmCopying; }
00248 void SetAmCopying() { m_bAmCopying = TRUE; }
00249 void SetAmLoading() { m_bAmLoading = TRUE; }
00250
00251
00252 double GetDarkness() { return m_dDarkness; }
00253
00254 void SetDarkness(double Darkness);
00255
00256
00257 UINT32 GetTransp() { return (UINT32)(0.5 + 255.0 * (1.0 - m_dDarkness)); }
00258
00259
00260 void SetTransp(UINT32 Transp) { SetDarkness( (double)(255 - Transp) / 255.0 ); }
00261
00262 void SetBiasGain(CProfileBiasGain &gain);
00263 CProfileBiasGain &GetBiasGain();
00264 CProfileBiasGain* GetBiasGainPtr();
00265
00266
00267
00268 public:
00269 virtual BOOL IsTypeExtendible() const { return TRUE; }
00270 virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00271 virtual void Extend(const ExtendParams& ExtParams);
00272
00273 virtual INT32 EstimateNodeComplexity (OpParam* details);
00274
00275 #ifdef NEW_SHADOW_RENDER
00276 public:
00277 BOOL MakeShadow(LPBITMAPINFO lpInfo, LPBYTE lpBits, DocRect orect);
00278 BOOL RenderShadow(RenderRegion* pRender);
00279 BOOL NeedsRemake();
00280 BOOL TransformShadow(TransformBase& Trans);
00281
00282 #endif
00283
00284 protected:
00285 KernelBitmap* m_ShadowBitmap;
00286 BitmapTranspFillAttribute* m_pBMPTransFill;
00287 Path m_Path;
00288 Path m_NonTranslatedPath;
00289
00290 INT32 m_ShadowWidth;
00291 INT32 m_ShadowHeight;
00292
00293 BOOL m_bHaveTransformed;
00294 BOOL m_RenderBitmaps;
00295 BOOL m_bAmCopying;
00296 BOOL m_bAmLoading;
00297 double m_dDarkness;
00298
00299 DocRect m_SelectedRect;
00300 INT32 m_PreviousBlur;
00301
00302 BOOL SetupTransFill();
00303
00304
00305 BOOL Create8BitBitmap(KernelBitmap * pSrcBitmap, KernelBitmap ** ppDestBitmap);
00306
00307 void CreateBitmapPath(const DocRect& drInkForShadowing, double PixelWidth, const double pixBlurDiameter);
00308
00309
00310 CBitmapShadow * m_pShadower;
00311
00312
00313 INT32 m_BitmapXOffset;
00314
00315 CProfileBiasGain m_BiasGain;
00316
00317 NodePath * CreateShadowPassbackNode();
00318
00319 BOOL RenderBitmapForDisplay(RenderRegion* pRegion, List* pList = NULL);
00320 BOOL RenderBitmapForDisplay();
00321
00322 BOOL ApplyProfileToShadowBitmap();
00323
00324
00325
00326 MILLIPOINT m_LastRequestedPixWidth;
00327
00328
00329
00330 enum Quality::Fill m_LastQualitySetting;
00331
00332
00333
00334
00335 double m_LastActualPixWidth;
00336 };
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352 class BitmapShadower
00353 {
00354 public:
00355 static BitmapShadower* CreateSilhouetteBitmap( NodeShadowController* pControl,
00356 GRenderRegion* pGRR = NULL,
00357 List* pList = NULL );
00358
00359
00360
00361 KernelBitmap* GetSilhouetteBitmap()
00362 {
00363 KernelBitmap* pBmp = m_pSilhouetteBitmap;
00364 m_pSilhouetteBitmap = NULL;
00365 return pBmp;
00366 }
00367
00368
00369 double GetPixBlurDiameter() const { return m_pixBlurDiameter; }
00370
00371
00372 double GetActualPixelWidth() const { return m_ActualPixelWidth; }
00373
00374
00375 DocRect GetBitmapBounds() const { return m_drShadowedBounds; }
00376
00377 ~BitmapShadower();
00378
00379 private:
00380 BitmapShadower();
00381
00382 BOOL Initialise(NodeShadowController* pControl, GRenderRegion* pGRR, List* pList);
00383 BOOL DoCreateSilhouetteBitmap();
00384
00385 BOOL CalculateBoundsAndScale1();
00386 BOOL CalculateBoundsAndScale2WithGRR();
00387 BOOL CalculateBoundsAndScale2NoGRR();
00388 BOOL CreateOffscreenRR();
00389 BOOL RenderShadowedNodeOffscreen();
00390
00391 GRenderRegion* m_pGRR;
00392
00393 NodeShadowController* m_pControl;
00394 NodeShadow* m_pShadow;
00395 NodeRenderableInk* m_pShadowedNode;
00396 List* m_pShadowedList;
00397 enum ShadowType m_ShadowType;
00398
00399 DocRect m_drShadowedBounds;
00400 double m_ShadowScaleFactor;
00401 double m_ActualPixelWidth;
00402 double m_pixBlurDiameter;
00403
00404 GRenderRegionWrapper* m_pRendWrap;
00405 GRenderRegion* m_pOffscreenRR;
00406
00407 KernelBitmap* m_pSilhouetteBitmap;
00408 };
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422 class NodeShadowBecomeA : public BecomeA
00423 {
00424 public:
00425 NodeShadowBecomeA( BecomeAReason Reason,
00426 CCRuntimeClass* pClass,
00427 UndoableOperation* pOp,
00428 BOOL Sel,
00429 Path * pSummedPath) : BecomeA( Reason, pClass, pOp, Sel)
00430 {
00431 m_pPath = pSummedPath;
00432 }
00433
00434 virtual BOOL PassBack(NodeRenderableInk* pNewNode,NodeRenderableInk* pCreatedByNode,CCAttrMap* pAttrMap);
00435 private:
00436 Path * m_pPath;
00437 };
00438
00439
00440
00441 #endif // BUILDSHADOWS
00442
00443 #endif // NODESHADOW