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
00099
00100
00101
00102 #include "camtypes.h"
00103 #include "xpfcaps.h"
00104
00105 #include "xpfrgn.h"
00106
00107 #include "cxfrgshp.h"
00108
00109 #include "strkattr.h"
00110 #include "brshattr.h"
00111 #include "fillramp.h"
00112 #include "fthrattr.h"
00113 #include "fillattr2.h"
00114
00115
00116 CC_IMPLEMENT_MEMDUMP(XPFCapability, CC_CLASS_MEMDUMP);
00117 CC_IMPLEMENT_MEMDUMP(XPFCComplexClass, XPFCapability);
00118 CC_IMPLEMENT_MEMDUMP(XPFCLayer, XPFCComplexClass);
00119 CC_IMPLEMENT_MEMDUMP(XPFCContour, XPFCComplexClass);
00120 CC_IMPLEMENT_MEMDUMP(XPFCShadow, XPFCComplexClass);
00121 CC_IMPLEMENT_MEMDUMP(XPFCBevel, XPFCComplexClass);
00122 CC_IMPLEMENT_MEMDUMP(XPFCBlend, XPFCComplexClass);
00123 CC_IMPLEMENT_MEMDUMP(XPFCMould, XPFCComplexClass);
00124 CC_IMPLEMENT_MEMDUMP(XPFCRectangle, XPFCComplexClass);
00125 CC_IMPLEMENT_MEMDUMP(XPFCEllipse, XPFCComplexClass);
00126 CC_IMPLEMENT_MEMDUMP(XPFCPolygon, XPFCComplexClass);
00127 CC_IMPLEMENT_MEMDUMP(XPFCBitmap, XPFCComplexClass);
00128 CC_IMPLEMENT_MEMDUMP(XPFCText, XPFCComplexClass);
00129 CC_IMPLEMENT_MEMDUMP(XPFCClipView, XPFCComplexClass);
00130 CC_IMPLEMENT_MEMDUMP(XPFCBitmapEffect, XPFCComplexClass);
00131 CC_IMPLEMENT_MEMDUMP(XPFCFill, XPFCapability);
00132 CC_IMPLEMENT_MEMDUMP(XPFCFillTrans, XPFCapability);
00133 CC_IMPLEMENT_MEMDUMP(XPFCLine, XPFCapability);
00134 CC_IMPLEMENT_MEMDUMP(XPFCLineTrans, XPFCapability);
00135 CC_IMPLEMENT_MEMDUMP(XPFCFeather, XPFCapability);
00136 CC_IMPLEMENT_MEMDUMP(XPFCColour, XPFCapability);
00137
00138 CC_IMPLEMENT_MEMDUMP(CapabilityTree, CC_CLASS_MEMDUMP);
00139
00140
00141
00142 #define new CAM_DEBUG_NEW
00143
00144
00145 XPFConvertType XPFCapability::GetConvertTypeForNode(Node* pNode)
00146 {
00147 if (!DoesNodeMatch(pNode))
00148 return(XPFCONVTYPE_UNKNOWN);
00149
00150 XPFConvertType Type = m_ConvertType;
00151
00152
00153
00154
00155 XPFCapability* pCap = m_pChild;
00156 while (pCap)
00157 {
00158 XPFConvertType ThisType = pCap->GetConvertTypeForNode(pNode);
00159 if (ThisType != XPFCONVTYPE_UNKNOWN)
00160 Type = ThisType;
00161 pCap = pCap->GetNext();
00162 }
00163
00164 return(Type);
00165 }
00166
00167 XPFConvertType XPFCapability::GetConvertTypeForAttrs(RenderRegion* pRegion)
00168 {
00169 if (!DoAttributesMatch(pRegion))
00170 return(XPFCONVTYPE_UNKNOWN);
00171
00172 XPFConvertType Type = m_ConvertType;
00173
00174
00175
00176
00177 XPFCapability* pCap = m_pChild;
00178 while (pCap)
00179 {
00180 XPFConvertType ThisType = pCap->GetConvertTypeForAttrs(pRegion);
00181 if (ThisType != XPFCONVTYPE_UNKNOWN)
00182 Type = ThisType;
00183 pCap = pCap->GetNext();
00184 }
00185
00186 return(Type);
00187 }
00188
00189
00190 BOOL XPFCapability::AreAllChildrenText(Node* pRootNode, BOOL bPlain)
00191 {
00192 Node* pNode = pRootNode->FindFirstChild();
00193 while (pNode)
00194 {
00195
00196 if (pNode->IsAnObject())
00197 {
00198
00199 if (pNode->IsAGroup() && !AreAllChildrenText(pNode, bPlain))
00200 return(FALSE);
00201
00202
00203 if (!IS_A(pNode, TextStory))
00204 return(FALSE);
00205
00206 if (bPlain && !IsTextStoryPlain(pNode))
00207 return(FALSE);
00208 }
00209
00210
00211 pNode = pNode->FindNext();
00212 }
00213
00214 return(TRUE);
00215 }
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 BOOL XPFCapability::IsTextStoryPlain(Node* pNode)
00233 {
00234
00235
00236
00237 Node* pChild = pNode->FindFirstChild();
00238 while (pChild)
00239 {
00240 if (!IsTextStoryPlain(pChild))
00241 return(FALSE);
00242
00243 pChild = pChild->FindNext();
00244 }
00245
00246 if (pNode->IsAnAttribute())
00247 {
00248 NodeAttribute* pAttr = (NodeAttribute*)pNode;
00249
00250
00251
00252 if (pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry))
00253 {
00254 if (!pAttr->IsAFlatFill())
00255 return(FALSE);
00256 }
00257 else if (pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrTranspFillGeometry))
00258 {
00259 if (!pAttr->IsAFlatFill())
00260 return(FALSE);
00261
00262 TranspFillAttribute* pTrans = (TranspFillAttribute*)(pAttr->GetAttributeValue());
00263
00264 UINT32 Type = pTrans->GetTranspType();
00265
00266 if (Type != TT_Mix ||
00267 *(pTrans->GetStartTransp()) != 0)
00268 {
00269 return(FALSE);
00270 }
00271 }
00272 else
00273 {
00274 switch (pAttr->GetAttributeIndex())
00275 {
00276 case ATTR_FILLGEOMETRY:
00277 case ATTR_TRANSPFILLGEOMETRY:
00278 {
00279 TRACEUSER( "Gerry", _T("FillGeometry attribute not trapped\n"));
00280 }
00281 break;
00282
00283 case ATTR_DASHPATTERN:
00284 {
00285 DashPatternAttribute* pDash = (DashPatternAttribute*)(pAttr->GetAttributeValue());
00286 DashPatternAttribute NoDash;
00287
00288
00289 if (NoDash.IsDifferent(pDash))
00290 return(FALSE);
00291 }
00292 break;
00293
00294 case ATTR_STROKETYPE:
00295 {
00296 StrokeTypeAttrValue* pStroke = (StrokeTypeAttrValue*)(pAttr->GetAttributeValue());
00297 StrokeTypeAttrValue DefStroke;
00298 if (!((*pStroke) == DefStroke))
00299 return(FALSE);
00300 }
00301 break;
00302
00303 case ATTR_VARWIDTH:
00304 {
00305 VariableWidthAttrValue* pVarWidth = (VariableWidthAttrValue*)(pAttr->GetAttributeValue());
00306 VariableWidthAttrValue DefVarWidth;
00307 if (!((*pVarWidth) == DefVarWidth))
00308 return(FALSE);
00309 }
00310 break;
00311
00312 case ATTR_BRUSHTYPE:
00313 {
00314 BrushAttrValue* pBrush = (BrushAttrValue*)(pAttr->GetAttributeValue());
00315 BrushAttrValue DefBrush;
00316 if (DefBrush.IsDifferent(pBrush))
00317 return(FALSE);
00318 }
00319 break;
00320
00321 case ATTR_FEATHER:
00322 {
00323 FeatherAttrValue* pFeather = (FeatherAttrValue*)(pAttr->GetAttributeValue());
00324 if (pFeather->GetFeatherSize() != 0)
00325 return(FALSE);
00326 }
00327 break;
00328
00329 default:
00330 break;
00331 }
00332 }
00333 }
00334
00335
00336 return(TRUE);
00337 }
00338
00339
00340
00341 BOOL XPFCComplexClass::DoesNodeMatch(Node* pNode)
00342 {
00343 return(pNode->IsKindOf(m_pClass));
00344 }
00345
00346
00347 BOOL XPFCLayer::DoesNodeMatch(Node* pNode)
00348 {
00349
00350 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00351 return(FALSE);
00352
00353 Layer* pLayer = (Layer*)pNode;
00354
00355
00356 if (m_bVisible != XPFB_UNKNOWN && pLayer->IsVisible() != m_bVisible)
00357 return(FALSE);
00358
00359 if (m_bLocked != XPFB_UNKNOWN && pLayer->IsLocked() != m_bLocked)
00360 return(FALSE);
00361
00362 if (m_bPrintable != XPFB_UNKNOWN && pLayer->IsPrintable() != m_bPrintable)
00363 return(FALSE);
00364
00365 if (m_bActive != XPFB_UNKNOWN && pLayer->IsActive() != m_bActive)
00366 return(FALSE);
00367
00368 if (m_bBackground != XPFB_UNKNOWN && pLayer->IsBackground() != m_bBackground)
00369 return(FALSE);
00370
00371 if (m_bGuide != XPFB_UNKNOWN && pLayer->IsGuide() != m_bGuide)
00372 return(FALSE);
00373
00374 if (m_ContentOnly != XPFP_UNKNOWN)
00375 {
00376
00377
00378
00379
00380
00381 if (!AreAllChildrenText(pNode, (m_ContentOnly == XPFP_CONTENTONLY_PLAINTEXT)))
00382 return(FALSE);
00383 }
00384
00385 return(TRUE);
00386 }
00387
00388
00389
00390 BOOL XPFCShadow::DoesNodeMatch(Node* pNode)
00391 {
00392
00393 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00394 return(FALSE);
00395
00396 NodeShadowController* pCont = (NodeShadowController*)pNode;
00397
00398
00399 if (m_Type != XPFP_UNKNOWN && pCont->GetShadowType() != m_Type)
00400 return(FALSE);
00401
00402 return(TRUE);
00403 }
00404
00405
00406 BOOL XPFCBevel::DoesNodeMatch(Node* pNode)
00407 {
00408
00409 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00410 return(FALSE);
00411
00412 NodeBevelController* pCont = (NodeBevelController*)pNode;
00413
00414
00415 if (m_Type != XPFP_UNKNOWN && pCont->m_BevelType != m_Type)
00416 return(FALSE);
00417
00418 if (m_Side != XPFP_UNKNOWN)
00419 {
00420 XPFProp Side = (pCont->m_bOuter) ? XPFP_BEVELSIDE_OUTER : XPFP_BEVELSIDE_INNER;
00421 if (m_Side != Side)
00422 return(FALSE);
00423 }
00424
00425 return(TRUE);
00426 }
00427
00428
00429 BOOL XPFCBlend::DoesNodeMatch(Node* pNode)
00430 {
00431
00432 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00433 return(FALSE);
00434
00435 NodeBlend* pBlend = (NodeBlend*)pNode;
00436
00437
00438 if (m_Effect != XPFP_UNKNOWN && pBlend->GetColourBlendType() != m_Effect)
00439 return(FALSE);
00440
00441 if (m_bOnCurve != XPFB_UNKNOWN && pBlend->IsOnACurve() != m_bOnCurve)
00442 return(FALSE);
00443
00444 CProfileBiasGain DefaultProfile;
00445
00446 if (m_bObjProfile != XPFB_UNKNOWN)
00447 {
00448 BOOL bBlend = (*(pBlend->GetObjectProfile()) == DefaultProfile);
00449 if (bBlend == m_bObjProfile)
00450 return(FALSE);
00451 }
00452
00453 if (m_bAttrProfile != XPFB_UNKNOWN)
00454 {
00455 BOOL bBlend = (*(pBlend->GetAttrProfile()) == DefaultProfile);
00456 if (bBlend == m_bAttrProfile)
00457 return(FALSE);
00458 }
00459
00460 return(TRUE);
00461 }
00462
00463
00464 BOOL XPFCMould::DoesNodeMatch(Node* pNode)
00465 {
00466
00467 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00468 return(FALSE);
00469
00470 NodeMould* pMould = (NodeMould*)pNode;
00471
00472
00473 if (m_Type != XPFP_UNKNOWN && pMould->DescribeGeometry() != m_Type)
00474 return(FALSE);
00475
00476 if (m_bGradFill != XPFB_UNKNOWN)
00477 {
00478
00479 BOOL bGradFill = HasGraduatedFill(pNode);
00480 TRACEUSER( "Gerry", _T("HasGraduatedFill returned %s\n"), bGradFill ? _T("true") : _T("false"));
00481 if (bGradFill != m_bGradFill)
00482 return(FALSE);
00483 }
00484
00485 return(TRUE);
00486 }
00487
00488
00489
00490
00491
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502 BOOL XPFCMould::HasGraduatedFill(Node* pNode)
00503 {
00504
00505
00506
00507 Node* pChild = pNode->FindFirstChild();
00508 while (pChild)
00509 {
00510 if (HasGraduatedFill(pChild))
00511 return(TRUE);
00512
00513 pChild = pChild->FindNext();
00514 }
00515
00516 if (pNode->IsAnAttribute())
00517 {
00518 NodeAttribute* pAttr = (NodeAttribute*)pNode;
00519
00520
00521
00522 if (pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrFillGeometry) ||
00523 pAttr->GetAttributeType() == CC_RUNTIME_CLASS(AttrTranspFillGeometry))
00524 {
00525 if (!pAttr->IsAFlatFill())
00526 return(TRUE);
00527 }
00528 }
00529
00530
00531 return(FALSE);
00532 }
00533
00534
00535
00536 BOOL XPFCRectangle::DoesNodeMatch(Node* pNode)
00537 {
00538
00539 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00540 return(FALSE);
00541
00542 NodeRegularShape* pShape = (NodeRegularShape*)pNode;
00543
00544 if (!CXaraFileRegularShape::IsRectangle(pShape))
00545 return(FALSE);
00546
00547
00548 if (m_bComplex != XPFB_UNKNOWN && CXaraFileRegularShape::IsSimple(pShape) == m_bComplex)
00549 return(FALSE);
00550
00551 if (m_bRounded != XPFB_UNKNOWN)
00552 {
00553 BOOL bVal = (CXaraFileRegularShape::IsRounded(pShape) != 0);
00554 if (bVal != m_bRounded)
00555 return(FALSE);
00556 }
00557
00558 if (m_bStellated != XPFB_UNKNOWN && CXaraFileRegularShape::IsStellated(pShape) != m_bStellated)
00559 return(FALSE);
00560
00561 if (m_bReformed != XPFB_UNKNOWN && CXaraFileRegularShape::IsReformed(pShape) != m_bReformed)
00562 return(FALSE);
00563
00564 return(TRUE);
00565 }
00566
00567
00568 BOOL XPFCEllipse::DoesNodeMatch(Node* pNode)
00569 {
00570
00571 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00572 return(FALSE);
00573
00574 NodeRegularShape* pShape = (NodeRegularShape*)pNode;
00575
00576 if (!CXaraFileRegularShape::IsEllipse(pShape))
00577 return(FALSE);
00578
00579
00580 if (m_bComplex != XPFB_UNKNOWN && CXaraFileRegularShape::IsSimple(pShape) == m_bComplex)
00581 return(FALSE);
00582
00583 return(TRUE);
00584 }
00585
00586
00587 BOOL XPFCPolygon::DoesNodeMatch(Node* pNode)
00588 {
00589
00590 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00591 return(FALSE);
00592
00593 NodeRegularShape* pShape = (NodeRegularShape*)pNode;
00594
00595 if (CXaraFileRegularShape::IsEllipse(pShape) || CXaraFileRegularShape::IsRectangle(pShape))
00596 return(FALSE);
00597
00598
00599 if (m_bRounded != XPFB_UNKNOWN && CXaraFileRegularShape::IsRounded(pShape) != m_bRounded)
00600 return(FALSE);
00601
00602 if (m_bStellated != XPFB_UNKNOWN && CXaraFileRegularShape::IsStellated(pShape) != m_bStellated)
00603 return(FALSE);
00604
00605 if (m_bReformed != XPFB_UNKNOWN && CXaraFileRegularShape::IsReformed(pShape) != m_bReformed)
00606 return(FALSE);
00607
00608 return(TRUE);
00609 }
00610
00611
00612 BOOL XPFCBitmap::DoesNodeMatch(Node* pNode)
00613 {
00614
00615 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00616 return(FALSE);
00617
00618 NodeBitmap* pBitmap = (NodeBitmap*)pNode;
00619
00620
00621 if (m_bComplex != XPFB_UNKNOWN)
00622 {
00623
00624 return(FALSE);
00625 }
00626
00627 if (m_bContone != XPFB_UNKNOWN)
00628 {
00629 BOOL bContone = (pBitmap->GetStartColour() != NULL) || (pBitmap->GetEndColour() != NULL);
00630 if (m_bContone != bContone)
00631 return(FALSE);
00632 }
00633
00634 return(TRUE);
00635 }
00636
00637
00638 BOOL XPFCText::DoesNodeMatch(Node* pNode)
00639 {
00640
00641 if (!XPFCComplexClass::DoesNodeMatch(pNode))
00642 return(FALSE);
00643
00644 TextStory* pStory = (TextStory*)pNode;
00645
00646
00647 if (m_bOnPath != XPFB_UNKNOWN)
00648 {
00649
00650 BOOL bOnPath = (pStory->GetTextPath() != NULL);
00651 if (bOnPath != m_bOnPath)
00652 return(FALSE);
00653 }
00654
00655 if (m_bComplex != XPFB_UNKNOWN)
00656 {
00657
00658 Matrix mStory = pStory->GetStoryMatrix();
00659 ANGLE Rot = 0;
00660 ANGLE Shear = 0;
00661 mStory.Decompose(NULL, NULL, &Rot, &Shear, NULL, NULL);
00662 BOOL bComplex = !(Rot == 0 && Shear == 0);
00663 if (bComplex != m_bComplex)
00664 return(FALSE);
00665 }
00666
00667 if (m_bPlain != XPFB_UNKNOWN)
00668 {
00669
00670 BOOL bPlain = IsTextStoryPlain(pStory);
00671 TRACEUSER( "Gerry", _T("IsTextStoryPlain returned %s\n"), bPlain ? _T("true") : _T("false"));
00672 if (bPlain != m_bPlain)
00673 return(FALSE);
00674 }
00675
00676 if (m_bAutoKern != XPFB_UNKNOWN)
00677 {
00678
00679 if (pStory->IsAutoKerning() != m_bAutoKern)
00680 return(FALSE);
00681 }
00682
00683 if (m_bJustified != XPFB_UNKNOWN)
00684 {
00685
00686 BOOL bJustified = IsNodeJustified(pNode);
00687 if (bJustified != m_bJustified)
00688 return(FALSE);
00689 }
00690
00691 return(TRUE);
00692 }
00693
00694
00695
00696
00697
00698
00699
00700
00701
00702
00703
00704
00705
00706
00707
00708 BOOL XPFCText::IsNodeJustified(Node* pRootNode)
00709 {
00710
00711
00712
00713 if (!pRootNode->IS_KIND_OF(NodeRenderableInk))
00714 return(FALSE);
00715
00716 NodeRenderableInk* pInkNode = (NodeRenderableInk*)pRootNode;
00717
00718
00719 Node* pNode = pRootNode->FindFirstDepthFirst();
00720 while (pNode)
00721 {
00722
00723 if (pNode->IsAnAttribute() && pNode->IS_KIND_OF(AttrTxtJustification))
00724 {
00725 AttrTxtJustification* pAttr = (AttrTxtJustification*)pNode;
00726 if (pAttr->Value.justification != JLEFT)
00727 return(TRUE);
00728 }
00729
00730
00731 pNode = pNode->FindNextDepthFirst(pRootNode);
00732 }
00733
00734
00735 AttrTxtJustification* pAttr = (AttrTxtJustification*)(pInkNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtJustification), TRUE));
00736 if (pAttr && pAttr->Value.justification != JLEFT)
00737 return(TRUE);
00738
00739
00740 return(FALSE);
00741 }
00742
00743
00744 BOOL XPFCFill::DoAttributesMatch(RenderRegion* pRegion)
00745 {
00746
00747 if (m_Shape != XPFB_UNKNOWN)
00748 {
00749
00750 ColourFillAttribute* pFill = (ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY));
00751 if (m_Shape != pFill->GetGeometryShape())
00752 return(FALSE);
00753 }
00754
00755
00756 if (m_Repeat != XPFB_UNKNOWN)
00757 {
00758
00759 INT32 Shape = ((ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY)))->GetGeometryShape();
00760 if (Shape != FILLSHAPE_FLAT)
00761 {
00762 INT32 Repeat = ((FillMappingAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLMAPPING)))->Repeat;
00763 switch (Repeat)
00764 {
00765 case XPFP_FILLREPEAT_REPEAT:
00766 if (Shape >= FILLSHAPE_FLAT && Shape <= FILLSHAPE_DIAMOND)
00767 Repeat = XPFP_FILLREPEAT_SIMPLE;
00768 break;
00769
00770 case XPFP_FILLREPEAT_REPEATINV:
00771 if (Shape >= FILLSHAPE_FLAT && Shape <= FILLSHAPE_DIAMOND)
00772 Repeat = XPFP_FILLREPEAT_SIMPLE;
00773 break;
00774
00775 case XPFP_FILLREPEAT_REPEATEXTRA:
00776 if (Shape >= FILLSHAPE_BITMAP && Shape <= FILLSHAPE_PLASMA)
00777 Repeat = XPFP_FILLREPEAT_SIMPLE;
00778 break;
00779 }
00780 if (m_Repeat != Repeat)
00781 return(FALSE);
00782 }
00783 }
00784
00785
00786 if (m_bMultistage != XPFB_UNKNOWN)
00787 {
00788
00789 ColourFillAttribute* pFill = (ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY));
00790 BOOL bMulti = (pFill->GetColourRamp() != NULL && pFill->GetColourRamp()->GetCount() > 0);
00791 if (m_bMultistage != bMulti)
00792 return(FALSE);
00793 }
00794
00795
00796 if (m_Effect != XPFB_UNKNOWN)
00797 {
00798 ColourFillAttribute* pFill = ((ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY)));
00799 INT32 Shape = pFill->GetGeometryShape();
00800 if (Shape != FILLSHAPE_FLAT && Shape != FILLSHAPE_3POINT && Shape != FILLSHAPE_4POINT)
00801 {
00802 BOOL bCheckEffect = TRUE;
00803
00804 if (Shape == FILLSHAPE_BITMAP || Shape == FILLSHAPE_CLOUDS || Shape == FILLSHAPE_PLASMA)
00805 {
00806 if (pFill->GetStartColour() == NULL && pFill->GetEndColour() == NULL)
00807 bCheckEffect = FALSE;
00808 }
00809
00810 if (bCheckEffect)
00811 {
00812
00813 EFFECTTYPE Effect = pRegion->GetFillEffect();
00814 if (m_Effect != Effect)
00815 return(FALSE);
00816 }
00817 }
00818 }
00819
00820
00821 if (m_bProfile != XPFB_UNKNOWN)
00822 {
00823
00824 ColourFillAttribute* pFill = (ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY));
00825
00826 CProfileBiasGain DefaultProfile;
00827
00828 BOOL bProfile = !(*(pFill->GetProfilePtr()) == DefaultProfile);
00829 if (m_bProfile != bProfile)
00830 return(FALSE);
00831 }
00832
00833
00834 if (m_bContone != XPFB_UNKNOWN)
00835 {
00836
00837 ColourFillAttribute* pFill = (ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY));
00838 if (pFill->GetGeometryShape() == FILLSHAPE_BITMAP)
00839 {
00840 BOOL bContone = (pFill->GetStartColour() != NULL) || (pFill->GetEndColour() != NULL);
00841 if (m_bContone != bContone)
00842 return(FALSE);
00843 }
00844 }
00845
00846 return(TRUE);
00847 }
00848
00849
00850 BOOL XPFCFillTrans::DoAttributesMatch(RenderRegion* pRegion)
00851 {
00852
00853 if (m_Shape != XPFB_UNKNOWN)
00854 {
00855
00856 TranspFillAttribute* pTrans = (TranspFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLGEOMETRY));
00857 if (m_Shape != pTrans->GetGeometryShape())
00858 return(FALSE);
00859 }
00860
00861
00862 if (m_Type != XPFB_UNKNOWN)
00863 {
00864
00865 TranspFillAttribute* pTrans = (TranspFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLGEOMETRY));
00866
00867 INT32 Type = pTrans->GetTranspType();
00868
00869 if (Type == TT_Mix &&
00870 pTrans->GetGeometryShape() == FILLSHAPE_FLAT &&
00871 *(pTrans->GetStartTransp()) == 0)
00872 {
00873
00874 Type = TT_NoTranspType;
00875 }
00876 if (m_Type != Type)
00877 return(FALSE);
00878 }
00879
00880
00881 if (m_Repeat != XPFB_UNKNOWN)
00882 {
00883
00884 INT32 Repeat = ((TranspFillMappingAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLMAPPING)))->Repeat;
00885 INT32 Shape = ((TranspFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLGEOMETRY)))->GetGeometryShape();
00886 switch (Repeat)
00887 {
00888 case XPFP_FILLREPEAT_REPEAT:
00889 if (Shape >= FILLSHAPE_FLAT && Shape <= FILLSHAPE_DIAMOND)
00890 Repeat = XPFP_FILLREPEAT_SIMPLE;
00891 break;
00892
00893 case XPFP_FILLREPEAT_REPEATINV:
00894 if (Shape >= FILLSHAPE_FLAT && Shape <= FILLSHAPE_DIAMOND)
00895 Repeat = XPFP_FILLREPEAT_SIMPLE;
00896 break;
00897
00898 case XPFP_FILLREPEAT_REPEATEXTRA:
00899 if (Shape >= FILLSHAPE_BITMAP && Shape <= FILLSHAPE_PLASMA)
00900 Repeat = XPFP_FILLREPEAT_SIMPLE;
00901 break;
00902 }
00903 if (m_Repeat != Repeat)
00904 return(FALSE);
00905 }
00906
00907
00908 if (m_bProfile != XPFB_UNKNOWN)
00909 {
00910
00911 TranspFillAttribute* pFill = (TranspFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLGEOMETRY));
00912 CProfileBiasGain DefaultProfile;
00913 BOOL bProfile = !(*(pFill->GetProfilePtr()) == DefaultProfile);
00914 if (m_bProfile != bProfile)
00915 return(FALSE);
00916 }
00917
00918 return(TRUE);
00919 }
00920
00921
00922 BOOL XPFCLine::DoAttributesMatch(RenderRegion* pRegion)
00923 {
00924 StrokeColourAttribute* pStrokeCol = (StrokeColourAttribute*)(pRegion->GetCurrentAttribute(ATTR_STROKECOLOUR));
00925 BOOL bNoStroke = pStrokeCol->Colour.IsTransparent();
00926
00927
00928 if (m_bDash != XPFB_UNKNOWN)
00929 {
00930 DashPatternAttribute NoDash;
00931
00932 DashPatternAttribute* pDash = (DashPatternAttribute*)(pRegion->GetCurrentAttribute(ATTR_DASHPATTERN));
00933 if (bNoStroke)
00934 pDash = &NoDash;
00935
00936
00937
00938 if (m_bDash != NoDash.IsDifferent(pDash))
00939 return(FALSE);
00940 }
00941
00942
00943 if (m_bArrowhead != XPFB_UNKNOWN)
00944 {
00945 StartArrowAttribute DefStart;
00946 EndArrowAttribute DefEnd;
00947
00948
00949 StartArrowAttribute* pStart = (StartArrowAttribute*)(pRegion->GetCurrentAttribute(ATTR_STARTARROW));
00950 if (bNoStroke)
00951 pStart = &DefStart;
00952 EndArrowAttribute* pEnd = (EndArrowAttribute*)(pRegion->GetCurrentAttribute(ATTR_ENDARROW));
00953 if (bNoStroke)
00954 pEnd = &DefEnd;
00955
00956 BOOL bHasStart = DefStart.IsDifferent(pStart);
00957 BOOL bHasEnd = DefEnd.IsDifferent(pEnd);
00958
00959 if (m_bArrowhead != (bHasStart | bHasEnd))
00960 return(FALSE);
00961 }
00962
00963
00964 if (m_Cap != XPFB_UNKNOWN)
00965 {
00966
00967 StartCapAttribute* pCap = (StartCapAttribute*)(pRegion->GetCurrentAttribute(ATTR_STARTCAP));
00968 if (m_Cap != pCap->StartCap)
00969 return(FALSE);
00970 }
00971
00972
00973 if (m_Join != XPFB_UNKNOWN)
00974 {
00975
00976 JoinTypeAttribute* pJoin = (JoinTypeAttribute*)(pRegion->GetCurrentAttribute(ATTR_JOINTYPE));
00977 if (m_Join != pJoin->JoinType)
00978 return(FALSE);
00979 }
00980
00981
00982 if (m_bStroke != XPFB_UNKNOWN)
00983 {
00984 StrokeTypeAttrValue DefStroke;
00985 VariableWidthAttrValue DefVarWidth;
00986
00987
00988 StrokeTypeAttrValue* pStroke = (StrokeTypeAttrValue*)(pRegion->GetCurrentAttribute(ATTR_STROKETYPE));
00989 VariableWidthAttrValue* pVarWidth = (VariableWidthAttrValue*)(pRegion->GetCurrentAttribute(ATTR_VARWIDTH));
00990 if (bNoStroke)
00991 {
00992 pStroke = &DefStroke;
00993 pVarWidth = &DefVarWidth;
00994 }
00995
00996 BOOL bStroke = !(((*pStroke) == DefStroke) && ((*pVarWidth) == DefVarWidth));
00997 if (m_bStroke != bStroke)
00998 return(FALSE);
00999 }
01000
01001
01002 if (m_bBrush != XPFB_UNKNOWN)
01003 {
01004 BrushAttrValue DefBrush;
01005
01006
01007 BrushAttrValue* pBrush = (BrushAttrValue*)(pRegion->GetCurrentAttribute(ATTR_BRUSHTYPE));
01008 if (bNoStroke)
01009 pBrush = &DefBrush;
01010
01011 if (m_bBrush != DefBrush.IsDifferent(pBrush))
01012 return(FALSE);
01013 }
01014
01015 return(TRUE);
01016 }
01017
01018
01019 BOOL XPFCLineTrans::DoAttributesMatch(RenderRegion* pRegion)
01020 {
01021
01022 if (m_Type != XPFB_UNKNOWN)
01023 {
01024 StrokeColourAttribute* pStrokeCol = (StrokeColourAttribute*)(pRegion->GetCurrentAttribute(ATTR_STROKECOLOUR));
01025 BOOL bNoStroke = pStrokeCol->Colour.IsTransparent();
01026
01027
01028 StrokeTranspAttribute* pTrans = (StrokeTranspAttribute*)(pRegion->GetCurrentAttribute(ATTR_STROKETRANSP));
01029
01030 INT32 Type = pTrans->GetTranspType();
01031
01032 if (bNoStroke || (Type == TT_Mix && *(pTrans->GetStartTransp()) == 0))
01033 {
01034
01035 Type = TT_NoTranspType;
01036 }
01037 if (m_Type != Type)
01038 return(FALSE);
01039 }
01040
01041 return(TRUE);
01042 }
01043
01044
01045 BOOL XPFCFeather::DoesNodeMatch(Node* pNode)
01046 {
01047 AttrFeather* pAttr = (AttrFeather*)(pNode->FindFirstChild(CC_RUNTIME_CLASS(AttrFeather)));
01048 if (pAttr && (pAttr->Value.GetFeatherSize() != 0))
01049 return(TRUE);
01050
01051 return(FALSE);
01052 }
01053
01054
01055 BOOL XPFCFeather::DoAttributesMatch(RenderRegion* pRegion)
01056 {
01057
01058 OffscreenAttrValue* pAttr = pRegion->GetCurrentOffscreenAttr();
01059 if (!IS_A(pAttr, FeatherAttrValue))
01060 return(FALSE);
01061
01062 FeatherAttrValue* pFeather = (FeatherAttrValue*)pAttr;
01063 if (pFeather->GetFeatherSize() == 0)
01064 return(FALSE);
01065
01066 return(TRUE);
01067 }
01068
01069
01070 BOOL CapabilityTree::IsRasteriseCommonTrans(UINT32 Type)
01071 {
01072 String_16 TransStr;
01073
01074 if (Type == TT_StainGlass)
01075 TransStr = _T("stained");
01076 else if (Type == TT_Bleach)
01077 TransStr = _T("bleach");
01078 else if (Type == TT_CONTRAST)
01079 TransStr = _T("contrast");
01080 else if (Type == TT_SATURATION)
01081 TransStr = _T("saturation");
01082 else if (Type == TT_LUMINOSITY)
01083 TransStr = _T("luminosity");
01084 else if (Type == TT_HUE)
01085 TransStr = _T("hue");
01086 else
01087 return(FALSE);
01088
01089 if (camStrstr(m_CommonTrans, TransStr) != NULL)
01090 return(TRUE);
01091
01092 return(FALSE);
01093 }
01094
01095
01096
01097
01098
01099
01100
01101
01102
01103 XPFConvertType CapabilityTree::GetConvertTypePass1(Node* pNode, XPFRenderRegion* pRegion)
01104 {
01105 if (pNode->IsAnAttribute())
01106 {
01107 return(XPFCONVTYPE_NATIVE);
01108 }
01109
01110
01111 if (pNode->IsSpread())
01112 return(m_SpreadType);
01113
01114 XPFCapability* pItem = GetObjects();
01115 XPFConvertType Type = GetObjectsType();
01116
01117 while (pItem)
01118 {
01119 XPFConvertType ItemType = pItem->GetConvertTypeForNode(pNode);
01120 if (ItemType != XPFCONVTYPE_UNKNOWN)
01121 Type = ItemType;
01122
01123 pItem = pItem->GetNext();
01124 }
01125
01126 if (Type != XPFCONVTYPE_NATIVE &&
01127 Type != XPFCONVTYPE_REMOVE &&
01128 Type != XPFCONVTYPE_SIMPLE &&
01129 Type != XPFCONVTYPE_BITMAP &&
01130 Type != XPFCONVTYPE_REFORMAT)
01131 Type = XPFCONVTYPE_NATIVE;
01132
01133 return(Type);
01134 }
01135
01136
01137
01138
01139
01140
01141
01142 XPFConvertType CapabilityTree::GetConvertTypePass2(Node* pNode, XPFRenderRegion* pRegion)
01143 {
01144 XPFConvertType Type = GetAttributesType();
01145 XPFCapability* pItem = GetAttributes();
01146 while (pItem)
01147 {
01148 XPFConvertType ItemType = pItem->GetConvertTypeForAttrs(pRegion);
01149 if (ItemType == XPFCONVTYPE_STROKED)
01150 Type = ItemType;
01151
01152 pItem = pItem->GetNext();
01153 }
01154
01155 if (Type != XPFCONVTYPE_NATIVE && Type != XPFCONVTYPE_STROKED)
01156 Type = XPFCONVTYPE_NATIVE;
01157
01158 return(Type);
01159 }
01160
01161
01162
01163
01164
01165
01166 void CapabilityTree::GetConvertTypePass3(Node* pNode, XPFRenderRegion* pRegion, BOOL* pbFill, BOOL* pbTrans, BOOL* pbFillTrans)
01167 {
01168 XPFConvertType FillType = GetAttributesType();
01169 XPFConvertType TransType = FillType;
01170 XPFConvertType BothType = FillType;
01171 XPFCapability* pItem = GetAttributes();
01172 while (pItem)
01173 {
01174 XPFConvertType ItemType = pItem->GetConvertTypeForAttrs(pRegion);
01175 if (ItemType == XPFCONVTYPE_BITMAPFILL)
01176 FillType = ItemType;
01177 if (ItemType == XPFCONVTYPE_BITMAPTRANS)
01178 TransType = ItemType;
01179 if (ItemType == XPFCONVTYPE_BITMAPFILLTRANS)
01180 BothType = ItemType;
01181
01182 pItem = pItem->GetNext();
01183 }
01184
01185 *pbFill = (FillType == XPFCONVTYPE_BITMAPFILL);
01186 *pbTrans = (TransType == XPFCONVTYPE_BITMAPTRANS);
01187 *pbFillTrans = (BothType == XPFCONVTYPE_BITMAPFILLTRANS);
01188 }
01189
01190
01191
01192
01193
01194 XPFConvertType CapabilityTree::GetConvertTypePass4(Node* pNode, XPFRenderRegion* pRegion)
01195 {
01196
01197
01198
01199 if (pNode->IsSpread() || pNode->IsLayer())
01200 return(XPFCONVTYPE_NATIVE);
01201
01202 XPFConvertType Type = GetObjectsType();
01203 XPFCapability* pItem = GetObjects();
01204 while (pItem)
01205 {
01206 XPFConvertType ItemType = pItem->GetConvertTypeForNode(pNode);
01207 if (ItemType == XPFCONVTYPE_BITMAP)
01208 Type = ItemType;
01209
01210 pItem = pItem->GetNext();
01211 }
01212
01213 if (Type != XPFCONVTYPE_NATIVE && Type != XPFCONVTYPE_BITMAP)
01214 Type = XPFCONVTYPE_NATIVE;
01215
01216 return(Type);
01217 }
01218
01219
01220
01221
01222
01223
01224
01225 XPFConvertType CapabilityTree::GetConvertTypePass5(Node* pNode, XPFRenderRegion* pRegion)
01226 {
01227 XPFConvertType Type = GetAttributesType();
01228 XPFCapability* pItem = GetAttributes();
01229 while (pItem)
01230 {
01231 XPFConvertType ItemType = pItem->GetConvertTypeForAttrs(pRegion);
01232 if (ItemType == XPFCONVTYPE_BITMAPSPAN)
01233 Type = ItemType;
01234
01235 pItem = pItem->GetNext();
01236 }
01237
01238 if (Type != XPFCONVTYPE_NATIVE && Type != XPFCONVTYPE_BITMAPSPAN)
01239 Type = XPFCONVTYPE_NATIVE;
01240
01241 return(Type);
01242 }