#include <rechblnd.h>
Inheritance diagram for BlendRecordHandler:
Public Member Functions | |
BlendRecordHandler () | |
~BlendRecordHandler () | |
virtual UINT32 * | GetTagList () |
Provides the record handler system with a list of records handled by this handler. | |
virtual BOOL | HandleRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. | |
Static Public Member Functions | |
static void | SetLastInsertedNodeBlender (NodeBlender *pNodeBlender) |
static void | SetLastInsertedNodeBlend (NodeBlend *pNodeBlend) |
static void | SetLastInsertedNodeBlendPath (NodeBlendPath *pNodeBlendPath) |
Private Member Functions | |
CC_DECLARE_DYNAMIC (BlendRecordHandler) | |
BOOL | HandleBlendRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blend record. | |
BOOL | HandleBlenderRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blender record. | |
BOOL | HandleBlenderCurvePropRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blender curve proportion record. | |
BOOL | HandleBlenderCurveAnglesRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blender curve angles record. | |
BOOL | HandleBlendPathRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blend path record. | |
BOOL | HandleBlendProfileRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blend profile record. | |
BOOL | HandleBlenderExtraRecord (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a a blender extra info record (exact contents yet to be finalised). | |
BOOL | HandleBlendPathFlags (CXaraFileRecord *pCXaraFileRecord) |
Handles the given record. The record has to be a blend path filled record. | |
Static Private Member Functions | |
static NodeBlender * | GetLastInsertedNodeBlender () |
static NodeBlend * | GetLastInsertedNodeBlend () |
static NodeBlendPath * | GetLastInsertedNodeBlendPath () |
Static Private Attributes | |
static NodeBlender * | m_pLastInsertedNodeBlender |
static NodeBlend * | m_pLastInsertedNodeBlend = NULL |
static NodeBlendPath * | m_pLastNodeBlendPath = NULL |
static BOOL | m_bLoadedProfiles = FALSE |
static CProfileBiasGain | m_LastObjectProfile |
static CProfileBiasGain | m_LastAttrProfile |
static CProfileBiasGain | m_LastPositionProfile |
Definition at line 120 of file rechblnd.h.
|
Definition at line 126 of file rechblnd.h. 00126 : CamelotRecordHandler() { m_pLastInsertedNodeBlender = NULL; 00127 m_pLastInsertedNodeBlend = NULL; 00128 m_pLastNodeBlendPath = NULL; 00129 m_bLoadedProfiles = FALSE;}
|
|
Definition at line 130 of file rechblnd.h.
|
|
|
|
Definition at line 146 of file rechblnd.h. 00146 { return m_pLastInsertedNodeBlend; }
|
|
Definition at line 145 of file rechblnd.h. 00145 { return m_pLastInsertedNodeBlender; }
|
|
Definition at line 147 of file rechblnd.h. 00147 { return m_pLastNodeBlendPath; }
|
|
Provides the record handler system with a list of records handled by this handler.
Implements CXaraFileRecordHandler. Definition at line 4079 of file nodeblnd.cpp. 04080 { 04081 static UINT32 TagList[] = { TAG_BLEND, 04082 TAG_BLENDER, 04083 TAG_BLENDER_CURVEPROP, 04084 TAG_BLENDER_CURVEANGLES, 04085 TAG_BLEND_PATH, 04086 TAG_BLENDPROFILES, 04087 TAG_BLENDERADDITIONAL, 04088 TAG_NODEBLENDPATH_FILLED, 04089 CXFRH_TAG_LIST_END}; 04090 04091 return (UINT32*)&TagList; 04092 }
|
|
Handles the given record. The record has to be a blender curve angles record.
Definition at line 4347 of file nodeblnd.cpp. 04348 { 04349 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04350 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BLENDER_CURVEANGLES,FALSE,"I don't handle this tag type"); 04351 04352 BOOL ok = TRUE; 04353 NodeBlender* pNodeBlender = GetLastInsertedNodeBlender(); 04354 04355 if (pNodeBlender != NULL) 04356 { 04357 double AngleStart = 0.0; 04358 double AngleEnd = 0.0; 04359 04360 ok = pCXaraFileRecord->ReadDOUBLE(&AngleStart); 04361 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&AngleEnd); 04362 04363 if (ok) 04364 { 04365 pNodeBlender->SetAngleStart(AngleStart); 04366 pNodeBlender->SetAngleEnd(AngleEnd); 04367 } 04368 } 04369 04370 return ok; 04371 }
|
|
Handles the given record. The record has to be a blender curve proportion record.
Definition at line 4305 of file nodeblnd.cpp. 04306 { 04307 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04308 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BLENDER_CURVEPROP,FALSE,"I don't handle this tag type"); 04309 04310 BOOL ok = TRUE; 04311 NodeBlender* pNodeBlender = GetLastInsertedNodeBlender(); 04312 04313 if (pNodeBlender != NULL) 04314 { 04315 double ProportionOfPathDistStart = -1.0; 04316 double ProportionOfPathDistEnd = -1.0; 04317 04318 ok = pCXaraFileRecord->ReadDOUBLE(&ProportionOfPathDistStart); 04319 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&ProportionOfPathDistEnd); 04320 04321 if (ok) 04322 { 04323 pNodeBlender->SetProportionOfPathDistStart(ProportionOfPathDistStart); 04324 pNodeBlender->SetProportionOfPathDistEnd(ProportionOfPathDistEnd); 04325 } 04326 } 04327 04328 return ok; 04329 }
|
|
Handles the given record. The record has to be a a blender extra info record (exact contents yet to be finalised).
Definition at line 4495 of file nodeblnd.cpp. 04496 { 04497 ERROR2IF(pRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04498 ERROR2IF(pRecord->GetTag() != TAG_BLENDERADDITIONAL,FALSE,"I don't handle this tag type"); 04499 04500 INT32 Flag; 04501 INT32 Index; 04502 INT32 ObjIndexStart; 04503 INT32 ObjIndexEnd; 04504 BYTE BitField; 04505 04506 BOOL ok = pRecord->ReadINT32(&Flag); 04507 if (ok) ok = pRecord->ReadINT32(&Index); 04508 if (ok) ok = pRecord->ReadINT32(&ObjIndexStart); 04509 if (ok) ok = pRecord->ReadINT32(&ObjIndexEnd); 04510 if (ok) 04511 { 04512 // if this fn fails, it means we read in an old file without BitField 04513 // info, so we arbitrarily set it to 0. 04514 if (!pRecord->ReadBYTEnoError(&BitField)) 04515 BitField = 0; 04516 } 04517 04518 if (ok) 04519 { 04520 NodeBlender* pBlender = GetLastInsertedNodeBlender(); 04521 ERROR2IF(pBlender == NULL, FALSE, "No NodeBlender"); 04522 04523 pBlender->SetBlendedOnCurve(Flag); 04524 pBlender->SetNodeBlendPathIndex(Index); 04525 pBlender->SetObjIndexStart(ObjIndexStart); 04526 pBlender->SetObjIndexEnd(ObjIndexEnd); 04527 pBlender->SetReversed((BitField & 1) == 1); 04528 04529 NodeBlend* pNodeBlend = pBlender->GetNodeBlend(); 04530 ERROR2IF(pNodeBlend == NULL, FALSE, "Parent is not NodeBlend"); 04531 04532 INT32 CurrentNodeBlendPaths = (INT32)pNodeBlend->GetNumNodeBlendPaths(); 04533 if (Index > CurrentNodeBlendPaths) 04534 pNodeBlend->SetNumNodeBlendPaths(Index+1); 04535 04536 } 04537 return ok; 04538 }
|
|
Handles the given record. The record has to be a blender record. BOOL BlendRecordHandler::HandleBlenderRecord(CXaraFileRecord* pCXaraFileRecord)
Definition at line 4259 of file nodeblnd.cpp. 04260 { 04261 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04262 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BLENDER,FALSE,"I don't handle this tag type"); 04263 04264 INT32 PathIndexStart= -1; 04265 INT32 PathIndexEnd = -1; 04266 04267 BOOL ok = pCXaraFileRecord->ReadINT32(&PathIndexStart); 04268 if (ok) ok = pCXaraFileRecord->ReadINT32(&PathIndexEnd); 04269 04270 if (ok) 04271 { 04272 NodeBlender* pBlender = new NodeBlender; 04273 if (pBlender != NULL) 04274 { 04275 pBlender->SetPathIndexStart(PathIndexStart); 04276 pBlender->SetPathIndexEnd(PathIndexEnd); 04277 04278 ok = InsertNode(pBlender); 04279 if (ok) SetLastInsertedNodeBlender(pBlender); 04280 04281 } 04282 else 04283 ok = FALSE; 04284 } 04285 04286 return ok; 04287 }
|
|
Handles the given record. The record has to be a blend path filled record.
Definition at line 4453 of file nodeblnd.cpp. 04454 { 04455 ERROR2IF(pXFRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04456 ERROR2IF(pXFRecord->GetTag() != TAG_NODEBLENDPATH_FILLED,FALSE,"I don't handle this tag type"); 04457 04458 INT32 Flag; 04459 BOOL ok = pXFRecord->ReadINT32(&Flag); 04460 04461 if (ok) 04462 { 04463 NodeBlendPath* pNodeBlendPath = GetLastInsertedNodeBlendPath(); 04464 ERROR2IF(pNodeBlendPath == NULL, FALSE, "No NodeBlendPath"); 04465 04466 pNodeBlendPath->InkPath.IsFilled = Flag; 04467 } 04468 04469 return ok; 04470 }
|
|
Handles the given record. The record has to be a blend path record.
Definition at line 4389 of file nodeblnd.cpp. 04390 { 04391 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04392 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BLEND_PATH,FALSE,"I don't handle this tag type"); 04393 04394 BOOL ok = FALSE; 04395 04396 NodeBlendPath* pNodeBlendPath = new NodeBlendPath; 04397 04398 if (pNodeBlendPath != NULL && pNodeBlendPath->SetUpPath()) 04399 { 04400 ok = pCXaraFileRecord->ReadPath(&pNodeBlendPath->InkPath); 04401 if (ok) pNodeBlendPath->InkPath.InitialiseFlags(); // Init the path flags array to something sensible 04402 if (ok) ok = InsertNode(pNodeBlendPath); 04403 if (ok) 04404 { 04405 SetLastNodePathInserted(pNodeBlendPath); 04406 SetLastInsertedNodeBlendPath(pNodeBlendPath); 04407 } 04408 if (ok) 04409 { 04410 Node* pParent = pNodeBlendPath->FindParent(); 04411 if ((pParent != NULL) && (pParent->IS_KIND_OF(NodeBlend))) 04412 { 04413 NodeBlend* pNodeBlend = (NodeBlend*)pParent; 04414 pNodeBlend->SetBlendedOnCurve(TRUE); 04415 pNodeBlend->SetNumNodeBlendPathsInc(TRUE); 04416 04417 // this deals with the case of older files that contain a blend on a curve. 04418 // these blends will contain only one NBP and all blenders will refer to that 04419 // curve. 04420 // We can tell the old files because their Index values will not have been changed 04421 // from the default value of -2. 04422 NodeBlender* pBlender = pNodeBlend->FindFirstBlender(); 04423 while (pBlender != NULL) 04424 { 04425 if (pBlender->GetNodeBlendPathIndex() == -2) 04426 pBlender->SetNodeBlendPathIndex(0); 04427 04428 pBlender = pNodeBlend->FindNextBlender(pBlender); 04429 } 04430 } 04431 } 04432 } 04433 04434 return ok; 04435 }
|
|
Handles the given record. The record has to be a blend profile record.
Definition at line 4560 of file nodeblnd.cpp. 04561 { 04562 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04563 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BLENDPROFILES,FALSE,"I don't handle this tag type"); 04564 04565 double ObjBias = 0.0; 04566 double ObjGain = 0.0; 04567 double AttrBias = 0.0; 04568 double AttrGain = 0.0; 04569 double PosBias = 0.0; 04570 double PosGain = 0.0; 04571 04572 BOOL ok = pCXaraFileRecord->ReadDOUBLE(&ObjBias); 04573 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&ObjGain); 04574 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&AttrBias); 04575 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&AttrGain); 04576 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&PosBias); 04577 if (ok) ok = pCXaraFileRecord->ReadDOUBLE(&PosGain); 04578 04579 m_LastObjectProfile.SetBiasGain(ObjBias, ObjGain); 04580 m_LastAttrProfile.SetBiasGain(AttrBias, AttrGain); 04581 m_LastPositionProfile.SetBiasGain(PosBias, PosGain); 04582 04583 m_bLoadedProfiles = TRUE; 04584 04585 return ok; 04586 }
|
|
Handles the given record. The record has to be a blend record. BOOL BlendRecordHandler::HandleBlendRecord(CXaraFileRecord* pCXaraFileRecord)
Definition at line 4170 of file nodeblnd.cpp. 04171 { 04172 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04173 ERROR2IF(pCXaraFileRecord->GetTag() != TAG_BLEND,FALSE,"I don't handle this tag type"); 04174 04175 UINT16 NumSteps = 0; 04176 BYTE Flags = 0; 04177 04178 BOOL ok = pCXaraFileRecord->ReadUINT16(&NumSteps); 04179 if (ok) ok = pCXaraFileRecord->ReadBYTE(&Flags); 04180 04181 if (ok) 04182 { 04183 NodeBlend* pBlend = new NodeBlend; 04184 if (pBlend != NULL) 04185 { 04186 BOOL OneToOne = Flags & TAG_BLEND_FLAG_ONETOONE; 04187 BOOL Antialias = Flags & TAG_BLEND_FLAG_ANTIALIAS; 04188 BOOL Tangential= Flags & TAG_BLEND_FLAG_TANGENTIAL; 04189 BYTE ColEffect = (Flags & TAG_BLEND_COLEFFECT_MASK) >> TAG_BLEND_COLEFFECT_SHIFT; 04190 04191 pBlend->SetOneToOne(OneToOne != 0); 04192 pBlend->SetNotAntialiased(Antialias == 0); 04193 pBlend->SetTangential(Tangential != 0); 04194 pBlend->SetNumBlendSteps(NumSteps); 04195 pBlend->SetColourBlendType(ColourBlendType(ColEffect)); 04196 04197 ok = InsertNode(pBlend); 04198 if (ok) 04199 SetLastInsertedNodeBlend(pBlend); 04200 04201 // load the profiles, if we have some 04202 if (m_bLoadedProfiles && ok) 04203 { 04204 CProfileBiasGain* pObjProfile = pBlend->GetObjectProfile(); 04205 if (pObjProfile == NULL) 04206 ok = FALSE; 04207 else 04208 { 04209 pObjProfile->SetBiasGain(m_LastObjectProfile.GetBias(), m_LastObjectProfile.GetGain()); 04210 pBlend->RequestObjectProfileProcessing (TRUE); 04211 } 04212 if (ok) 04213 { 04214 CProfileBiasGain* pAttrProfile = pBlend->GetAttrProfile(); 04215 if (pAttrProfile == NULL) 04216 ok = FALSE; 04217 else 04218 { 04219 pAttrProfile->SetBiasGain(m_LastAttrProfile.GetBias(), m_LastAttrProfile.GetGain()); 04220 pBlend->RequestObjectProfileProcessing (TRUE); 04221 } 04222 } 04223 if (ok) 04224 { 04225 CProfileBiasGain* pPosProfile = pBlend->GetPositionProfile(); 04226 if (pPosProfile == NULL) 04227 ok = FALSE; 04228 else 04229 pPosProfile->SetBiasGain(m_LastPositionProfile.GetBias(), m_LastPositionProfile.GetGain()); 04230 } 04231 } 04232 04233 04234 } 04235 else 04236 ok = FALSE; 04237 } 04238 04239 m_bLoadedProfiles = FALSE; 04240 return ok; 04241 }
|
|
Handles the given record.
Implements CXaraFileRecordHandler. Definition at line 4109 of file nodeblnd.cpp. 04110 { 04111 ERROR2IF(pCXaraFileRecord == NULL,FALSE,"pCXaraFileRecord is NULL"); 04112 04113 BOOL ok = TRUE; 04114 04115 switch (pCXaraFileRecord->GetTag()) 04116 { 04117 case TAG_BLEND: 04118 ok = HandleBlendRecord(pCXaraFileRecord); 04119 break; 04120 04121 case TAG_BLENDER: 04122 ok = HandleBlenderRecord(pCXaraFileRecord); 04123 break; 04124 04125 case TAG_BLENDER_CURVEPROP: 04126 ok = HandleBlenderCurvePropRecord(pCXaraFileRecord); 04127 break; 04128 04129 case TAG_BLENDER_CURVEANGLES: 04130 ok = HandleBlenderCurveAnglesRecord(pCXaraFileRecord); 04131 break; 04132 04133 case TAG_BLEND_PATH: 04134 ok = HandleBlendPathRecord(pCXaraFileRecord); 04135 break; 04136 case TAG_NODEBLENDPATH_FILLED: 04137 ok = HandleBlendPathFlags(pCXaraFileRecord); 04138 break; 04139 case TAG_BLENDPROFILES: 04140 ok = HandleBlendProfileRecord(pCXaraFileRecord); 04141 break; 04142 case TAG_BLENDERADDITIONAL: 04143 ok = HandleBlenderExtraRecord(pCXaraFileRecord); 04144 break; 04145 default: 04146 ok = FALSE; 04147 ERROR3_PF(("I don't handle records with the tag (%d)\n",pCXaraFileRecord->GetTag())); 04148 break; 04149 } 04150 04151 return ok; 04152 }
|
|
Definition at line 141 of file rechblnd.h. 00141 { m_pLastInsertedNodeBlend = pNodeBlend; }
|
|
Definition at line 140 of file rechblnd.h. 00140 { m_pLastInsertedNodeBlender = pNodeBlender; }
|
|
Definition at line 142 of file rechblnd.h. 00142 { m_pLastNodeBlendPath = pNodeBlendPath; }
|
|
Definition at line 166 of file rechblnd.h. |
|
Definition at line 168 of file rechblnd.h. |
|
Definition at line 167 of file rechblnd.h. |
|
Definition at line 169 of file rechblnd.h. |
|
Definition at line 160 of file rechblnd.h. |
|
Definition at line 159 of file rechblnd.h. |
|
Definition at line 161 of file rechblnd.h. |