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
00101 #ifndef BRSHCOMP
00102 #define BRSHCOMP
00103
00104 #include "linecomp.h"
00105
00106
00107 class BrushRef;
00108 class BaseCamelotFilter;
00109 class CXaraFileRecord;
00110 class CamelotRecordHandler;
00111 class Node;
00112 class PathProcessorBrush;
00113 class AttrBrushType;
00114 class BlendedBrushDefinition;
00115 class BrushData;
00116 class Range;
00117
00118 enum ListUpdateType
00119 {
00120 UPDATE_NONE,
00121 UPDATE_LIST,
00122 UPDATE_PROPORTION,
00123 UPDATE_POSITION,
00124 UPDATE_LISTANDPOSITION
00125 };
00126
00127
00128
00129
00130 enum PathOffset {OFFSET_NONE,
00131 OFFSET_ALTERNATE,
00132 OFFSET_LEFT,
00133 OFFSET_RIGHT,
00134 OFFSET_RANDOM,
00135 };
00136
00137
00138 enum SequenceType { SEQ_FORWARD,
00139 SEQ_BACKWARD,
00140 SEQ_MIRROR,
00141 SEQ_RANDOM};
00142
00143
00144 const MILLIPOINT MIN_BRUSH_SPACING = 1000;
00145 const MILLIPOINT MAX_BRUSH_SPACING = 432000;
00146 const MILLIPOINT MAX_BRUSH_OFFSET = 216000;
00147 const MILLIPOINT DEFAULT_BRUSH_SPACING = 10000;
00148 const double MIN_BRUSH_SCALE = 0.005;
00149 const double MAX_BRUSH_SCALE = 20;
00150 const UINT32 MAX_BRUSH_OBJECTS = 50;
00151 const UINT32 MIN_BRUSH_RAND = 0;
00152 const UINT32 MAX_BRUSH_RAND = 100;
00153 const UINT32 OFFSETTYPE_LEFT = 1;
00154 const UINT32 OFFSETTYPE_RIGHT = 2;
00155 const UINT32 OFFSETTYPE_CENTRE = 3;
00156 const double MAX_TIMESTAMP = 5000;
00157 const double MIN_TIMESTAMP = 2;
00158 #define MAX_ANGLE 2*PI;
00159 #define MIN_ANGLE -2*PI;
00160 const double MAX_ANGLE_DEG = 360;
00161 const double MIN_ANGLE_DEG = -360;
00162 const UINT32 MAX_PRESSURE_EFFECT = 100;
00163 const UINT32 MIN_PRESSURE_EFFECT = 0;
00164 const MILLIPOINT MAX_BRUSH_SIZE = 432000;
00165 const UINT32 BRUSHFILE_NONE = 9999;
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183
00184
00185
00186 typedef UINT32 BrushHandle;
00187
00188 const BrushHandle BrushHandle_NoBrush = 0xffffffff;
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205 class BrushDefinition : public LineDefinition
00206 {
00207 CC_DECLARE_DYNAMIC(BrushDefinition)
00208
00209 public:
00210 BrushDefinition();
00211 BrushDefinition(Node *pBrushTree);
00212
00213 ~BrushDefinition();
00214
00215
00216 BOOL GenerateBrush();
00217
00218 BOOL RegenerateBrush();
00219
00220 BOOL IsActivated();
00221 void SetActivated(BOOL Value);
00222
00223
00224
00225
00226 BOOL StartRender();
00227 void StopRender();
00228 public:
00229 BOOL IsDifferent(LineDefinition *pOther);
00230 BOOL AreBrushParametersIdentical(BrushDefinition* pOther);
00231
00232 BrushDefinition* Copy();
00233
00234 BOOL CopyInkTreeToClipboard();
00235
00236 BOOL UsesPressure();
00237
00238 static BOOL ObjectCanCreateBrush(NodeRenderableInk* pObject);
00239
00240
00241 public:
00242
00243 MILLIPOINT GetSpacing();
00244 BOOL SetSpacing(MILLIPOINT Spacing);
00245 BOOL SetSpacingIncrProp(double Incr);
00246 double GetSpacingIncrProp();
00247 BOOL SetSpacingIncrConst(MILLIPOINT Incr);
00248 MILLIPOINT GetSpacingIncrConst();
00249 UINT32 GetSpacingMaxRand();
00250 BOOL SetSpacingMaxRand(UINT32 Value);
00251 UINT32 GetSpacingRandSeed();
00252 void SetSpacingRandSeed(UINT32 Seed);
00253
00254 public:
00255 PathOffset GetPathOffsetType();
00256 MILLIPOINT GetPathOffsetValue();
00257 void SetPathOffsetType(PathOffset Offset);
00258 void SetPathOffsetValue(MILLIPOINT Value);
00259 BOOL SetPathOffsetIncrProp(double Incr);
00260 double GetPathOffsetIncrProp();
00261 BOOL SetPathOffsetIncrConst(MILLIPOINT Incr);
00262 MILLIPOINT GetPathOffsetIncrConst();
00263 UINT32 GetOffsetTypeRandSeed();
00264 void SetOffsetTypeRandSeed(UINT32 Seed);
00265 UINT32 GetOffsetValueMaxRand();
00266 BOOL SetOffsetValueMaxRand(UINT32 Seed);
00267 UINT32 GetOffsetValueRandSeed();
00268 void SetOffsetValueRandSeed(UINT32 Seed);
00269
00270 public:
00271 void SetTiling(BOOL Value);
00272 BOOL IsTiled();
00273 public:
00274 BOOL SetRotationAngle(double Angle);
00275 double GetRotationAngle();
00276 double GetRotationIncrConst();
00277 BOOL SetRotationIncrConst(double Value);
00278 double GetRotationIncrProp();
00279 BOOL SetRotationIncrProp(double Value);
00280 void SetRotated(BOOL Value);
00281 BOOL IsRotated();
00282 UINT32 GetRotationMaxRand();
00283 BOOL SetRotationMaxRand(UINT32 Value);
00284 UINT32 GetRotationRandSeed();
00285 void SetRotationRandSeed(UINT32 Seed);
00286 UINT32 GetRotationMaxPressure();
00287 BOOL SetRotationMaxPressure(UINT32 Pressure);
00288
00289 public:
00290 double GetBrushScaling() ;
00291 BOOL SetBrushScaling(double Scale);
00292 double GetBrushScalingIncr();
00293 BOOL SetBrushScalingIncr(double Incr);
00294 double GetBrushScalingIncrConst();
00295 BOOL SetBrushScalingIncrConst(double Incr);
00296 UINT32 GetScalingMaxRand();
00297 BOOL SetScalingMaxRand(UINT32 Value);
00298 UINT32 GetScalingRandSeed();
00299 void SetScalingRandSeed(UINT32 Seed);
00300 UINT32 GetScalingMaxPressure();
00301 BOOL SetScalingMaxPressure(UINT32 Pressure);
00302
00303 public:
00304 double GetHueIncrement();
00305 BOOL SetHueIncrement(double Incr);
00306 UINT32 GetHueMaxRand();
00307 BOOL SetHueMaxRand(UINT32 Max);
00308 UINT32 GetHueRandSeed();
00309 BOOL SetHueRandSeed(UINT32 Seed);
00310
00311 double GetSatIncrement();
00312 BOOL SetSatIncrement(double Incr);
00313 UINT32 GetSatMaxRand();
00314 BOOL SetSatMaxRand(UINT32 Max);
00315 UINT32 GetSatRandSeed();
00316 BOOL SetSatRandSeed(UINT32 Seed);
00317
00318 public :
00319 SequenceType GetSequenceType();
00320 void SetSequenceType(SequenceType Type);
00321 UINT32 GetSequenceSeed();
00322 void SetSequenceSeed(UINT32 Seed);
00323
00324 public:
00325 double GetTimeStampingPeriod();
00326 BOOL SetTimeStampingPeriod(double Period);
00327
00328 public:
00329 INT32 GetBrushTransparency();
00330 BOOL SetBrushTransparency(INT32 Value);
00331 UINT32 GetTransparencyPressure();
00332 BOOL SetTransparencyPressure(UINT32 Value);
00333
00334 public:
00335 UINT32 GetNumBrushObjects() const;
00336
00337 DocRect GetLargestBoundingBox();
00338 DocRect GetLargestPossibleRect(BOOL AdjustForLineWidth = FALSE);
00339
00340 MILLIPOINT GetDefaultLineWidth(BOOL IgnorePressure = FALSE);
00341 BrushRef* GetFirstBrushRef();
00342 BrushRef* GetNextBrushRef();
00343 BrushRef* GetBrushRef(UINT32 Index);
00344
00345 void CalculateMaxScaling();
00346 double GetMaxScaling();
00347
00348
00349 void CopyDataToProcessor(PathProcessorBrush* pPathProc);
00350
00351 BOOL BrushContainsGroup();
00352
00353 UINT32 GetBrushFileID();
00354 void SetBrushFileID(UINT32 ID);
00355
00356 public:
00357 BOOL ExportBrush(BaseCamelotFilter *pFilter, const BrushHandle Handle);
00358
00359
00360 public:
00361 void InitialiseBrushData(BrushData* pData);
00362 BrushData* GetBrushData();
00363
00364 void SetMembersFromData(BrushData Data);
00365 protected:
00366 BOOL PreExportSubTree();
00367 BOOL PostExportSubTree();
00368
00369
00370 BOOL AddNewObject(NodeRenderableInk* pNode);
00371
00372
00373 BOOL ReplaceBrushWithGroup(NodeRenderableInk* pInk, NodeGroup** ppGroup);
00374
00375 void ResetMembers();
00376
00377 void InitialiseBrushArray(UINT32 NumObjects);
00378
00379 UINT32 GetFirstRandomNumber(UINT32 Seed = 0);
00380 UINT32 GetNextRandomNumber();
00381
00382 protected:
00383
00384
00385
00386 MILLIPOINT m_BrushSpacing;
00387 double m_BrushSpacingIncrProp;
00388 MILLIPOINT m_BrushSpacingIncrConst;
00389 UINT32 m_BrushSpacingMaxRand;
00390 UINT32 m_BrushSpacingRandSeed;
00391 UINT32 m_SpacingMaxPressure;
00392
00393 BOOL m_bTile;
00394 BOOL m_bRotate;
00395 double m_RotateAngle;
00396 double m_RotAngleIncrProp;
00397 double m_RotAngleIncrConst;
00398 UINT32 m_RotationMaxRand;
00399 UINT32 m_RotationRandSeed;
00400 UINT32 m_RotationMaxPressure;
00401
00402 PathOffset m_PathOffsetType;
00403 MILLIPOINT m_PathOffsetValue;
00404 double m_PathOffsetIncrProp;
00405 MILLIPOINT m_PathOffsetIncrConst;
00406 UINT32 m_OffsetTypeRandSeed;
00407 UINT32 m_OffsetValueMaxRand;
00408 UINT32 m_OffsetValueRandSeed;
00409 UINT32 m_OffsetMaxPressure;
00410
00411 double m_BrushScaling;
00412 double m_BrushScalingIncr;
00413 double m_BrushScalingIncrConst;
00414 UINT32 m_BrushScalingMaxRand;
00415 UINT32 m_BrushScalingRandSeed;
00416 UINT32 m_ScalingMaxPressure;
00417
00418
00419 double m_BrushHueIncrement;
00420 UINT32 m_BrushHueMaxRand;
00421 UINT32 m_BrushHueRandSeed;
00422 UINT32 m_HueMaxPressure;
00423
00424 double m_BrushSatIncrement;
00425 UINT32 m_BrushSatMaxRand;
00426 UINT32 m_BrushSatRandSeed;
00427 UINT32 m_SatMaxPressure;
00428
00429 INT32 m_BrushTransparency;
00430 UINT32 m_TranspMaxPressure;
00431
00432 SequenceType m_SequenceType;
00433 UINT32 m_SequenceRandSeed;
00434
00435 double m_TimeStampPeriod;
00436 UINT32 m_TimeStampMaxPressure;
00437
00438
00439 protected:
00440 std::vector< BrushRef * > m_BrushRefPtrArray;
00441 UINT32 m_NumBrushObjects;
00442
00443 UINT32 m_LastBrushRefRetrieved;
00444
00445 DocRect m_LargestBoundingBox;
00446 BOOL m_bInitOk;
00447
00448 double m_MaxScaling;
00449
00450 UINT32 m_DefaultFileID;
00451
00452
00453 BOOL m_bActivated;
00454 };
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469
00470
00471 class BrushComponentClass : public DocComponentClass
00472 {
00473 CC_DECLARE_DYNAMIC(BrushComponentClass)
00474
00475 public:
00476 static BOOL Init();
00477 static void DeInit();
00478 static BOOL LoadDefaultBrushes();
00479
00480 public:
00481 BOOL AddComponent(BaseDocument *pDoc);
00482 };
00483
00484
00485
00486
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503 class BrushComponent : public LineComponent
00504 {
00505
00506 CC_DECLARE_DYNAMIC(BrushComponent)
00507
00508 public:
00509 BrushComponent();
00510 virtual ~BrushComponent();
00511
00512 public:
00513
00514 static BOOL BeginLoadingDefaultFiles();
00515 static BOOL LoadNextDefaultFile();
00516 static void EndLoadingDefaults();
00517
00518 public:
00519 AttrBrushType* CreateAttributeNode(BrushHandle Handle);
00520 static AttrBrushType* CreateNode(BrushHandle Handle);
00521
00522 virtual LineHandle AddNewItem(LineDefinition *pLine, BOOL AskName = FALSE);
00523
00524
00525 static UINT32 GetNumberOfBrushes() {return m_Used;}
00526 static BrushDefinition *FindBrushDefinition(UINT32 Handle, BOOL IncludeDeactivated = FALSE);
00527
00528
00529 BOOL CopyInkObjectsToClipboard(BrushHandle Handle);
00530
00531
00532
00533 virtual BOOL NameIsUnique(const String_32& NameString);
00534
00535
00536 virtual String_32 GetUniqueName(String_32* pName = NULL);
00537
00538
00539 static void CancelNewBrush();
00540 static void SetNewName(String_32 NewName);
00541 public:
00542
00543 virtual BOOL StartExport(BaseCamelotFilter *pFilter);
00544
00545 BOOL StartImportBrush(CamelotRecordHandler *pHandler, CXaraFileRecord *pRecord, UINT32 ImportHandle);
00546
00547 BOOL EndImportBrush(CamelotRecordHandler *pHandler);
00548
00549
00550 BOOL ExportLine(BaseCamelotFilter *pFilter, BrushHandle Handle);
00551
00552
00553 BrushHandle FindImportedBrush(UINT32 ImportedHandle);
00554
00555
00556 BrushDefinition* GetImportBrushDefinition();
00557 void CleanUpAfterImport();
00558
00559
00560 private:
00561 virtual BOOL ExpandArray(void);
00562
00563
00564
00565 BrushDefinition* m_pImportBrushDef;
00566
00567 MILLIPOINT m_StoreSpacing;
00568 BOOL m_StoreTile;
00569 BOOL m_StoreRotate;
00570 double m_StoreRotateAngle;
00571 PathOffset m_StorePathOffsetType;
00572 MILLIPOINT m_StoreOffsetValue;
00573
00574 static String_32 m_NewName;
00575 static BOOL m_bCancelNewBrush;
00576 static UINT32 m_CurrentDefaultFile;
00577
00578 };
00579
00580
00581
00582 #endif
00583