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 INC_NODEBEVEL
00100 #define INC_NODEBEVEL
00101
00102 #include "nodepath.h"
00103 #include "beveler.h"
00104
00105
00106
00107 #include "cxftags.h"
00108
00109
00110
00111
00112
00113
00114
00115
00116 class NodeBevelController;
00117 class ExtendParams;
00118 class SumAllPathsElem;
00119 class NodeCompound;
00120 class BitmapTranspFillAttribute;
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132 class NodeBevel : public NodeRenderableInk
00133 {
00134
00135 CC_DECLARE_DYNCREATE(NodeBevel);
00136
00137 public:
00138 NodeBevel();
00139 ~NodeBevel();
00140
00141 NodeBevel(Node* ContextNode,
00142 AttachNodeDirection Direction,
00143 BOOL Locked = FALSE,
00144 BOOL Mangled = FALSE,
00145 BOOL Marked = FALSE,
00146 BOOL Selected = FALSE
00147 ) ;
00148
00149
00150 virtual Node* SimpleCopy();
00151 void CopyNodeContents(NodeBevel* pNewNode);
00152 virtual void PolyCopyNodeContents(NodeRenderable* pNodeCopy);
00153
00154
00155 BOOL GenerateBevel();
00156
00157
00158 BOOL GenerateBevelForBlendStep(SumAllPathsElem* pElem, CCAttrMap * pMap);
00159
00160
00161
00162 BOOL SetupVariables(CCAttrMap * pMap = NULL);
00163
00164
00165 virtual DocRect GetBoundingRect(BOOL DontUseAttrs = FALSE, BOOL HitTest = FALSE);
00166 virtual DocRect GetBlobBoundingRect();
00167 virtual void SetBoundingRect(DocRect rect) { m_SelectedRect = rect; }
00168
00169
00170 virtual void RenderBitmap(RenderRegion* pRender);
00171 virtual void Render(RenderRegion* pRender);
00172
00173 virtual void Transform( TransformBase& Trans );
00174
00175
00176 virtual BOOL RequiresAttrib(CCRuntimeClass* pAttribClass, BOOL Search = FALSE);
00177 virtual BOOL RequiresAttrib(NodeAttribute* pAttr, BOOL Search = FALSE);
00178 virtual BOOL CanAttrBeAppliedToMe(CCRuntimeClass* pAttribClass);
00179
00180 virtual NodeCompound* GetParentController() const;
00181
00182
00183 virtual BOOL IsNodePath() const;
00184
00185 virtual BOOL IsABevel() const { return TRUE; }
00186
00187
00188 void DeleteCache();
00189 void DeleteCachedBitmap();
00190
00191
00192 BOOL CreateBevelPaths();
00193
00194 virtual void RenderEorDrag( RenderRegion* rr );
00195
00196
00197 void InvalidateMe() {};
00198
00199 virtual BOOL NeedsTransparency() const;
00200
00201 void DisableRendering() { m_bStopRender = TRUE; }
00202 void EnableRendering() { m_bStopRender = FALSE; }
00203 BOOL IsRenderingStopped() { return m_bStopRender; }
00204
00205 virtual BOOL DoBecomeA(BecomeA* pBecomeA);
00206 virtual BOOL CanBecomeA(BecomeA* pBecomeA);
00207
00208 virtual String Describe(BOOL Plural, BOOL Verbose = TRUE);
00209
00210 virtual BOOL NeedsParent(Node* pNode) const;
00211
00212 BOOL PostDuplicate(UndoableOperation* pOp);
00213
00214 BOOL AllowOp(ObjChangeParam *pParam, BOOL SetOpPermissionState,
00215 BOOL DoPreTriggerEdit = TRUE);
00216
00217 DocRect GetPathBoundingRect() { return m_Path.GetBoundingRect(); }
00218
00219 virtual BOOL WritePreChildrenWeb(BaseCamelotFilter* pFilter);
00220 virtual BOOL WritePreChildrenNative(BaseCamelotFilter* pFilter);
00221
00222 virtual BOOL ExportRender ( RenderRegion *pRegion );
00223 virtual void PreExportRender ( RenderRegion *pRegion );
00224
00225 virtual void RenderTinyBlobs(RenderRegion* pRender);
00226
00227 BitmapFillAttribute* GetBitmapFillAttribute ( void );
00228
00229 virtual BOOL OnNodePopUp(Spread* pSpread, DocCoord PointerPos, ContextMenu* pMenu);
00230
00231 BOOL AmICached() { return m_bCached; }
00232
00233
00234
00235 virtual BOOL IsTypeExtendible() const { return TRUE; }
00236 virtual DocRect ValidateExtend(const ExtendParams& ExtParams);
00237 virtual void Extend(const ExtendParams& ExtParams);
00238
00239
00240
00241 void SetRenderBitmaps(BOOL b) { m_bRenderBitmaps = b; }
00242 BOOL GetRenderBitmaps() { return m_bRenderBitmaps; }
00243
00244
00245 void SetZeroLineWidths(BOOL b) { m_bZeroLineWidth = b; }
00246
00247
00248 DocRect GetInsideBoundingRect();
00249
00250
00251
00252
00253
00254 BOOL ReRenderBevelBitmap(BOOL bAntialias);
00255
00256 virtual INT32 EstimateNodeComplexity (OpParam* details);
00257
00258
00259 Path* GetOuterBevelPath() { return &m_OuterBevelPath; }
00260 Path* GetBevelPath() { return &m_Path; }
00261
00262 void DoRender(BOOL DoRender = TRUE) { m_DoRender = DoRender; }
00263
00264 KernelBitmap* GetBevelBitmap() const { return m_pBevelBitmap; }
00265
00266 KernelBitmap* CreateBitmapCopy(double DPI = -1.0, BOOL CheckFillFlags = TRUE);
00267
00268 void SetConvertingFlag(BOOL Set = FALSE) { m_AmConvertingToShapes = Set; }
00269
00270 void GetDebugDetails(StringBase* Str);
00271
00272 public:
00273
00274
00275 Path InkPath;
00276
00277 BOOL m_MustRegenOnChildChange;
00278
00279 INT32 m_BevelType;
00280 INT32 m_Indent;
00281
00282 double m_LightAngle;
00283 BOOL m_bOuter;
00284 INT32 m_Contrast;
00285 double m_Tilt;
00286
00287 BOOL m_IsABlendStepBevel;
00288
00289
00290 DocCoord m_BMPCentre;
00291 DocCoord m_BMPPoint1;
00292 DocCoord m_BMPPoint2;
00293
00294
00295 DocRect m_SelectedRect;
00296 JointType m_JointType;
00297
00298 protected:
00299
00300 KernelBitmap* CreateCombinedBMPAndTranspFill(RenderRegion* pRegion = NULL);
00301
00302
00303 void CalculateBitmapSize(INT32 * retnWid, INT32 * retnHei, RenderRegion * pRegion=NULL);
00304
00305
00306 void RenderNodesForPrinting(RenderRegion * pRender);
00307
00308
00309 void RenderNodeRecursively(Node * pNode, RenderRegion * pRender);
00310
00311
00312 void SetUpBitmapPalette(RenderRegion* pRegion = NULL, DocColour FlatColour = COLOUR_BLACK);
00313
00314
00315
00316
00317
00318 BOOL CreateBevelBitmap();
00319
00320
00321 BOOL RenderBitmapForDisplay(RenderRegion * pRegion);
00322
00323
00324
00325
00326 BOOL ReverseAndShrinkBevelPathIntoInkPath(Path* pBevelPath = NULL, double ZoomValue = 1.0, BOOL IsAnOuter = TRUE);
00327
00328 protected:
00329
00330 Path m_Path;
00331 BOOL m_DoRender;
00332
00333 KernelBitmap * m_pBevelBitmap;
00334 KernelBitmap * m_pCombiBitmap;
00335
00336 BitmapFillAttribute* m_pBMPFill;
00337 BitmapTranspFillAttribute* m_pTranspFill;
00338
00339 INT32 m_BitmapWidth;
00340 INT32 m_BitmapHeight;
00341
00342 DocCoord m_SubPixelOffset;
00343 DocRect m_PixelAllignedRect;
00344 BOOL m_IsFlatFilledOnly;
00345 BOOL m_IsAnAlphaBMP;
00346 BOOL m_HasTransparencyApplied;
00347 BOOL m_AmConvertingToShapes;
00348
00349 double m_LastCachedPrintBMPDPI;
00350 double m_LastExportedDPI;
00351
00352
00353 BOOL m_bStopRender;
00354 BOOL m_DoingRotation;
00355
00356
00357
00358 Path m_OuterBevelPath;
00359
00360
00361 UINT32 m_ViewScale;
00362
00363
00364 Path m_ShrunkPath;
00365 BOOL m_bLock;
00366 BOOL m_bRenderBitmaps;
00367
00368
00369 BOOL m_bZeroLineWidth;
00370
00371 CBeveler * m_pBeveler;
00372
00373
00374
00375 BOOL m_bPathIsClosed;
00376
00377
00378
00379 BOOL m_bCached;
00380
00381
00382
00383
00384 double m_LastZoomFactor;
00385
00386
00387 UINT32 m_LastPixelSize;
00388 } ;
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401 class BevelRecordHandler : public CamelotRecordHandler
00402 {
00403
00404 CC_DECLARE_DYNCREATE( BevelRecordHandler );
00405
00406 public:
00407
00408 BevelRecordHandler();
00409 ~BevelRecordHandler();
00410
00411 virtual UINT32* GetTagList();
00412 virtual BOOL HandleRecord(CXaraFileRecord* pCXaraFileRecord);
00413
00414 private:
00415 NodeBevelController * m_pBevelController;
00416 NodeBevel * m_pBevelInk;
00417 } ;
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430 class NodeBevelBegin : public NodeRenderableBounded
00431 {
00432
00433 CC_DECLARE_DYNCREATE(NodeBevelBegin)
00434
00435 public:
00436
00437 NodeBevelBegin();
00438 NodeBevelBegin(Node* ContextNode,
00439 AttachNodeDirection Direction,
00440 BOOL Locked=FALSE,
00441 BOOL Mangled=FALSE,
00442 BOOL Marked=FALSE,
00443 BOOL Selected=FALSE
00444 );
00445
00446 void Render(RenderRegion * region);
00447
00448 DocRect GetBoundingRect(BOOL DontUseAttrs, BOOL HitTest);
00449 DocRect GetBlobBoundingRect();
00450
00451
00452 DocRect m_Rect;
00453
00454 virtual void RenderEorDrag( RenderRegion* rr ) { };
00455 virtual void RenderObjectBlobs(RenderRegion* pRender) { };
00456 virtual void RenderTinyBlobs(RenderRegion* pRender) { } ;
00457 virtual BOOL ExportRender ( RenderRegion *pRegion );
00458
00459 virtual BOOL NeedsParent(Node* pNode) const;
00460
00461
00462 void SetSelected(BOOL Status);
00463
00464
00465 virtual SubtreeRenderState RenderSubtree(RenderRegion* pRender, Node** ppNextNode = NULL, BOOL bClip = TRUE);
00466
00467 protected:
00468
00469 virtual Node* SimpleCopy();
00470
00471
00472
00473 DocRect m_RegionClipRect;
00474 } ;
00475
00476
00477
00478 #endif