#include <brshcomp.h>
Inheritance diagram for BrushDefinition:

Public Member Functions | |
| BrushDefinition () | |
| Default constructor for the purposes of inherited classes, if you just want a normal brushdef you should really use the constructor above. | |
| BrushDefinition (Node *pBrushTree) | |
| Constructor. | |
| ~BrushDefinition () | |
| Destructor. | |
| BOOL | GenerateBrush () |
goes through the input spread and calls AddNewObject() for each ink object found We try to make some intelligent guesses about what to set the starting spacing and offset values depending on the nature of the nodes. The following rules apply:
| |
| BOOL | RegenerateBrush () |
| This function deletes the existing brushrefs and recreates them from scratch from m_pTree. | |
| BOOL | IsActivated () |
| To see if this definition was initialised ok or if it was subsequently deactivated for some reason. | |
| void | SetActivated (BOOL Value) |
| To set this definition activated or not. | |
| BOOL | StartRender () |
| Basically due to imprecision in the arithmetic system we ended up corrupting the brush data if we used it too much. So to get around this we never transform the original brush data, instead we make copies of it each time we want to render a version of this brush. This function generates the data copies that we need to render this brush, make sure you call StopRender() to get rid of them. | |
| void | StopRender () |
| Call this when you have finished rendering a node with this brush, it deletes the copied data that we used for rendering. | |
| BOOL | IsDifferent (LineDefinition *pOther) |
| Determine if 2 BrushDefinitions are considered different. Used when adding Brushes to the global list, so that like Brushes can be merged. | |
| BOOL | AreBrushParametersIdentical (BrushDefinition *pOther) |
| Compares the member variables of the two brushes. | |
| BrushDefinition * | Copy () |
| Makes a copy of this definition, inknodes and all. | |
| BOOL | CopyInkTreeToClipboard () |
| copies the ink objects of this brush definition to the clipboard so they can be used elsewhere | |
| BOOL | UsesPressure () |
| as above | |
| MILLIPOINT | GetSpacing () |
| As above. | |
| BOOL | SetSpacing (MILLIPOINT Spacing) |
| To set the spacing between brush objects. | |
| BOOL | SetSpacingIncrProp (double Incr) |
| To set the proportional spacing increment between brush objects. | |
| double | GetSpacingIncrProp () |
| As above. | |
| BOOL | SetSpacingIncrConst (MILLIPOINT Incr) |
| To set the proportional spacing increment between brush objects. | |
| MILLIPOINT | GetSpacingIncrConst () |
| As above. | |
| UINT32 | GetSpacingMaxRand () |
| As above. | |
| BOOL | SetSpacingMaxRand (UINT32 Value) |
| As above. | |
| UINT32 | GetSpacingRandSeed () |
| As above. | |
| void | SetSpacingRandSeed (UINT32 Seed) |
| As above. | |
| PathOffset | GetPathOffsetType () |
| as above | |
| MILLIPOINT | GetPathOffsetValue () |
| as above | |
| void | SetPathOffsetType (PathOffset Offset) |
| to set the offset type for this brush | |
| void | SetPathOffsetValue (MILLIPOINT Value) |
| to set the offset distance for this brush | |
| BOOL | SetPathOffsetIncrProp (double Incr) |
| to set the offset distance for this brush | |
| double | GetPathOffsetIncrProp () |
| as above | |
| BOOL | SetPathOffsetIncrConst (MILLIPOINT Incr) |
| to set the offset distance for this brush | |
| MILLIPOINT | GetPathOffsetIncrConst () |
| as above | |
| UINT32 | GetOffsetTypeRandSeed () |
| As above. | |
| void | SetOffsetTypeRandSeed (UINT32 Seed) |
| As above. | |
| UINT32 | GetOffsetValueMaxRand () |
| As above. | |
| BOOL | SetOffsetValueMaxRand (UINT32 Seed) |
| As above. | |
| UINT32 | GetOffsetValueRandSeed () |
| As above. | |
| void | SetOffsetValueRandSeed (UINT32 Seed) |
| As above. | |
| void | SetTiling (BOOL Value) |
| as above | |
| BOOL | IsTiled () |
| as above | |
| BOOL | SetRotationAngle (double Angle) |
| as above | |
| double | GetRotationAngle () |
| as above | |
| double | GetRotationIncrConst () |
| as above | |
| BOOL | SetRotationIncrConst (double Value) |
| as above | |
| double | GetRotationIncrProp () |
| as above | |
| BOOL | SetRotationIncrProp (double Value) |
| as above | |
| void | SetRotated (BOOL Value) |
| as above | |
| BOOL | IsRotated () |
| as above | |
| UINT32 | GetRotationMaxRand () |
| as above | |
| BOOL | SetRotationMaxRand (UINT32 Value) |
| as above | |
| UINT32 | GetRotationRandSeed () |
| as above | |
| void | SetRotationRandSeed (UINT32 Seed) |
| as above | |
| UINT32 | GetRotationMaxPressure () |
| as above | |
| BOOL | SetRotationMaxPressure (UINT32 Pressure) |
| as above | |
| double | GetBrushScaling () |
| as above | |
| BOOL | SetBrushScaling (double Scale) |
| to set the member that determine to what scale of the original object each brush object is drawn | |
| double | GetBrushScalingIncr () |
| as above | |
| BOOL | SetBrushScalingIncr (double Incr) |
| to set the member that determine the increment to scaling applied to each brush object | |
| double | GetBrushScalingIncrConst () |
| as above | |
| BOOL | SetBrushScalingIncrConst (double Incr) |
| to set the member that determine the increment to scaling applied to each brush object | |
| UINT32 | GetScalingMaxRand () |
| As above. | |
| BOOL | SetScalingMaxRand (UINT32 Value) |
| As above. | |
| UINT32 | GetScalingRandSeed () |
| As above. | |
| void | SetScalingRandSeed (UINT32 Seed) |
| As above. | |
| UINT32 | GetScalingMaxPressure () |
| As above. | |
| BOOL | SetScalingMaxPressure (UINT32 Pressure) |
| As above. | |
| double | GetHueIncrement () |
| as above | |
| BOOL | SetHueIncrement (double Incr) |
| as above | |
| UINT32 | GetHueMaxRand () |
| as above | |
| BOOL | SetHueMaxRand (UINT32 Max) |
| as above | |
| UINT32 | GetHueRandSeed () |
| as above | |
| BOOL | SetHueRandSeed (UINT32 Seed) |
| as above | |
| double | GetSatIncrement () |
| as above | |
| BOOL | SetSatIncrement (double Incr) |
| as above | |
| UINT32 | GetSatMaxRand () |
| as above | |
| BOOL | SetSatMaxRand (UINT32 Max) |
| as above | |
| UINT32 | GetSatRandSeed () |
| as above | |
| BOOL | SetSatRandSeed (UINT32 Seed) |
| as above | |
| SequenceType | GetSequenceType () |
| as above | |
| void | SetSequenceType (SequenceType Type) |
| as above | |
| UINT32 | GetSequenceSeed () |
| as above | |
| void | SetSequenceSeed (UINT32 Seed) |
| as above | |
| double | GetTimeStampingPeriod () |
| as above | |
| BOOL | SetTimeStampingPeriod (double Period) |
| as above | |
| INT32 | GetBrushTransparency () |
| as above | |
| BOOL | SetBrushTransparency (INT32 Value) |
| as above | |
| UINT32 | GetTransparencyPressure () |
| Sets the extent to which pressure affects transparency. | |
| BOOL | SetTransparencyPressure (UINT32 Value) |
| Sets the extent to which pressure affects transparency. | |
| UINT32 | GetNumBrushObjects () const |
| as above | |
| DocRect | GetLargestBoundingBox () |
| as above | |
| DocRect | GetLargestPossibleRect (BOOL AdjustForLineWidth=FALSE) |
| To find out the largest possible bounding box that this brush can achieve, this we get the largest ink rect and then perform the maximum scaling, rotation etc. Note that ScalingIncrConst will be will be excluded from this test as we will never be able to know what affect it will have in advance of drawing the path. | |
| MILLIPOINT | GetDefaultLineWidth (BOOL IgnorePressure=FALSE) |
| as above | |
| BrushRef * | GetFirstBrushRef () |
| as above | |
| BrushRef * | GetNextBrushRef () |
| as above | |
| BrushRef * | GetBrushRef (UINT32 Index) |
| as above | |
| void | CalculateMaxScaling () |
| Calculates the maximum scaling value possible by dividing the maximum size value by the longest side of the bounding rect of the largest object. | |
| double | GetMaxScaling () |
| as above | |
| void | CopyDataToProcessor (PathProcessorBrush *pPathProc) |
| To copy all of the numeric data about this brush to a path processor. | |
| BOOL | BrushContainsGroup () |
| as above | |
| UINT32 | GetBrushFileID () |
| as above | |
| void | SetBrushFileID (UINT32 ID) |
| as above, this should only be called as part of the start-up process. | |
| BOOL | ExportBrush (BaseCamelotFilter *pFilter, const BrushHandle Handle) |
| To export a Brush definition. | |
| void | InitialiseBrushData (BrushData *pData) |
| retrieves data from the path processor and puts it into our brushdata object | |
| BrushData * | GetBrushData () |
| gets the latest data from our path processor, copies it into our BrushData object which is then returned. Note that you are responsible for deleting this object. | |
| void | SetMembersFromData (BrushData Data) |
| gets the latest data from our path processor, copies it into our BrushData object which is then returned. Note that you are responsible for deleting this object. | |
Static Public Member Functions | |
| static BOOL | ObjectCanCreateBrush (NodeRenderableInk *pObject) |
| To determine if this ink node can be made into a brush, currently returns TRUE for except for bevels, shadows, and contours, which are too damn awkward. | |
Protected Member Functions | |
| BOOL | PreExportSubTree () |
| To perform various functions just prior to saving the subtree of the brush definition. The function loops through the BrushRefs, finding the blendpaths of each and transforming their attribute maps back to the position that they were in when the brush was created. | |
| BOOL | PostExportSubTree () |
| To perform various functions just prior to saving the subtree of the brush definition. The function loops through the BrushRefs, finding the blendpaths of each and undoes the transformation performed by PreExportSubTree. This is required because to continue using the brush in our current document we want to use its current position. | |
| BOOL | AddNewObject (NodeRenderableInk *pNode) |
| creates a brushref object from the inknode and its attributes, then adds the brushref to the member array | |
| BOOL | ReplaceBrushWithGroup (NodeRenderableInk *pInk, NodeGroup **ppGroup) |
| We are no longer allowed to make brushes from brushes, because of problems when saving and loading. Instead if we have a brush then we will convert it to shapes and use those instead. | |
| void | ResetMembers () |
| Initialises the member variables. | |
| void | InitialiseBrushArray (UINT32 NumObjects) |
| Clears out the m_BrushRefPtrArray if it is not empty, and sets the size. | |
| UINT32 | GetFirstRandomNumber (UINT32 Seed=0) |
| Seeds srand with either the seed supplied or by using time (i.e. a random seed). | |
| UINT32 | GetNextRandomNumber () |
| as above, note that you MUST have already called GetFirstRandomNumber() | |
Protected Attributes | |
| MILLIPOINT | m_BrushSpacing |
| double | m_BrushSpacingIncrProp |
| MILLIPOINT | m_BrushSpacingIncrConst |
| UINT32 | m_BrushSpacingMaxRand |
| UINT32 | m_BrushSpacingRandSeed |
| UINT32 | m_SpacingMaxPressure |
| BOOL | m_bTile |
| BOOL | m_bRotate |
| double | m_RotateAngle |
| double | m_RotAngleIncrProp |
| double | m_RotAngleIncrConst |
| UINT32 | m_RotationMaxRand |
| UINT32 | m_RotationRandSeed |
| UINT32 | m_RotationMaxPressure |
| PathOffset | m_PathOffsetType |
| MILLIPOINT | m_PathOffsetValue |
| double | m_PathOffsetIncrProp |
| MILLIPOINT | m_PathOffsetIncrConst |
| UINT32 | m_OffsetTypeRandSeed |
| UINT32 | m_OffsetValueMaxRand |
| UINT32 | m_OffsetValueRandSeed |
| UINT32 | m_OffsetMaxPressure |
| double | m_BrushScaling |
| double | m_BrushScalingIncr |
| double | m_BrushScalingIncrConst |
| UINT32 | m_BrushScalingMaxRand |
| UINT32 | m_BrushScalingRandSeed |
| UINT32 | m_ScalingMaxPressure |
| double | m_BrushHueIncrement |
| UINT32 | m_BrushHueMaxRand |
| UINT32 | m_BrushHueRandSeed |
| UINT32 | m_HueMaxPressure |
| double | m_BrushSatIncrement |
| UINT32 | m_BrushSatMaxRand |
| UINT32 | m_BrushSatRandSeed |
| UINT32 | m_SatMaxPressure |
| INT32 | m_BrushTransparency |
| UINT32 | m_TranspMaxPressure |
| SequenceType | m_SequenceType |
| UINT32 | m_SequenceRandSeed |
| double | m_TimeStampPeriod |
| UINT32 | m_TimeStampMaxPressure |
| std::vector< BrushRef * > | m_BrushRefPtrArray |
| UINT32 | m_NumBrushObjects |
| UINT32 | m_LastBrushRefRetrieved |
| DocRect | m_LargestBoundingBox |
| BOOL | m_bInitOk |
| double | m_MaxScaling |
| UINT32 | m_DefaultFileID |
| BOOL | m_bActivated |
Definition at line 205 of file brshcomp.h.
|
|
Default constructor for the purposes of inherited classes, if you just want a normal brushdef you should really use the constructor above.
Definition at line 210 of file brshcomp.cpp. 00211 { 00212 ResetMembers(); 00213 }
|
|
|
Constructor.
Definition at line 179 of file brshcomp.cpp. 00180 : LineDefinition(pBrushTree) 00181 { 00182 ResetMembers(); 00183 InitialiseBrushArray(MAX_BRUSH_OBJECTS); 00184 if (!GenerateBrush()) 00185 { 00186 // hmm, not sure what to do here, but you can detect if we failed to initialise 00187 // by calling IsActivated, if that fails you should delete me. 00188 } 00189 00190 }
|
|
|
Destructor.
Definition at line 227 of file brshcomp.cpp. 00228 { 00229 for( size_t i = 0; i < m_BrushRefPtrArray.size(); i++ ) 00230 { 00231 // ask the brushref to delete the attribute maps it generated 00232 if (m_BrushRefPtrArray[i] != NULL) 00233 { 00234 // m_BrushRefPtrArray[i]->DeleteAttributeMapsAndAttributes(); 00235 delete m_BrushRefPtrArray[i]; 00236 } 00237 } 00238 m_BrushRefPtrArray.clear(); 00239 00240 00241 00242 }
|
|
|
creates a brushref object from the inknode and its attributes, then adds the brushref to the member array
Definition at line 608 of file brshcomp.cpp. 00609 { 00610 00611 if (pInkNode == NULL) 00612 { 00613 ERROR3("Ink node is NULL"); 00614 return FALSE; 00615 } 00616 00617 if (m_NumBrushObjects >= MAX_BRUSH_OBJECTS) 00618 { 00619 ERROR3("Cannot exceed MAX_BRUSH_OBJECTS"); 00620 return FALSE; 00621 } 00622 00623 BrushRef *pNewBrushRef = new BrushRef; 00624 00625 if (pNewBrushRef == NULL) 00626 { 00627 ERROR3("Failed to allocate brushref"); 00628 return FALSE; 00629 } 00630 00631 00632 00633 if (!pNewBrushRef->Initialise(pInkNode)) 00634 { 00635 ERROR3("Failed to initialise brushref"); 00636 return FALSE; 00637 } 00638 00639 m_BrushRefPtrArray[m_NumBrushObjects++] = pNewBrushRef; 00640 00641 return TRUE; 00642 00643 }
|
|
|
|
as above
Definition at line 2747 of file brshcomp.cpp. 02748 { 02749 for (UINT32 i = 0; i < m_NumBrushObjects; i++) 02750 { 02751 if (m_BrushRefPtrArray[i]->GetNumBlendPaths() > 1) 02752 return TRUE; 02753 } 02754 return FALSE; 02755 }
|
|
|
Calculates the maximum scaling value possible by dividing the maximum size value by the longest side of the bounding rect of the largest object.
Definition at line 1121 of file brshcomp.cpp. 01122 { 01123 DocRect BRect = GetLargestBoundingBox(); 01124 if (BRect.IsEmpty()) 01125 { 01126 //ERROR3("Bounding rect is empty in BrushDefinition::CalculateMaxScaling"); 01127 return; 01128 } 01129 MILLIPOINT LongestSide = BRect.Height() > BRect.Width() ? BRect.Height() : BRect.Width(); 01130 m_MaxScaling = MAX_BRUSH_SIZE / LongestSide; 01131 01132 }
|
|
|
Makes a copy of this definition, inknodes and all.
Definition at line 891 of file brshcomp.cpp. 00892 { 00893 // we need to make a range in order to copy the nodes to the new brush definition 00894 // so we need the start and end nodes of the range 00895 Node* pStart = NULL; 00896 Node* pNext = NULL; 00897 Node* pLast = NULL; 00898 00899 // don't forget we start on a spread 00900 Node* pTree = GetLineTree(); 00901 if (pTree != NULL) 00902 pTree = pTree->FindFirstChild(); // get the layer 00903 if (pTree != NULL) 00904 pTree = pTree->FindFirstChild(); // get the first ink object 00905 00906 if (pTree == NULL) 00907 { 00908 ERROR3("Tree node is NULL in BrushDefinition::Copy()"); 00909 return NULL; 00910 } 00911 00912 pNext = pStart = pTree; 00913 while (pNext != NULL) 00914 { 00915 pNext->SetSelected(FALSE); // we need to do this so that Range::FindFirst doesn't return NULL 00916 pLast = pNext; 00917 pNext = pLast->FindNext(); 00918 } 00919 00920 00921 // make a range out of our subtree as thats the easiest way to copy all the nodes 00922 RangeControl rc; 00923 rc.Unselected = TRUE; 00924 rc.Selected = FALSE; 00925 Range BrushRange(pStart, pLast, rc); 00926 00927 // make a new spread to attach our copy tree to 00928 Spread* pSpread = new Spread; 00929 if (pSpread == NULL) 00930 { 00931 ERROR3("Failed to allocate spread in BrushDefinition::Copy"); 00932 return NULL; 00933 } 00934 00935 Layer *pLayer = new Layer( pSpread, FIRSTCHILD, String_256( TEXT("Diccon did this") ) ); 00936 if (pLayer == NULL) 00937 { 00938 ERROR3("Failed to allocate layer in BrushDefinition::Copy"); 00939 delete pSpread; 00940 return NULL; 00941 } 00942 00943 // we need to reset our attributes in the same way that we need to with exporting. 00944 // If we don't do this then attributes with control points end up vanishing 00945 PreExportSubTree(); 00946 00947 if (!pLayer->CopyComplexRange(BrushRange)) 00948 { 00949 ERROR3("Failed to copy range in BrushDefinition::Copy"); 00950 delete pSpread; 00951 delete pLayer; 00952 return NULL; 00953 } 00954 00955 PostExportSubTree(); 00956 00957 // lets allocate ourselves a new empty definition 00958 BrushDefinition* pNewBrushDef = new BrushDefinition(pSpread); 00959 00960 if (pNewBrushDef == NULL) 00961 { 00962 ERROR3("Failed to allocate brush definition in BrushDefinition* BrushDefinition::Copy"); 00963 delete pSpread; 00964 delete pLayer; 00965 return NULL; 00966 } 00967 00968 if (!pNewBrushDef->IsActivated()) 00969 { 00970 ERROR3("Brush definition failed to initialise"); 00971 delete pNewBrushDef; 00972 delete pSpread; 00973 delete pLayer; 00974 return NULL; 00975 } 00976 00977 return pNewBrushDef; 00978 }
|
|
|
To copy all of the numeric data about this brush to a path processor.
Definition at line 4368 of file brshcomp.cpp. 04369 { 04370 if (pPathProc == NULL) 04371 { 04372 ERROR3("Path processor is NULL"); 04373 return; 04374 } 04375 04376 // spacing members 04377 pPathProc->SetSpacing(m_BrushSpacing); 04378 pPathProc->SetSpacingIncrProp(m_BrushSpacingIncrProp); 04379 pPathProc->SetSpacingIncrConst(m_BrushSpacingIncrConst); 04380 pPathProc->SetSpacingMaxRand(m_BrushSpacingMaxRand); 04381 pPathProc->SetSpacingRandSeed(m_BrushSpacingRandSeed); 04382 04383 // offset members 04384 pPathProc->SetPathOffsetType(m_PathOffsetType); 04385 pPathProc->SetPathOffsetValue(m_PathOffsetValue); 04386 pPathProc->SetPathOffsetIncrConst(m_PathOffsetIncrConst); 04387 pPathProc->SetPathOffsetIncrProp(m_PathOffsetIncrProp); 04388 pPathProc->SetOffsetTypeRandSeed(m_OffsetTypeRandSeed); 04389 pPathProc->SetOffsetValueMaxRand(m_OffsetValueMaxRand); 04390 pPathProc->SetOffsetValueRandSeed(m_OffsetValueRandSeed); 04391 04392 04393 // scaling members 04394 pPathProc->SetBrushScaling(m_BrushScaling); 04395 pPathProc->SetScalingMaxRand(m_BrushScalingMaxRand); 04396 pPathProc->SetScalingRandSeed(m_BrushScalingRandSeed); 04397 pPathProc->SetScalingMaxPressure(m_ScalingMaxPressure); 04398 pPathProc->SetMaxScaling(m_MaxScaling); 04399 pPathProc->SetBrushScalingIncr(m_BrushScalingIncr); 04400 pPathProc->SetBrushScalingIncrConst(m_BrushScalingIncrConst); 04401 04402 04403 // rotation 04404 pPathProc->SetRotationMaxRand(m_RotationMaxRand); 04405 pPathProc->SetRotationRandSeed(m_RotationRandSeed); 04406 pPathProc->SetRotationIncrConst(m_RotAngleIncrConst); 04407 pPathProc->SetRotationIncrProp(m_RotAngleIncrProp); 04408 pPathProc->SetRotationMaxPressure(m_RotationMaxPressure); 04409 pPathProc->SetRotationAngle(m_RotateAngle); 04410 04411 04412 // sequence 04413 pPathProc->SetSequenceType(m_SequenceType); 04414 pPathProc->SetSequenceSeed(m_SequenceRandSeed); 04415 04416 // Hue/Saturation 04417 pPathProc->SetHueIncrement(m_BrushHueIncrement); 04418 pPathProc->SetHueMaxRand(m_BrushHueMaxRand); 04419 pPathProc->SetHueRandSeed(m_BrushHueRandSeed); 04420 pPathProc->SetSatIncrement(m_BrushSatIncrement); 04421 pPathProc->SetSatMaxRand(m_BrushSatMaxRand); 04422 pPathProc->SetSatRandSeed(m_BrushSatRandSeed); 04423 04424 // Transparency 04425 pPathProc->SetBrushTransparency(m_BrushTransparency); 04426 pPathProc->SetTransparencyPressure(m_TranspMaxPressure); 04427 04428 // Other 04429 pPathProc->SetRotated(m_bRotate); 04430 pPathProc->SetTiling(m_bTile); 04431 }
|
|
|
copies the ink objects of this brush definition to the clipboard so they can be used elsewhere
Definition at line 3245 of file brshcomp.cpp. 03246 { 03247 // first see if we can get the clipboard 03248 InternalClipboard *Clipboard = InternalClipboard::Instance(); 03249 if (Clipboard == NULL || !Clipboard->PrepareForCopy()) 03250 { 03251 ERROR3("Error copying to clipboard"); 03252 return FALSE; 03253 } 03254 03255 if (m_pTree == NULL) 03256 { 03257 ERROR3("No ink objects"); 03258 return FALSE; 03259 } 03260 03261 // remember that we store the ink nodes in a spread, so the first child 03262 // will be the layer, which we do not want to copy 03263 Node* pFirstNode = m_pTree->FindFirstChild(); 03264 if (pFirstNode == NULL) 03265 { 03266 ERROR3("No layer underneath spread"); 03267 return FALSE; 03268 } 03269 pFirstNode = pFirstNode->FindFirstChild(); 03270 03271 // Just be sure its an ink node 03272 if (pFirstNode == NULL || !pFirstNode->IsAnObject()) 03273 { 03274 ERROR3("No ink object to copy"); 03275 return FALSE; 03276 } 03277 03278 // we want to set up a range to copy to the clipboard, so find the rightmost sibling 03279 // of our node 03280 03281 // We need to set them unselected so that range::findfirst doesn't return NULL 03282 03283 Node* pLastNode = pFirstNode; 03284 Node* pNextNode = pLastNode->FindNext(); 03285 while (pNextNode != NULL) 03286 { 03287 pNextNode->SetSelected(FALSE); 03288 pLastNode = pNextNode; 03289 pNextNode = pLastNode->FindNext(); 03290 } 03291 pFirstNode->SetSelected(FALSE); 03292 DocCoord Centre; 03293 if (pFirstNode->IsKindOf(CC_RUNTIME_CLASS(NodeRenderableInk))) 03294 { 03295 DocRect BRect = ((NodeRenderableInk*)pFirstNode)->GetBoundingRect(); 03296 Centre = BRect.Centre(); 03297 TRACEUSER( "Diccon", _T("Ink node centre = %d, %d\n"), Centre.x, Centre.y); 03298 } 03299 Node* pChild = pFirstNode->FindFirstChild(CC_RUNTIME_CLASS(AttrRadialTranspFill)); 03300 if (pChild != NULL) 03301 { 03302 DocCoord *pStartPoint = ((AttrRadialTranspFill*)pChild)->GetStartPoint(); 03303 if (pStartPoint != NULL) 03304 TRACEUSER( "Diccon", _T("StartPoint pre-export = %d, %d\n"), pStartPoint->x, pStartPoint->y); 03305 } 03306 03307 03308 // that should give us our range, now set up the range control, just use the default 03309 RangeControl rc; 03310 rc.Unselected = TRUE; 03311 rc.Selected = FALSE; 03312 03313 Range BrushRange(pFirstNode, pLastNode, rc); 03314 03315 PreExportSubTree(); 03316 03317 BOOL ok = Clipboard->CopyObjects(BrushRange); 03318 BOOL StillOk = Clipboard->CopyCompleted(); 03319 03320 PostExportSubTree(); 03321 03322 return (ok && StillOk); 03323 }
|
|
||||||||||||
|
To export a Brush definition.
Definition at line 3347 of file brshcomp.cpp. 03348 { 03349 ERROR2IF(pFilter == NULL, FALSE, "Filter is null"); 03350 ERROR2IF(Handle == BrushHandle_NoBrush, FALSE, "Trying to export null brush"); 03351 03352 BOOL ok = TRUE; 03353 03354 PreExportSubTree(); 03355 CXaraFileRecord Record(TAG_BRUSHDEFINITION, TAG_BRUSHDEFINITION_SIZE); 03356 if (ok) ok = Record.Init(); 03357 03358 // first write the handle 03359 if (ok) ok = Record.WriteUINT32(Handle); 03360 if (ok) pFilter->Write(&Record); 03361 03362 // then write the subtree - note that this may be moved to the superclass 03363 if (ok) 03364 { 03365 Node* pExportNode = NULL; 03366 if (m_pTree == NULL) 03367 ok = FALSE; 03368 else 03369 { 03370 pExportNode = m_pTree->FindFirstChild(); // Find the Layer 03371 if (pExportNode != NULL) 03372 pExportNode = pExportNode->FindFirstChild(); // Find the inknode 03373 } 03374 03375 // Write out the clipart subtree. We have to encapsulate it in DOWN and UP 03376 // records ourselves 03377 CXaraFileRecord DownRec(TAG_DOWN, 0); 03378 if (ok) pFilter->Write(&DownRec); 03379 03380 if (ok) ok = pFilter->WriteNodes(pExportNode); 03381 03382 CXaraFileRecord UpRec(TAG_UP, 0); 03383 if (ok) pFilter->Write(&UpRec); 03384 03385 } 03386 PostExportSubTree(); 03387 03388 // now write the data, note that the handle is written here also as they 03389 // are retrieved separately and will need to be reconciled 03390 CXaraFileRecord DataRecord((INT32)TAG_BRUSHDATA, (INT32)TAG_BRUSHDATA_SIZE); 03391 if (ok) ok = DataRecord.Init(); 03392 03393 BYTE Flags = 0; 03394 if (m_bTile) 03395 Flags |= TAG_BRUSHTILE_FLAG; 03396 if (m_bRotate) 03397 Flags |= TAG_BRUSHROTATE_FLAG; 03398 03399 03400 INT32 Offset = (INT32)m_PathOffsetType; 03401 03402 if(ok) ok = DataRecord.WriteUINT32((UINT32)Handle); 03403 if (ok) ok = DataRecord.WriteINT32(m_BrushSpacing); 03404 if (ok) ok = DataRecord.WriteBYTE(Flags); 03405 if (ok) ok = DataRecord.WriteDOUBLE(m_RotateAngle); 03406 if (ok) ok = DataRecord.WriteINT32(Offset); 03407 if (ok) ok = DataRecord.WriteINT32(m_PathOffsetValue); 03408 if (ok) ok = DataRecord.WriteUnicode((TCHAR *)*(GetLineName())); 03409 if (ok) ok = DataRecord.WriteDOUBLE(m_BrushScaling); 03410 if (ok) pFilter->Write(&DataRecord); 03411 03412 // write the additional data 03413 CXaraFileRecord NextRec(TAG_MOREBRUSHDATA, TAG_MOREBRUSHDATA_SIZE); 03414 if (ok) ok = NextRec.Init(); 03415 if (ok) ok = NextRec.WriteDOUBLE(m_BrushSpacingIncrProp); 03416 if (ok) ok = NextRec.WriteINT32(m_BrushSpacingIncrConst); 03417 if (ok) ok = NextRec.WriteINT32((INT32)m_BrushSpacingMaxRand); 03418 if (ok) ok = NextRec.WriteINT32((INT32)m_BrushSpacingRandSeed); 03419 03420 if (ok) ok = NextRec.WriteDOUBLE(m_BrushScalingIncr); 03421 if (ok) ok = NextRec.WriteINT32((INT32)m_BrushScalingMaxRand); 03422 if (ok) ok = NextRec.WriteINT32((INT32)m_BrushScalingRandSeed); 03423 03424 if (ok) ok = NextRec.WriteINT32((INT32)m_SequenceTy |