#include <brshattr.h>
Inheritance diagram for BrushAttrRecordHandler:
Public Member Functions | |
BrushAttrRecordHandler () | |
~BrushAttrRecordHandler () | |
virtual UINT32 * | GetTagList () |
Provides the record handler system with a list of records handled by this handler - all StrokeType attributes:. | |
virtual BOOL | HandleRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles loading of the given AttrBrushType attribute record. | |
virtual BOOL | BeginSubtree (UINT32 Tag) |
Informs the record handler that a subtree is following a tag of type 'Tag'. | |
virtual BOOL | EndSubtree (UINT32 Tag) |
Informs the record handler that a subtree that followed a tag of type 'Tag' has ended. | |
Protected Member Functions | |
BOOL | HandleBrushAttributeRecord (CXaraFileRecord *pRecord) |
Reads in data which it uses to create a new AttrBrushType node. | |
BOOL | HandleBrushDataRecord (CXaraFileRecord *pRecord) |
Reads in data and assigns it to the previously created BrushDefinition. | |
BOOL | HandleMoreBrushDataRecord (CXaraFileRecord *pRecord) |
Reads in data and assigns it to the previously created BrushDefinition. | |
BOOL | HandleMoreBrushAttrRecord (CXaraFileRecord *pRecord) |
reads in the same data as previous fn. but assigns it to the path processor of | |
BOOL | HandleEvenMoreBrushData (CXaraFileRecord *pRecord) |
Reads in data and assigns it to the previously created BrushDefinition. | |
BOOL | HandleEvenMoreBrushAttr (CXaraFileRecord *pRecord) |
Reads in data and assigns it to the previously created node. | |
BOOL | HandleTimeStampData (CXaraFileRecord *pRecord) |
Reads in timestamp data and assigns it to the last attribute we created. | |
BOOL | HandlePressureInfo (CXaraFileRecord *pRecord) |
Reads in data and assigns it to the previously created BrushDefinition. | |
BOOL | HandleAttrPressureInfo (CXaraFileRecord *pRecord) |
Reads in data and assigns it to the previously created node. | |
BOOL | HandlePressureData (CXaraFileRecord *pRecord) |
Reads in timestamp data and assigns it to the last attribute we created. | |
BOOL | HandlePressureSampleData (CXaraFileRecord *pRecord) |
Reads in timestamp data and assigns it to the last attribute we created. | |
BOOL | HandleAttrFillFlags (CXaraFileRecord *pRecord) |
Reads in data, and assigns it to the attribute that we just created. | |
BOOL | HandleTranspInfo (CXaraFileRecord *pRecord) |
Reads in data pertaining to transparency, and other assorted things. | |
BOOL | HandleAttrTranspInfo (CXaraFileRecord *pRecord) |
Reads in data pertaining to transparency, and other assorted things. | |
Static Protected Attributes | |
static AttrBrushType * | m_pLastAttribute = NULL |
Private Member Functions | |
CC_DECLARE_DYNAMIC (BrushAttrRecordHandler) |
Definition at line 458 of file brshattr.h.
|
Definition at line 463 of file brshattr.h. 00463 : CamelotRecordHandler() { m_pLastAttribute = NULL;}
|
|
Definition at line 464 of file brshattr.h.
|
|
Informs the record handler that a subtree is following a tag of type 'Tag'.
Reimplemented from CXaraFileRecordHandler. Definition at line 5608 of file brshattr.cpp. 05609 { 05610 // We only want to know about following subtrees when doing stroke definition records. 05611 // If we are doing one, then we grab the subtree so nobody else can faff about with it 05612 if (Tag != TAG_BRUSHDEFINITION) 05613 return(FALSE); 05614 05615 return(TRUE); 05616 }
|
|
|
|
Informs the record handler that a subtree that followed a tag of type 'Tag' has ended.
Reimplemented from CXaraFileRecordHandler. Definition at line 5638 of file brshattr.cpp. 05639 { 05640 // We only want to know about following subtrees when doing custom print mark records. 05641 // If we are doing one, then we grab the subtree so nobody else can faff about with it 05642 if (Tag != TAG_BRUSHDEFINITION) 05643 return(FALSE); 05644 05645 // get the brush component from the document 05646 Document* pDoc = Document::GetCurrent(); 05647 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 05648 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 05649 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 05650 05651 return TRUE; //pBrushComp->EndImportBrush(this); 05652 05653 }
|
|
Provides the record handler system with a list of records handled by this handler - all StrokeType attributes:.
Implements CXaraFileRecordHandler. Definition at line 4559 of file brshattr.cpp. 04560 { 04561 static UINT32 TagList[] = 04562 { 04563 TAG_BRUSHDEFINITION, 04564 TAG_BRUSHATTR, 04565 TAG_BRUSHDATA, 04566 TAG_MOREBRUSHDATA, 04567 TAG_MOREBRUSHATTR, 04568 TAG_EVENMOREBRUSHDATA, 04569 TAG_EVENMOREBRUSHATTR, 04570 TAG_TIMESTAMPBRUSHDATA, 04571 TAG_BRUSHPRESSUREINFO, 04572 TAG_BRUSHATTRPRESSUREINFO, 04573 TAG_BRUSHPRESSUREDATA, 04574 TAG_BRUSHPRESSURESAMPLEDATA, 04575 TAG_BRUSHATTRFILLFLAGS, 04576 TAG_BRUSHTRANSPINFO, 04577 TAG_BRUSHATTRTRANSPINFO, 04578 CXFRH_TAG_LIST_END 04579 }; 04580 04581 return(TagList); 04582 }
|
|
Reads in data, and assigns it to the attribute that we just created.
Definition at line 5364 of file brshattr.cpp. 05365 { 05366 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05367 05368 // we must have a node to import to 05369 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05370 05371 BYTE Flags = 0; 05372 05373 if (!pRecord->ReadBYTE(&Flags)) 05374 return FALSE; 05375 05376 BOOL bUseLocalFill = Flags & BRUSHFILLFLAG_LOCALFILL; 05377 BOOL bUseLocalTransp = Flags & BRUSHFILLFLAG_LOCALTRANSP; 05378 BOOL bUseNamed = Flags & BRUSHFILLFLAG_NAMEDCOL; 05379 05380 // we need to get the path processor 05381 PathProcessorBrush* pPPB = m_pLastAttribute->GetPathProcessor(); 05382 if (pPPB == NULL) 05383 return FALSE; 05384 05385 pPPB->SetUseLocalFillColour(bUseLocalFill); 05386 pPPB->SetUseLocalTransp(bUseLocalTransp); 05387 pPPB->SetUseNamedColours(bUseNamed); 05388 05389 return TRUE; 05390 05391 }
|
|
Reads in data and assigns it to the previously created node.
Definition at line 5161 of file brshattr.cpp. 05162 { 05163 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05164 05165 // we must have a node to import to 05166 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05167 05168 INT32 ScalingPressure = 0; 05169 INT32 SpacingPressure = 0; 05170 INT32 OffsetPressure = 0; 05171 INT32 RotationPressure = 0; 05172 INT32 HuePressure = 0; 05173 INT32 SatPressure = 0; 05174 INT32 TimePressure = 0; 05175 05176 if (!pRecord->ReadINT32(&ScalingPressure) || !pRecord->ReadINT32(&SpacingPressure) || 05177 !pRecord->ReadINT32(&OffsetPressure) || !pRecord->ReadINT32(&RotationPressure) || 05178 !pRecord->ReadINT32(&HuePressure) || !pRecord->ReadINT32(&SatPressure) || 05179 !pRecord->ReadINT32(&TimePressure)) 05180 return FALSE; 05181 05182 // now get the path processor belonging to the last attribute 05183 PathProcessorBrush* pPathProc = m_pLastAttribute->GetPathProcessor(); 05184 05185 // if there isn't a path processor thats ok, as it may be default 05186 if (pPathProc == NULL) 05187 return TRUE; 05188 else 05189 { 05190 pPathProc->SetScalingMaxPressure((UINT32)ScalingPressure); 05191 pPathProc->SetRotationMaxPressure((UINT32)RotationPressure); 05192 } 05193 05194 return TRUE; 05195 }
|
|
Reads in data pertaining to transparency, and other assorted things.
Definition at line 5471 of file brshattr.cpp. 05472 { 05473 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05474 05475 // we must have a node to import to 05476 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05477 05478 // read in the data 05479 INT32 Transp = 0; 05480 INT32 TranspPressure = 0; 05481 double RotIncr = 0.0; 05482 double ScaleIncr = 0.0; 05483 INT32 HueMaxRand = 0; 05484 INT32 HueRandSeed = 0; 05485 INT32 SatMaxRand = 0; 05486 INT32 SatRandSeed = 0; 05487 05488 if (!pRecord->ReadINT32(&Transp) || !pRecord->ReadINT32(&TranspPressure) || 05489 !pRecord->ReadDOUBLE(&RotIncr) || !pRecord->ReadDOUBLE(&ScaleIncr) || 05490 !pRecord->ReadINT32(&HueMaxRand) || !pRecord->ReadINT32(&HueRandSeed) || 05491 !pRecord->ReadINT32(&SatMaxRand) || !pRecord->ReadINT32(&SatRandSeed)) 05492 return FALSE; 05493 05494 // we need to get the path processor 05495 PathProcessorBrush* pPPB = m_pLastAttribute->GetPathProcessor(); 05496 05497 if (pPPB != NULL) 05498 { 05499 pPPB->SetBrushTransparency(Transp); 05500 pPPB->SetTransparencyPressure(UINT32(TranspPressure)); 05501 pPPB->SetRotationIncrConst(RotIncr); 05502 pPPB->SetBrushScalingIncrConst(ScaleIncr); 05503 pPPB->SetHueMaxRand(UINT32(HueMaxRand)); 05504 pPPB->SetHueRandSeed(UINT32(HueRandSeed)); 05505 pPPB->SetSatMaxRand(UINT32(SatMaxRand)); 05506 pPPB->SetSatRandSeed(UINT32(SatRandSeed)); 05507 } 05508 else 05509 ERROR3("Unable to find path processor in BrushAttrRecordHandler::HandleAttrTranspInfo"); 05510 05511 return TRUE; 05512 }
|
|
Reads in data which it uses to create a new AttrBrushType node.
Definition at line 4688 of file brshattr.cpp. 04689 { 04690 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 04691 04692 // first read in all the data 04693 UINT32 Handle = 0x01000000; 04694 INT32 TempOffsetType = 0; 04695 INT32 TempOffsetValue = 0; 04696 INT32 TempSpacing = 10000; 04697 BYTE Flags; 04698 double TempRotateAngle = 0.0; 04699 double TempScaling = 1.0; 04700 // Import the data from the record 04701 if (!pRecord->ReadUINT32(&Handle) || !pRecord->ReadINT32(&TempSpacing) || 04702 !pRecord->ReadBYTE(&Flags) || !pRecord->ReadDOUBLE(&TempRotateAngle) 04703 || !pRecord->ReadINT32(&TempOffsetType) || !pRecord->ReadINT32(&TempOffsetValue) 04704 || !pRecord->ReadDOUBLE(&TempScaling)) 04705 { 04706 return(FALSE); 04707 } 04708 04709 // allocate tge new node 04710 NodeAttribute* pNewNode = new AttrBrushType; 04711 ERROR2IF(pNewNode == NULL, FALSE, "Unable to allocate node attribute"); 04712 04713 // get the brush component from the document 04714 Document* pDoc = Document::GetCurrent(); 04715 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 04716 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 04717 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 04718 04719 // find the brush definition that this brush uses 04720 BrushHandle NewHandle = pBrushComp->FindImportedBrush(Handle); 04721 04722 // allocate a new path processor 04723 PathProcessorBrush* pNewPathProc = new PathProcessorBrush; 04724 ERROR2IF(pNewPathProc == NULL, FALSE, "Unable to allocate path processor"); 04725 // tell it which brush definition to use 04726 pNewPathProc->SetBrushDefinition(NewHandle); 04727 04728 // transfer all the data 04729 pNewPathProc->SetSpacing(TempSpacing); 04730 PathOffset Offset = (PathOffset)TempOffsetType; 04731 pNewPathProc->SetPathOffsetType(Offset); 04732 pNewPathProc->SetPathOffsetValue(TempOffsetValue); 04733 pNewPathProc->SetRotationAngle(TempRotateAngle); 04734 pNewPathProc->SetBrushScaling(TempScaling); 04735 04736 BOOL bTile = Flags & TAG_BRUSHTILE_FLAG; 04737 BOOL bRotate = Flags & TAG_BRUSHROTATE_FLAG; 04738 pNewPathProc->SetRotated(bRotate); 04739 pNewPathProc->SetTiling(bTile); 04740 04741 // now allocate the processor to the AttributeValue 04742 BrushAttrValue* pBrushAttrValue = (BrushAttrValue*)pNewNode->GetAttributeValue(); 04743 ERROR2IF(pBrushAttrValue == NULL, FALSE, "Brush attribute value is NULL"); 04744 pBrushAttrValue->SetPathProcessor(pNewPathProc); 04745 04746 // tell the processor who's the boss 04747 pNewPathProc->SetParentAttribute((AttrBrushType*)pNewNode); 04748 04749 InsertNode(pNewNode); 04750 04751 04752 // set the static member, as there may be more data to come 04753 m_pLastAttribute = (AttrBrushType*)pNewNode; 04754 04755 m_pLastAttribute->GetMaxScalingFromDefinition(); 04756 04757 return TRUE; 04758 04759 }
|
|
Reads in data and assigns it to the previously created BrushDefinition.
Definition at line 4775 of file brshattr.cpp. 04776 { 04777 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 04778 04779 // first read in all the data 04780 UINT32 Handle = 0x01000000; 04781 INT32 TempOffsetType = 0; 04782 INT32 TempOffsetValue = 0; 04783 INT32 TempSpacing = 10000; 04784 BYTE Flags; 04785 String_32 TempName; 04786 double TempScaling = 1.0; 04787 double TempRotateAngle = 0.0; 04788 // Import the data from the record 04789 if (!pRecord->ReadUINT32(&Handle) || !pRecord->ReadINT32(&TempSpacing) || 04790 !pRecord->ReadBYTE(&Flags) || !pRecord->ReadDOUBLE(&TempRotateAngle) 04791 || !pRecord->ReadINT32(&TempOffsetType) || !pRecord->ReadINT32(&TempOffsetValue) 04792 || !pRecord->ReadUnicode(&TempName) || !pRecord->ReadDOUBLE(&TempScaling)) 04793 { 04794 return(FALSE); 04795 } 04796 04797 // convert the variables that were not stored as their original type 04798 PathOffset Offset = (PathOffset)TempOffsetType; 04799 BOOL bTile = Flags & TAG_BRUSHTILE_FLAG; 04800 BOOL bRotate = Flags & TAG_BRUSHROTATE_FLAG; 04801 04802 // If there is a name to be imported, read it as well 04803 //if (!pRecord->ReadUnicode(&TempName)) 04804 // return(FALSE); 04805 04806 // We remember the imported flags and suchlike, which we will use in EndImportLine. 04807 // TempName.Left((StringBase *)&m_ImportedName, 31); 04808 04809 // Now we need to retrieve the previously generated brush definition and assign all 04810 // this lovely data to it. Note that for this to be successful it is vital that 04811 // BrushComponent::StartImportBrush be called prior to this in the import 04812 04813 // get the brush component from the document 04814 Document* pDoc = Document::GetCurrent(); 04815 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 04816 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 04817 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 04818 04819 // find the brush definition that is currently being imported 04820 BrushDefinition* pBrushDef = pBrushComp->GetImportBrushDefinition(); 04821 04822 if (pBrushDef != NULL) 04823 { 04824 // assign the new data to it 04825 pBrushDef->SetSpacing(TempSpacing); 04826 pBrushDef->SetTiling(bTile); 04827 pBrushDef->SetRotated(bRotate); 04828 pBrushDef->SetRotationAngle(TempRotateAngle); 04829 pBrushDef->SetPathOffsetType(Offset); 04830 pBrushDef->SetPathOffsetValue(TempOffsetValue); 04831 pBrushDef->SetLineName(&TempName); 04832 pBrushDef->SetBrushScaling(1.0); 04833 } 04834 // else 04835 // return FALSE; 04836 04837 04838 return TRUE; 04839 }
|
|
Reads in data and assigns it to the previously created node.
Definition at line 5055 of file brshattr.cpp. 05056 { 05057 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05058 05059 // we must have a node to import to 05060 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05061 05062 INT32 RotationMaxRand = 0; 05063 INT32 RotationRandSeed = 0; 05064 BYTE ScaleFlag = 0; 05065 if (!pRecord->ReadINT32(&RotationMaxRand) || !pRecord->ReadINT32(&RotationRandSeed) 05066 || !pRecord->ReadBYTE(&ScaleFlag)) 05067 return FALSE; 05068 05069 05070 // now get the path processor belonging to the last attribute 05071 PathProcessorBrush* pPathProc = m_pLastAttribute->GetPathProcessor(); 05072 05073 // if there isn't a path processor thats ok, as it may be default 05074 if (pPathProc == NULL) 05075 return TRUE; 05076 05077 pPathProc->SetRotationMaxRand((UINT32)RotationMaxRand); 05078 pPathProc->SetRotationRandSeed((UINT32)RotationRandSeed); 05079 05080 BOOL ScaleToLineWidth = ScaleFlag & TAG_SCALETOWIDTH_FLAG; 05081 pPathProc->SetScaleToLineWidth(ScaleToLineWidth); 05082 05083 05084 // set the random hue & sat to zero until we do a tag 05085 /*pPathProc->SetHueMaxRand(0); 05086 pPathProc->SetHueRandSeed(0); 05087 pPathProc->SetSatMaxRand(0); 05088 pPathProc->SetSatRandSeed(0); 05089 pPathProc->SetHueIncrement(1.0); 05090 pPathProc->SetSatIncrement(1.0); 05091 */ 05092 return TRUE; 05093 }
|
|
Reads in data and assigns it to the previously created BrushDefinition.
Definition at line 5012 of file brshattr.cpp. 05013 { 05014 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05015 05016 INT32 RotationMaxRand = 0; 05017 INT32 RotationRandSeed = 0; 05018 05019 if (!pRecord->ReadINT32(&RotationMaxRand) || !pRecord->ReadINT32(&RotationRandSeed)) 05020 return FALSE; 05021 05022 // get the brush component from the document 05023 Document* pDoc = Document::GetCurrent(); 05024 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 05025 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 05026 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 05027 05028 // find the brush definition that is currently being imported 05029 BrushDefinition* pBrushDef = pBrushComp->GetImportBrushDefinition(); 05030 05031 if (pBrushDef != NULL) 05032 { 05033 pBrushDef->SetRotationMaxRand((UINT32)RotationMaxRand); 05034 pBrushDef->SetRotationRandSeed((UINT32)RotationRandSeed); 05035 } 05036 05037 // tell the component we've finished importing 05038 return TRUE; 05039 }
|
|
reads in the same data as previous fn. but assigns it to the path processor of
Definition at line 4931 of file brshattr.cpp. 04932 { 04933 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 04934 // we must have a node to import to 04935 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 04936 04937 // get some variables to read into 04938 double SpacingIncrProp = 1.0; 04939 INT32 SpacingIncrConst = 0; 04940 INT32 SpacingMaxRand = 0; 04941 INT32 SpacingRandSeed = 0; 04942 double ScalingIncr = 1.0; 04943 INT32 ScalingMaxRand = 0; 04944 INT32 ScalingRandSeed = 0; 04945 INT32 Sequence = SEQ_FORWARD; 04946 INT32 SequenceRandSeed = 0; 04947 double OffsetIncrProp = 1.0; 04948 INT32 OffsetIncrConst = 0; 04949 INT32 OffsetTypeRandSeed = 0; 04950 INT32 OffsetValMaxRand = 0; 04951 INT32 OffsetValRandSeed = 0; 04952 INT32 UseLocalFill = -1; 04953 04954 if (!pRecord->ReadDOUBLE(&SpacingIncrProp) || !pRecord->ReadINT32(&SpacingIncrConst) || 04955 !pRecord->ReadINT32(&SpacingMaxRand) || !pRecord->ReadINT32(&SpacingRandSeed) || 04956 !pRecord->ReadDOUBLE(&ScalingIncr) || !pRecord->ReadINT32(&ScalingMaxRand) || 04957 !pRecord->ReadINT32(&ScalingRandSeed) || !pRecord->ReadINT32(&Sequence) || 04958 !pRecord->ReadINT32(&SequenceRandSeed) || !pRecord->ReadDOUBLE(&OffsetIncrProp) || !pRecord->ReadINT32(&OffsetIncrConst) || 04959 !pRecord->ReadINT32(&OffsetTypeRandSeed) || !pRecord->ReadINT32(&OffsetValMaxRand) || 04960 !pRecord->ReadINT32(&OffsetValRandSeed) || !pRecord->ReadINT32(&UseLocalFill) 04961 ) 04962 return FALSE; 04963 04964 // now get the path processor belonging to the last attribute 04965 PathProcessorBrush* pPathProc = m_pLastAttribute->GetPathProcessor(); 04966 04967 // if there isn't a path processor thats ok, as it may be default 04968 if (pPathProc == NULL) 04969 return TRUE; 04970 else 04971 { 04972 pPathProc->SetSpacingIncrProp(SpacingIncrProp); 04973 pPathProc->SetSpacingIncrConst((UINT32)SpacingIncrConst); 04974 pPathProc->SetSpacingMaxRand((UINT32)SpacingMaxRand); 04975 pPathProc->SetSpacingRandSeed((UINT32)SpacingRandSeed); 04976 pPathProc->SetBrushScalingIncr(ScalingIncr); 04977 pPathProc->SetScalingMaxRand((UINT32)ScalingMaxRand); 04978 pPathProc->SetScalingRandSeed((UINT32)ScalingRandSeed); 04979 pPathProc->SetSequenceType((SequenceType)Sequence); 04980 pPathProc->SetSequenceSeed(SequenceRandSeed); 04981 pPathProc->SetPathOffsetIncrProp(OffsetIncrProp); 04982 pPathProc->SetPathOffsetIncrConst((UINT32)OffsetIncrConst); 04983 pPathProc->SetOffsetTypeRandSeed((UINT32)OffsetTypeRandSeed); 04984 pPathProc->SetOffsetValueMaxRand((UINT32)OffsetValMaxRand); 04985 pPathProc->SetOffsetValueRandSeed((UINT32)OffsetValRandSeed); 04986 BOOL UseFill = UseLocalFill > 0 ? TRUE : FALSE; 04987 pPathProc->SetUseLocalFillColour(UseFill); 04988 04989 // gotta set these for the time being 04990 pPathProc->SetRotationMaxRand(0); 04991 pPathProc->SetRotationRandSeed(0); 04992 } 04993 04994 return TRUE; 04995 }
|
|
Reads in data and assigns it to the previously created BrushDefinition.
Definition at line 4855 of file brshattr.cpp. 04856 { 04857 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 04858 04859 // get the variables to read into 04860 double SpacingIncrProp = 1.0; 04861 INT32 SpacingIncrConst = 0; 04862 INT32 SpacingMaxRand = 0; 04863 INT32 SpacingRandSeed = 0; 04864 double ScalingIncr = 1.0; 04865 INT32 ScalingMaxRand = 0; 04866 INT32 ScalingRandSeed = 0; 04867 INT32 Sequence = SEQ_FORWARD; 04868 INT32 SequenceRandSeed = 0; 04869 double OffsetIncrProp = 1.0; 04870 INT32 OffsetIncrConst = 0; 04871 INT32 OffsetTypeRandSeed = 0; 04872 INT32 OffsetValMaxRand = 0; 04873 INT32 OffsetValRandSeed = 0; 04874 04875 if (!pRecord->ReadDOUBLE(&SpacingIncrProp) || !pRecord->ReadINT32(&SpacingIncrConst) || 04876 !pRecord->ReadINT32(&SpacingMaxRand) || !pRecord->ReadINT32(&SpacingRandSeed) || 04877 !pRecord->ReadDOUBLE(&ScalingIncr) || !pRecord->ReadINT32(&ScalingMaxRand) || 04878 !pRecord->ReadINT32(&ScalingRandSeed) || !pRecord->ReadINT32(&Sequence) || 04879 !pRecord->ReadINT32(&SequenceRandSeed) || !pRecord->ReadDOUBLE(&OffsetIncrProp) || 04880 !pRecord->ReadINT32(&OffsetIncrConst) || !pRecord->ReadINT32(&OffsetTypeRandSeed) || 04881 !pRecord->ReadINT32(&OffsetValMaxRand) || !pRecord->ReadINT32(&OffsetValRandSeed) 04882 ) 04883 return FALSE; 04884 04885 // get the brush component from the document 04886 Document* pDoc = Document::GetCurrent(); 04887 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 04888 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 04889 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 04890 04891 // find the brush definition that is currently being imported 04892 BrushDefinition* pBrushDef = pBrushComp->GetImportBrushDefinition(); 04893 04894 if (pBrushDef != NULL) 04895 { 04896 pBrushDef->SetSpacingIncrProp(SpacingIncrProp); 04897 pBrushDef->SetSpacingIncrConst((UINT32)SpacingIncrConst); 04898 pBrushDef->SetSpacingMaxRand((UINT32)SpacingMaxRand); 04899 pBrushDef->SetSpacingRandSeed((UINT32)SpacingRandSeed); 04900 pBrushDef->SetBrushScalingIncr(ScalingIncr); 04901 pBrushDef->SetScalingMaxRand((UINT32)ScalingMaxRand); 04902 pBrushDef->SetScalingRandSeed((UINT32)ScalingRandSeed); 04903 pBrushDef->SetSequenceType((SequenceType)Sequence); 04904 pBrushDef->SetSequenceSeed(SequenceRandSeed); 04905 pBrushDef->SetPathOffsetIncrProp(OffsetIncrProp); 04906 pBrushDef->SetPathOffsetIncrConst((UINT32)OffsetIncrConst); 04907 pBrushDef->SetOffsetTypeRandSeed((UINT32)OffsetTypeRandSeed); 04908 pBrushDef->SetOffsetValueMaxRand((UINT32)OffsetValMaxRand); 04909 pBrushDef->SetOffsetValueRandSeed((UINT32)OffsetValRandSeed); 04910 } 04911 04912 return TRUE; 04913 04914 }
|
|
Reads in timestamp data and assigns it to the last attribute we created.
Definition at line 5211 of file brshattr.cpp. 05212 { 05213 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05214 05215 // we must have a node to import to 05216 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05217 05218 INT32 NumObjects = 0; 05219 05220 if (!pRecord->ReadINT32(&NumObjects)) 05221 return FALSE; 05222 05223 // must be some mistake, but ours not to reason why 05224 if (NumObjects <= 0) 05225 return TRUE; 05226 05227 /* 05228 // otherwise we must make ourselves a list 05229 PressureList* pNewList = new PressureList; 05230 05231 PressureItem TheItem; 05232 INT32 Pressure; 05233 double Proportion; 05234 INT32 Distance; 05235 05236 BOOL ok = TRUE; 05237 while ((NumObjects-- > 0) && ok) 05238 { 05239 if (ok) ok = pRecord->ReadINT32(&Pressure); 05240 if (ok) ok = pRecord->ReadDOUBLE(&Proportion); 05241 if (ok) ok = pRecord->ReadINT32(&Distance); 05242 if (ok) 05243 { 05244 TheItem.m_Pressure = Pressure; 05245 TheItem.m_Proportion = Proportion; 05246 TheItem.m_Distance = Distance; 05247 pNewList->push_back(TheItem); 05248 } 05249 } 05250 05251 if (pNewList && ok) 05252 { 05253 BrushAttrValue* pVal = (BrushAttrValue*)m_pLastAttribute->GetAttributeValue(); 05254 if (pVal) 05255 pVal->SetPressureList(pNewList); 05256 else 05257 { 05258 pNewList->RemoveAll(); 05259 delete pNewList; 05260 } 05261 pNewList = NULL; 05262 } 05263 */ 05264 return TRUE; 05265 }
|
|
Reads in data and assigns it to the previously created BrushDefinition.
Definition at line 5109 of file brshattr.cpp. 05110 { 05111 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05112 05113 INT32 ScalingPressure = 0; 05114 INT32 SpacingPressure = 0; 05115 INT32 OffsetPressure = 0; 05116 INT32 RotationPressure = 0; 05117 INT32 HuePressure = 0; 05118 INT32 SatPressure = 0; 05119 INT32 TimePressure = 0; 05120 05121 if (!pRecord->ReadINT32(&ScalingPressure) || !pRecord->ReadINT32(&SpacingPressure) || 05122 !pRecord->ReadINT32(&OffsetPressure) || !pRecord->ReadINT32(&RotationPressure) || 05123 !pRecord->ReadINT32(&HuePressure) || !pRecord->ReadINT32(&SatPressure) || 05124 !pRecord->ReadINT32(&TimePressure)) 05125 return FALSE; 05126 05127 // get the brush component from the document 05128 Document* pDoc = Document::GetCurrent(); 05129 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 05130 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 05131 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 05132 05133 // find the brush definition that is currently being imported 05134 BrushDefinition* pBrushDef = pBrushComp->GetImportBrushDefinition(); 05135 05136 // currently we only make use of the scaling pressure value, others to follow when I have 05137 // time to implement them 05138 if (pBrushDef != NULL) 05139 { 05140 pBrushDef->SetScalingMaxPressure((UINT32)ScalingPressure); 05141 pBrushDef->SetRotationMaxPressure((UINT32)RotationPressure); 05142 } 05143 05144 return TRUE; 05145 }
|
|
Reads in timestamp data and assigns it to the last attribute we created.
Definition at line 5528 of file brshattr.cpp. 05529 { 05530 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05531 05532 // we must have a node to import to 05533 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05534 05535 // first find out how many objects we have 05536 INT32 NumObjects = 0; 05537 05538 if (!pRecord->ReadINT32(&NumObjects)) 05539 return FALSE; 05540 05541 // must be some mistake, but ours not to reason why 05542 if (NumObjects <= 0) 05543 return TRUE; 05544 05545 // make a new pressure sampler 05546 CDistanceSampler* pSampler = new CDistanceSampler; 05547 05548 if (pSampler == NULL) 05549 return FALSE; 05550 05551 if (!pSampler->InitialiseData(NumObjects)) 05552 { 05553 delete pSampler; 05554 return FALSE; 05555 } 05556 pSampler->SetCollectionSampleRate(1); 05557 05558 CSampleItem TheItem; 05559 DocCoord TheCoord; 05560 MILLIPOINT TheDistance = 0; 05561 INT32 ThePressure = 0; 05562 BOOL ok = TRUE; 05563 BOOL KeepAdding = TRUE; 05564 UINT32 Count = 0; 05565 while (ok && KeepAdding) 05566 { 05567 if (ok) ok = pRecord->ReadINT32(&ThePressure); 05568 if (ok) ok = pRecord->ReadCoord(&TheCoord); 05569 if (ok) ok = pRecord->ReadINT32(&TheDistance); 05570 05571 TheItem.m_Pressure = (UINT32)ThePressure; 05572 TheItem.m_Coord = TheCoord; 05573 TheItem.m_Distance = TheDistance; 05574 05575 if (ok) KeepAdding = pSampler->SetNext(TheItem); 05576 Count++; 05577 } 05578 05579 pSampler->SetDistanceSoFar (TheItem.m_Distance); 05580 05581 if (ok) 05582 m_pLastAttribute->SetPressureCache(pSampler); 05583 else 05584 delete pSampler; 05585 05586 return ok; 05587 }
|
|
Handles loading of the given AttrBrushType attribute record.
Implements CXaraFileRecordHandler. Definition at line 4602 of file brshattr.cpp. 04603 { 04604 ERROR3IF(pCXaraFileRecord == NULL, "pCXaraFileRecord is NULL"); 04605 04606 // NodeAttribute* pNewNode = NULL; 04607 BOOL RetVal = TRUE; 04608 switch (pCXaraFileRecord->GetTag()) 04609 { 04610 case TAG_BRUSHDEFINITION: 04611 { 04612 // get the brush component from the document 04613 Document* pDoc = Document::GetCurrent(); 04614 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 04615 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 04616 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 04617 UINT32 ImportHandle = 0; 04618 BOOL ok = pCXaraFileRecord->ReadUINT32(&ImportHandle); 04619 04620 if (ok) 04621 RetVal = pBrushComp->StartImportBrush(this, pCXaraFileRecord, ImportHandle); 04622 } 04623 break; 04624 case TAG_BRUSHDATA: 04625 RetVal = HandleBrushDataRecord(pCXaraFileRecord); 04626 break; 04627 case TAG_BRUSHATTR: 04628 RetVal = HandleBrushAttributeRecord(pCXaraFileRecord); 04629 break; 04630 case TAG_MOREBRUSHDATA: 04631 RetVal = HandleMoreBrushDataRecord(pCXaraFileRecord); 04632 break; 04633 case TAG_MOREBRUSHATTR: 04634 RetVal = HandleMoreBrushAttrRecord(pCXaraFileRecord); 04635 break; 04636 case TAG_EVENMOREBRUSHDATA: 04637 RetVal = HandleEvenMoreBrushData(pCXaraFileRecord); 04638 break; 04639 case TAG_EVENMOREBRUSHATTR: 04640 RetVal = HandleEvenMoreBrushAttr(pCXaraFileRecord); 04641 break; 04642 case TAG_TIMESTAMPBRUSHDATA: 04643 RetVal = HandleTimeStampData(pCXaraFileRecord); 04644 break; 04645 case TAG_BRUSHPRESSUREINFO: 04646 RetVal = HandlePressureInfo(pCXaraFileRecord); 04647 break; 04648 case TAG_BRUSHATTRPRESSUREINFO: 04649 RetVal = HandleAttrPressureInfo(pCXaraFileRecord); 04650 break; 04651 case TAG_BRUSHPRESSUREDATA: 04652 RetVal = HandlePressureData(pCXaraFileRecord); 04653 break; 04654 case TAG_BRUSHPRESSURESAMPLEDATA: 04655 RetVal = HandlePressureSampleData(pCXaraFileRecord); 04656 break; 04657 case TAG_BRUSHATTRFILLFLAGS: 04658 RetVal = HandleAttrFillFlags(pCXaraFileRecord); 04659 break; 04660 case TAG_BRUSHTRANSPINFO: 04661 RetVal = HandleTranspInfo(pCXaraFileRecord); 04662 break; 04663 case TAG_BRUSHATTRTRANSPINFO: 04664 RetVal = HandleAttrTranspInfo(pCXaraFileRecord); 04665 break; 04666 default: 04667 ERROR3_PF(("I don't handle records with the tag (%d)\n", pCXaraFileRecord->GetTag())); 04668 break; 04669 } 04670 04671 return(RetVal); 04672 }
|
|
Reads in timestamp data and assigns it to the last attribute we created.
Definition at line 5281 of file brshattr.cpp. 05282 { 05283 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05284 05285 // we must have a node to import to 05286 ERROR2IF(m_pLastAttribute == NULL, FALSE, "No last attribute to import to"); 05287 05288 // first find out how many objects we have 05289 INT32 NumObjects = 0; 05290 05291 if (!pRecord->ReadINT32(&NumObjects)) 05292 return FALSE; 05293 05294 // must be some mistake, but ours not to reason why 05295 if (NumObjects <= 0) 05296 return TRUE; 05297 05298 // otherwise we must make ourselves a list 05299 TimeStampList* pNewList = new TimeStampList; 05300 05301 // we may fail to get the list, however we must still read in the data or the next 05302 // record will be really screwed 05303 05304 DocCoord Point; 05305 double Tangent; 05306 double Proportion; 05307 MILLIPOINT Distance; 05308 05309 TimeStampBrushPoint TSBP; 05310 BOOL ok = TRUE; 05311 while ((NumObjects-- > 0) && ok) 05312 { 05313 if (ok) ok = pRecord->ReadCoord(&Point); 05314 if (ok) ok = pRecord->ReadDOUBLE(&Tangent); 05315 if (ok) ok = pRecord->ReadDOUBLE(&Proportion); 05316 if (ok) ok = pRecord->ReadINT32(&Distance); 05317 TRACEUSER("Diccon", _T("Read Point %d, %d\n"), Point.x, Point.y); 05318 if (pNewList != NULL && ok) 05319 { 05320 TSBP.m_Distance = Distance; 05321 TSBP.m_Point = Point; 05322 // not quite sure why I have to make this atrocious hack. It seems that 05323 // somewhere between being written and being read the millipoint values 05324 // had 576000 added to them. 05325 TSBP.m_Point.x -= 576000; 05326 TSBP.m_Point.y -= 576000; 05327 TSBP.m_Proportion = Proportion; 05328 TSBP.m_Tangent = Tangent; 05329 TSBP.m_Pressure = MAXPRESSURE / 2; //?? 05330 pNewList->push_back(TSBP); 05331 } 05332 } 05333 05334 if (pNewList) 05335 { 05336 BrushAttrValue* pVal = (BrushAttrValue*)m_pLastAttribute->GetAttributeValue(); 05337 if (pVal) 05338 pVal->SetTimeStampList(pNewList); 05339 else 05340 { 05341 pNewList->clear(); 05342 delete pNewList; 05343 } 05344 pNewList = NULL; 05345 } 05346 return ok; 05347 05348 }
|
|
Reads in data pertaining to transparency, and other assorted things.
Definition at line 5407 of file brshattr.cpp. 05408 { 05409 ERROR2IF(pRecord == NULL, FALSE, "Record is NULL"); 05410 05411 INT32 Transp = 0; 05412 INT32 TranspPressure = 0; 05413 double RotIncr = 0.0; 05414 double ScaleIncr = 0.0; 05415 INT32 HueMaxRand = 0; 05416 INT32 HueRandSeed = 0; 05417 INT32 SatMaxRand = 0; 05418 INT32 SatRandSeed = 0; 05419 05420 if (!pRecord->ReadINT32(&Transp) || !pRecord->ReadINT32(&TranspPressure) || 05421 !pRecord->ReadDOUBLE(&RotIncr) || !pRecord->ReadDOUBLE(&ScaleIncr) || 05422 !pRecord->ReadINT32(&HueMaxRand) || !pRecord->ReadINT32(&HueRandSeed) || 05423 !pRecord->ReadINT32(&SatMaxRand) || !pRecord->ReadINT32(&SatRandSeed)) 05424 return FALSE; 05425 05426 // get the brush component from the document 05427 Document* pDoc = Document::GetCurrent(); 05428 ERROR2IF(pDoc == NULL, FALSE, "Wheres the document?"); 05429 BrushComponent* pBrushComp = (BrushComponent*)pDoc->GetDocComponent(CC_RUNTIME_CLASS(BrushComponent)); 05430 ERROR2IF(pBrushComp == NULL, FALSE, "No brush component"); 05431 05432 // find the brush definition that is currently being imported 05433 BrushDefinition* pBrushDef = pBrushComp->GetImportBrushDefinition(); 05434 05435 // give the data to the definition 05436 if (pBrushDef != NULL) 05437 { 05438 pBrushDef->SetBrushTransparency(Transp); 05439 pBrushDef->SetTransparencyPressure(UINT32(TranspPressure)); 05440 pBrushDef->SetRotationIncrConst(RotIncr); 05441 pBrushDef->SetBrushScalingIncrConst(ScaleIncr); 05442 pBrushDef->SetHueMaxRand(UINT32(HueMaxRand)); 05443 pBrushDef->SetHueRandSeed(UINT32(HueRandSeed)); 05444 pBrushDef->SetSatMaxRand(UINT32(SatMaxRand)); 05445 pBrushDef->SetSatRandSeed(UINT32(SatRandSeed)); 05446 } 05447 else 05448 ERROR3("Unable to find brush definition in BrushAttrRecordHandler::HandleTranspInfo"); 05449 05450 // this is the end of this brush import 05451 m_pLastAttribute = NULL; 05452 05453 return pBrushComp->EndImportBrush(this); 05454 05455 }
|
|
Definition at line 499 of file brshattr.h. |