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 #ifndef NODELIVEFX_H
00100 #define NODELIVEFX_H
00101
00102
00103 #include "nodepostpro.h"
00104
00105
00106
00107
00108 #define FEATHER_EFFECT
00109
00110
00111 PORTNOTE("other","Define dummy IXMLDOMDocumentPtr")
00112 #ifdef EXCLUDE_FROM_XARALX
00113 typedef void *IXMLDOMDocumentPtr;
00114 #endif
00115
00116 class CCAttrMap;
00117 class BitmapTranspFillAttribute;
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 class LiveEffectRecordHandler : public CamelotRecordHandler
00131 {
00132
00133 CC_DECLARE_DYNAMIC(LiveEffectRecordHandler);
00134
00135 public:
00136 LiveEffectRecordHandler() : CamelotRecordHandler() {}
00137 ~LiveEffectRecordHandler() {}
00138
00139 virtual UINT32* GetTagList();
00140 virtual BOOL HandleRecord(CXaraFileRecord* pCXaraFileRecord);
00141 virtual BOOL IsStreamed(UINT32 Tag);
00142 virtual BOOL HandleStreamedRecord(CXaraFile* pCXFile, UINT32 Tag, UINT32 Size, UINT32 RecordNumber);
00143
00144 #ifdef XAR_TREE_DIALOG
00145 virtual void GetRecordDescriptionText(CXaraFileRecord* pRecord, StringBase* pStr);
00146 #endif
00147 };
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163 class NodeBitmapEffect : public NodeEffect
00164 {
00165
00166 CC_DECLARE_DYNCREATE(NodeBitmapEffect);
00167
00168 friend class LiveEffectRecordHandler;
00169
00170 public:
00171 static BOOL Init();
00172
00173
00174 public:
00175
00176 static UINT32 DefaultLivePixelsPerInch;
00177 static UINT32 DefaultLockedPixelsPerInch;
00178 static UINT32 GroupPixelsPerInch;
00179 static UINT32 ShadowPixelsPerInch;
00180 static BOOL DefaultLocked;
00181
00182 public:
00183 NodeBitmapEffect();
00184 ~NodeBitmapEffect();
00185
00186 NodeBitmapEffect(Node* ContextNode,
00187 AttachNodeDirection Direction,
00188 BOOL Locked = FALSE,
00189 BOOL Mangled = FALSE,
00190 BOOL Marked = FALSE,
00191 BOOL Selected = FALSE
00192 );
00193
00194
00195 public:
00196 virtual BOOL IsBitmapEffect() const {return TRUE;}
00197 virtual DocRect GetBlobBoundingRect();
00198 virtual NodeRenderableInk* GetInkNodeFromController() const {return FindFirstChildInk();}
00199 virtual void Render(RenderRegion* pRender);
00200 virtual BOOL DoBecomeA(BecomeA* pBecomeA);
00201 virtual BOOL CanBecomeA(BecomeA* pBecomeA);
00202 virtual BOOL HasCachedDirectBitmap();
00203
00204
00205 virtual BOOL WriteBoundsRecord(BaseCamelotFilter* pFilter);
00206 virtual BOOL WillWriteBounds(BaseCamelotFilter* pFilter) { return(TRUE); }
00207
00208
00209 public:
00210 virtual void RenderAfterSubtree(RenderRegion* pRender);
00211 virtual BOOL GetOriginalBitmap(LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect);
00212 virtual void SetOriginalBitmap(LPBITMAPINFO lpInfo, LPBYTE lpBits, DocRect rect);
00213 virtual BOOL GetProcessedBitmap(BOOL bDirect, LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect) {return FALSE;}
00214 virtual DocRect SetProcessedBitmap( LPBITMAPINFO lpInfo,
00215 LPBYTE lpBits,
00216 DocRect rect,
00217 INT32 width,
00218 INT32 height,
00219 double xOffset,
00220 double yOffset,
00221 double dPixelWidth = 0,
00222 Matrix* pmatTransform = NULL)
00223 {return DocRect(0,0,0,0);}
00224 virtual IXMLDOMDocumentPtr GetEditList();
00225 virtual void SetEditList(IXMLDOMDocumentPtr pNewEditsDoc);
00226 virtual BOOL SetDefaultEditList();
00227 virtual BOOL IsLockedEffect() {return FALSE;}
00228 virtual BOOL HasChanged() const {return m_bHasChangedRecently;}
00229 virtual BOOL SetChanged(BOOL bNewFlag = TRUE) {m_bHasChangedRecently = bNewFlag; return TRUE;}
00230 virtual BOOL CompareState(NodeEffect* pPPNode);
00231 virtual BOOL ProcessBitmap(RenderRegion* pRender,
00232 CBitmapCache* pBitmapCache,
00233 LPBITMAPINFO pBMPInfo,
00234 LPBYTE pBMPBits,
00235 DocRect BMPRect,
00236 LPBITMAPINFO& pOutputInfo,
00237 LPBYTE& pOutputBits,
00238 double* pXOffset,
00239 double* pYOffset);
00240 virtual String_64& GetDisplayName() {return m_strDisplayName;}
00241 virtual void SetDisplayName(String_64& strDisplayName) {m_strDisplayName = strDisplayName;}
00242 virtual KernelBitmap* GetKernelBitmap(DocCoord* pCoords, BOOL bRetainCached = FALSE) {return NULL;}
00243 virtual double GetPixelsPerInch();
00244 virtual double GetPixelsPerInchValue() const {return m_dPixelsPerInch;}
00245 virtual void SetPixelsPerInch(double dPixelsPerInch);
00246 virtual BOOL CanGenerateBitmap();
00247 virtual BOOL GetChildDirectBitmap(RenderRegion* pRender,
00248 LPBITMAPINFO* plpInfo = NULL,
00249 LPBYTE* plpBits = NULL,
00250 DocRect* pRect = NULL,
00251 Matrix* pMat = NULL,
00252 double* pdRes = NULL
00253 );
00254 virtual BOOL CanSupplyDirectBitmap() {return TRUE;}
00255 virtual BOOL GetDirectBitmap(RenderRegion* pRender, LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect, Matrix* pMat, double* pdRes);
00256 virtual BOOL RenderDirectBitmapState(RenderRegion* pRender);
00257 virtual BOOL EnableDirectCapture();
00258
00259 protected:
00260 virtual double GetPixelWidth() {return 72000.0 / GetPixelsPerInch();}
00261 virtual DocRect AdjustPixelOffsets(DocRect inRect, INT32 width, INT32 height, double xOffset, double yOffset, double dPixelWidth = 0);
00262 virtual BOOL FindCachedEffect(CBitmapCache* pBitmapCache);
00263 virtual BOOL RenderCachedEffect(CBitmapCache* pBitmapCache, RenderRegion* pRenderRegion, BOOL bIgnoreCapture = FALSE);
00264 virtual BOOL GetQuickRender() {return Operation::GetQuickRender(this);}
00265 virtual BOOL CanGetChildDirectBitmap();
00266
00267 protected:
00268 IXMLDOMDocumentPtr m_pEditsDoc;
00269 StringVar m_vstrEdits;
00270 double m_dPixelsPerInch;
00271 BOOL m_bHasChangedRecently;
00272 String_64 m_strDisplayName;
00273 DocRect m_rectDirectBitmap;
00274
00275 };
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 class NodeLiveEffect : public NodeBitmapEffect
00294 {
00295
00296 CC_DECLARE_DYNCREATE(NodeLiveEffect);
00297
00298 friend class LiveEffectRecordHandler;
00299
00300 public:
00301 NodeLiveEffect();
00302 ~NodeLiveEffect();
00303
00304 NodeLiveEffect(Node* ContextNode,
00305 AttachNodeDirection Direction,
00306 BOOL Locked = FALSE,
00307 BOOL Mangled = FALSE,
00308 BOOL Marked = FALSE,
00309 BOOL Selected = FALSE
00310 );
00311
00312
00313 public:
00314 virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00315 virtual String Describe(BOOL Plural, BOOL Verbose);
00316 virtual Node* SimpleCopy();
00317 virtual UINT32 GetNodeSize() const;
00318 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00319 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE);
00320 virtual void Transform(TransformBase& Trans);
00321 virtual BOOL ReleaseCached(BOOL bAndParents = TRUE,
00322 BOOL bAndChildren = TRUE,
00323 BOOL bSelf = TRUE,
00324 BOOL bAndDerived = TRUE);
00325 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00326 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00327 virtual NodeRenderableInk* FindNodeAtPointHelper(const Spread* pSpread, const DocCoord dcPoint);
00328 virtual BOOL CanSelectAsCompoundParent() {return FALSE;}
00329 virtual BOOL PromoteHitTestOnChildrenToMe() const {return FALSE;}
00330 virtual BOOL ShouldITransformWithChildren() const {return TRUE;}
00331 virtual BOOL AllowSelectInside() const {return TRUE;}
00332
00333
00334 public:
00335 virtual BOOL GetProcessedBitmap(BOOL bDirect, LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect);
00336 virtual DocRect SetProcessedBitmap( LPBITMAPINFO lpInfo,
00337 LPBYTE lpBits,
00338 DocRect rect,
00339 INT32 width,
00340 INT32 height,
00341 double xOffset,
00342 double yOffset,
00343 double dPixelWidth = 0,
00344 Matrix* pmatTransform = NULL);
00345 virtual BOOL IsLockedEffect() {return FALSE;}
00346 virtual KernelBitmap* GetKernelBitmap(DocCoord* pCoords, BOOL bRetainCached = FALSE);
00347 void RemoveBitmapFromCache();
00348
00349 protected:
00350 virtual BOOL WriteLiveEffect(BaseCamelotFilter* pFilter);
00351
00352 protected:
00353 void CopyNodeContents(NodeLiveEffect* pCopyOfNode);
00354
00355 private:
00356 DocRect m_rectEstimatedBounds;
00357 MILLIPOINT m_lMaxBorder;
00358 };
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376 class NodeLockedEffect : public NodeBitmapEffect
00377 {
00378
00379 CC_DECLARE_DYNCREATE(NodeLockedEffect);
00380
00381 friend class LiveEffectRecordHandler;
00382
00383 public:
00384 NodeLockedEffect();
00385 ~NodeLockedEffect();
00386
00387 NodeLockedEffect(Node* ContextNode,
00388 AttachNodeDirection Direction,
00389 BOOL Locked = FALSE,
00390 BOOL Mangled = FALSE,
00391 BOOL Marked = FALSE,
00392 BOOL Selected = FALSE
00393 );
00394
00395
00396 public:
00397 virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00398 virtual String Describe(BOOL Plural, BOOL Verbose);
00399 virtual Node* SimpleCopy();
00400 virtual UINT32 GetNodeSize() const;
00401 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00402 virtual DocRect GetBoundingRect(BOOL DontUseAttrs=FALSE, BOOL HitTest=FALSE);
00403 virtual void Transform(TransformBase& Trans);
00404 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00405 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00406 virtual BOOL CanSelectAsCompoundParent() {return TRUE;}
00407 virtual BOOL PromoteHitTestOnChildrenToMe() const {return TRUE;}
00408 virtual BOOL AllowSelectInside() const {return FALSE;}
00409 virtual void RenderObjectBlobs(RenderRegion* pRender);
00410 virtual void RenderTinyBlobs(RenderRegion* pRender);
00411 virtual void Render(RenderRegion* pRender);
00412 virtual KernelBitmap* EnumerateBitmaps(UINT32 Count);
00413 virtual NodeRenderableInk* GetInkNodeFromController() const;
00414 virtual void UnlinkNodeFromTree(BaseDocument* pOwnerDoc = NULL);
00415 virtual BOOL CanSupplyDirectBitmap() {return HasCachedDirectBitmap();}
00416
00417 protected:
00418 virtual BOOL RenderCachedEffect(CBitmapCache* pBitmapCache, RenderRegion* pRender, BOOL bIgnoreCapture = FALSE);
00419
00420
00421 public:
00422 virtual BOOL GetProcessedBitmap(BOOL bDirect, LPBITMAPINFO* plpInfo, LPBYTE* plpBits, DocRect* pRect);
00423 virtual DocRect SetProcessedBitmap( LPBITMAPINFO lpInfo,
00424 LPBYTE lpBits,
00425 DocRect rect,
00426 INT32 width,
00427 INT32 height,
00428 double xOffset,
00429 double yOffset,
00430 double dPixelWidth = 0,
00431 Matrix* pmatTransform = NULL);
00432 virtual BOOL IsLockedEffect() {return TRUE;}
00433 virtual BOOL CanBeUnlocked() const {return !m_bIsDestructive;}
00434 virtual void SetLockPermanence(BOOL bDestructive) {m_bIsDestructive = bDestructive;}
00435
00436 virtual KernelBitmap* GetKernelBitmap(DocCoord* pCoords, BOOL bRetainCached = FALSE);
00437
00438 protected:
00439 virtual BOOL WriteLockedEffect(BaseCamelotFilter* pFilter);
00440
00441 protected:
00442 void CopyNodeContents(NodeLockedEffect* pCopyOfNode);
00443
00444 private:
00445 KernelBitmapRef m_BitmapRef;
00446 DocCoord m_PGram[3];
00447 BOOL m_bIsDestructive;
00448 };
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462 #ifdef FEATHER_EFFECT
00463 class NodeFeatherEffect : public NodeLiveEffect
00464 {
00465
00466 CC_DECLARE_DYNCREATE(NodeFeatherEffect);
00467
00468 friend class LiveEffectRecordHandler;
00469 friend class OpLiveEffect;
00470
00471 static BOOL ProcessBitmap(LPBITMAPINFO pBMPInfo,
00472 LPBYTE pBMPBits,
00473 double dPixBlurDiameter,
00474 CProfileBiasGain profileFeather);
00475
00476 public:
00477 NodeFeatherEffect();
00478 ~NodeFeatherEffect();
00479
00480 NodeFeatherEffect(Node* ContextNode,
00481 AttachNodeDirection Direction,
00482 BOOL Locked = FALSE,
00483 BOOL Mangled = FALSE,
00484 BOOL Marked = FALSE,
00485 BOOL Selected = FALSE
00486 );
00487
00488
00489 public:
00490 virtual String Describe(BOOL Plural, BOOL Verbose);
00491 virtual Node* SimpleCopy();
00492 virtual UINT32 GetNodeSize() const;
00493 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00494 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00495 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00496 virtual BOOL ProcessBitmap(RenderRegion* pRender,
00497 CBitmapCache* pBitmapCache,
00498 LPBITMAPINFO pBMPInfo,
00499 LPBYTE pBMPBits,
00500 DocRect BMPRect,
00501 LPBITMAPINFO& pOutputInfo,
00502 LPBYTE& pOutputBits,
00503 double* pXOffset,
00504 double* pYOffset);
00505 virtual BOOL FindCachedEffect(CBitmapCache* pBitmapCache);
00506 virtual BOOL RenderCachedEffect(CBitmapCache* pBitmapCache, RenderRegion* pRenderRegion, BOOL bIgnoreCapture = FALSE);
00507 virtual BOOL CompareState(NodeEffect* pPPNode);
00508 virtual BOOL IsFeatherEffect() {return TRUE;}
00509 virtual BOOL CanSupplyDirectBitmap() {return FALSE;}
00510 virtual BOOL EnableDirectCapture() {return FALSE;}
00511
00512
00513
00514 public:
00515 virtual void SetFeatherSize(MILLIPOINT newFeatherSize) {m_FeatherSize = newFeatherSize;}
00516 virtual MILLIPOINT GetFeatherSize() const {return m_FeatherSize;}
00517 virtual void SetProfile(CProfileBiasGain newProfile) {m_Profile = newProfile;}
00518 virtual CProfileBiasGain GetProfile() const {return m_Profile;}
00519
00520 protected:
00521 virtual BOOL WriteFeatherEffect(BaseCamelotFilter* pFilter);
00522 BOOL CreateBitmapTranspFill(KernelBitmap* pFeather,
00523 DocCoord* pCoords,
00524 BitmapTranspFillAttribute* BmpTranspFill);
00525 void CopyNodeContents(NodeFeatherEffect* pCopyOfNode);
00526 virtual BOOL GetQuickRender();
00527
00528 private:
00529 CProfileBiasGain m_Profile;
00530 MILLIPOINT m_FeatherSize;
00531 };
00532 #endif
00533
00534
00535
00536
00537
00538
00539
00540
00541
00542
00543
00544
00545
00546 #ifdef FEATHER_EFFECT
00547 class ProcessBitmapState : public CCObject
00548 {
00549 public:
00550
00551 ProcessBitmapState()
00552 {
00553 m_lpInfo = NULL;
00554 m_lpBits = NULL;
00555 m_XOffset = 0;
00556 m_YOffset = 0;
00557 m_XPelsPerMeter = 0;
00558 m_YPelsPerMeter = 0;
00559 m_bTemp = TRUE;
00560 m_bOK = FALSE;
00561 }
00562
00563
00564 ProcessBitmapState(LPBITMAPINFO lpInitialInfo,
00565 LPBYTE lpInitialBits,
00566 double InitialXOffset = 0,
00567 double InitialYOffset = 0,
00568 BOOL bInitialTempState = FALSE);
00569
00570 ProcessBitmapState(const ProcessBitmapState& copystate);
00571
00572 ProcessBitmapState& operator=(const ProcessBitmapState& rhsstate);
00573
00574
00575 ~ProcessBitmapState()
00576 {
00577 };
00578
00579
00580 public:
00581 ProcessBitmapState Create8BPPMask();
00582 ProcessBitmapState Contour8BPP(double dContourWidth);
00583 ProcessBitmapState Blur8BPP(double dBlurWidth);
00584 ProcessBitmapState Expand8BPP(INT32 nPixels, BYTE fill);
00585 ProcessBitmapState AddMaskTo(LPBITMAPINFO lpDeepInfo, LPBYTE lpDeepBits);
00586
00587 void GetPixelOffsets(double* pXOffset, double* pYOffset) const {*pXOffset = m_XOffset; *pYOffset = m_YOffset;}
00588 void GetBitmap(LPBITMAPINFO& pOutputInfo, LPBYTE& pOutputBits, BOOL bTemp = FALSE);
00589 BOOL IsOK() const {return m_bOK;}
00590 void DeInit();
00591
00592 #ifdef DEBUG
00593 void AttachToDoc(String_256 strName);
00594 #endif
00595
00596
00597 protected:
00598 void InitPipelineSettings(ProcessBitmapState* const prevstate);
00599 UINT32 GetWidth() const {return m_lpInfo->bmiHeader.biWidth;}
00600 UINT32 GetHeight() const {return m_lpInfo->bmiHeader.biHeight;}
00601 UINT32 GetDepth() const {return m_lpInfo->bmiHeader.biBitCount;}
00602 UINT32 GetXPelsPerMeter() const {return m_XPelsPerMeter==0 ? m_lpInfo->bmiHeader.biXPelsPerMeter : m_XPelsPerMeter;}
00603 UINT32 GetYPelsPerMeter() const {return m_YPelsPerMeter==0 ? m_lpInfo->bmiHeader.biYPelsPerMeter : m_YPelsPerMeter;}
00604 void SetPelsPerMeter(UINT32 x, UINT32 y);
00605 BOOL AllocDIB(UINT32 Width, UINT32 Height, UINT32 Depth);
00606
00607
00608 private:
00609 LPBITMAPINFO m_lpInfo;
00610 LPBYTE m_lpBits;
00611 double m_XOffset;
00612 double m_YOffset;
00613 BOOL m_bTemp;
00614 BOOL m_bOK;
00615 UINT32 m_XPelsPerMeter;
00616 UINT32 m_YPelsPerMeter;
00617
00618 };
00619 #endif
00620
00621
00622 #endif // NODELIVEFX_H