xpfcaps.cpp

Go to the documentation of this file.
00001 // $Id: xpfcaps.cpp 1366 2006-06-26 11:18:18Z gerry $
00002 /* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
00003 ================================XARAHEADERSTART===========================
00004  
00005                Xara LX, a vector drawing and manipulation program.
00006                     Copyright (C) 1993-2006 Xara Group Ltd.
00007        Copyright on certain contributions may be held in joint with their
00008               respective authors. See AUTHORS file for details.
00009 
00010 LICENSE TO USE AND MODIFY SOFTWARE
00011 ----------------------------------
00012 
00013 This file is part of Xara LX.
00014 
00015 Xara LX is free software; you can redistribute it and/or modify it
00016 under the terms of the GNU General Public License version 2 as published
00017 by the Free Software Foundation.
00018 
00019 Xara LX and its component source files are distributed in the hope
00020 that it will be useful, but WITHOUT ANY WARRANTY; without even the
00021 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00022 See the GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License along
00025 with Xara LX (see the file GPL in the root directory of the
00026 distribution); if not, write to the Free Software Foundation, Inc., 51
00027 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
00028 
00029 
00030 ADDITIONAL RIGHTS
00031 -----------------
00032 
00033 Conditional upon your continuing compliance with the GNU General Public
00034 License described above, Xara Group Ltd grants to you certain additional
00035 rights. 
00036 
00037 The additional rights are to use, modify, and distribute the software
00038 together with the wxWidgets library, the wxXtra library, and the "CDraw"
00039 library and any other such library that any version of Xara LX relased
00040 by Xara Group Ltd requires in order to compile and execute, including
00041 the static linking of that library to XaraLX. In the case of the
00042 "CDraw" library, you may satisfy obligation under the GNU General Public
00043 License to provide source code by providing a binary copy of the library
00044 concerned and a copy of the license accompanying it.
00045 
00046 Nothing in this section restricts any of the rights you have under
00047 the GNU General Public License.
00048 
00049 
00050 SCOPE OF LICENSE
00051 ----------------
00052 
00053 This license applies to this program (XaraLX) and its constituent source
00054 files only, and does not necessarily apply to other Xara products which may
00055 in part share the same code base, and are subject to their own licensing
00056 terms.
00057 
00058 This license does not apply to files in the wxXtra directory, which
00059 are built into a separate library, and are subject to the wxWindows
00060 license contained within that directory in the file "WXXTRA-LICENSE".
00061 
00062 This license does not apply to the binary libraries (if any) within
00063 the "libs" directory, which are subject to a separate license contained
00064 within that directory in the file "LIBS-LICENSE".
00065 
00066 
00067 ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
00068 ----------------------------------------------
00069 
00070 Subject to the terms of the GNU Public License (see above), you are
00071 free to do whatever you like with your modifications. However, you may
00072 (at your option) wish contribute them to Xara's source tree. You can
00073 find details of how to do this at:
00074   http://www.xaraxtreme.org/developers/
00075 
00076 Prior to contributing your modifications, you will need to complete our
00077 contributor agreement. This can be found at:
00078   http://www.xaraxtreme.org/developers/contribute/
00079 
00080 Please note that Xara will not accept modifications which modify any of
00081 the text between the start and end of this header (marked
00082 XARAHEADERSTART and XARAHEADEREND).
00083 
00084 
00085 MARKS
00086 -----
00087 
00088 Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
00089 designs are registered or unregistered trademarks, design-marks, and/or
00090 service marks of Xara Group Ltd. All rights in these marks are reserved.
00091 
00092 
00093       Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
00094                         http://www.xara.com/
00095 
00096 =================================XARAHEADEREND============================
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 // The implements to match the declares in the .h file.
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 // This will get Camelot to display the filename and linenumber of any memory allocations
00141 // that are not released at program exit
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     // Scan through the children asking any that match this node 
00153     // to return the convert type
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     // Scan through the children asking any that match this node 
00175     // to return the convert type
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         // Check this node
00196         if (pNode->IsAnObject())
00197         {
00198             // If it is a group then check its children
00199             if (pNode->IsAGroup() && !AreAllChildrenText(pNode, bPlain))
00200                 return(FALSE);
00201 
00202             // If it is not a text story then return false
00203             if (!IS_A(pNode, TextStory))
00204                 return(FALSE);
00205 
00206             if (bPlain && !IsTextStoryPlain(pNode))
00207                 return(FALSE);
00208         }
00209             
00210         // Move on to the next node
00211         pNode = pNode->FindNext();
00212     }
00213 
00214     return(TRUE);
00215 }
00216 
00217 
00218 /****************************************************************************
00219 
00220 >   BOOL XPFCapability::IsTextStoryPlain(Node* pNode)
00221 
00222     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00223     Created:    17/08/2005
00224 
00225     Returns:    TRUE if the node only contains "plain" text, FALSE if it doesn't
00226     Purpose:    This determines if a text story only contains simple text.
00227                 This is currently defined as flat fill, flat fill trans, 
00228                 constant line width, no dash patterns etc...
00229 
00230 ****************************************************************************/
00231 
00232 BOOL XPFCapability::IsTextStoryPlain(Node* pNode)
00233 {
00234 //  TRACEUSER( "Gerry", _T("IsTextStoryPlain(%s)\n"), pNode->GetRuntimeClass()->m_lpszClassName);
00235 
00236     // If the node has children then we must loop through them testing each
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         // These don't return a sensible value from GetAttributeIndex so 
00251         // we have to check the runtime class
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             // Get the type
00264             UINT32 Type = pTrans->GetTranspType();
00265             // If we are flat, mix and 0% trans
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                     // If the attribute is different to the "no dash" then return FALSE
00288                     // then we do not match
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     // We've got this far so there are no non-plain attributes and we can return TRUE
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     // If we aren't the correct type of node then return
00350     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00351         return(FALSE);
00352 
00353     Layer* pLayer = (Layer*)pNode;
00354 
00355     // Now test the property attributes
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         // Currently we only support text and plaintext
00377         // Loop through subtree checking all objects
00378         // If not a text story then return false
00379         // If doing plaintext then if not plain return false
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     // If we aren't the correct type of node then return
00393     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00394         return(FALSE);
00395 
00396     NodeShadowController* pCont = (NodeShadowController*)pNode;
00397 
00398     // Now test the property attributes
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     // If we aren't the correct type of node then return
00409     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00410         return(FALSE);
00411 
00412     NodeBevelController* pCont = (NodeBevelController*)pNode;
00413 
00414     // Now test the property attributes
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     // If we aren't the correct type of node then return
00432     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00433         return(FALSE);
00434 
00435     NodeBlend* pBlend = (NodeBlend*)pNode;
00436 
00437     // Now test the property attributes
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     // If we aren't the correct type of node then return
00467     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00468         return(FALSE);
00469 
00470     NodeMould* pMould = (NodeMould*)pNode;
00471 
00472     // Now test the property attributes
00473     if (m_Type != XPFP_UNKNOWN && pMould->DescribeGeometry() != m_Type)
00474         return(FALSE);
00475 
00476     if (m_bGradFill != XPFB_UNKNOWN)
00477     {
00478         // Scan story for non-plain attributes
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 >   BOOL XPFCMould::HasGraduatedFill(Node* pNode)
00491 
00492     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00493     Created:    17/08/2005
00494 
00495     Returns:    TRUE if the node contains any fills or transparencies that 
00496                 require perspectivised rendering.
00497     Purpose:    This determines if a mould uses any attributes that will 
00498                 not render correctly if converted to simple shapes
00499 
00500 ****************************************************************************/
00501 
00502 BOOL XPFCMould::HasGraduatedFill(Node* pNode)
00503 {
00504 //  TRACEUSER( "Gerry", _T("HasGraduatedFill(%s)\n"), pNode->GetRuntimeClass()->m_lpszClassName);
00505 
00506     // If the node has children then we must loop through them testing each
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         // These don't return a sensible value from GetAttributeIndex so 
00521         // we have to check the runtime class
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     // We've got this far so there are no perspectivisable fills and we can return FALSE
00531     return(FALSE);
00532 }
00533 
00534 
00535 
00536 BOOL XPFCRectangle::DoesNodeMatch(Node* pNode)
00537 {
00538     // If we aren't the correct type of node then return
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     // Now test the property attributes
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     // If we aren't the correct type of node then return
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     // Now test the property attributes
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     // If we aren't the correct type of node then return
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     // Now test the property attributes
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     // If we aren't the correct type of node then return
00615     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00616         return(FALSE);
00617 
00618     NodeBitmap* pBitmap = (NodeBitmap*)pNode;
00619 
00620     // Now test the property attributes
00621     if (m_bComplex != XPFB_UNKNOWN)
00622     {
00623 //      if (CXaraFileRegularShape::IsSimple(pBitmap) == m_bComplex)
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     // If we aren't the correct type of node then return
00641     if (!XPFCComplexClass::DoesNodeMatch(pNode))
00642         return(FALSE);
00643 
00644     TextStory* pStory = (TextStory*)pNode;
00645 
00646     // Now test the property attributes
00647     if (m_bOnPath != XPFB_UNKNOWN)
00648     {
00649         // Check if the text is on a path
00650         BOOL bOnPath = (pStory->GetTextPath() != NULL);
00651         if (bOnPath != m_bOnPath)
00652             return(FALSE);
00653     }
00654     
00655     if (m_bComplex != XPFB_UNKNOWN)
00656     {
00657         // Check the story matrix for any rotation or shear
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         // Scan story for non-plain attributes
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         // Check if the story is auto-kerned
00679         if (pStory->IsAutoKerning() != m_bAutoKern)
00680             return(FALSE);
00681     }
00682     
00683     if (m_bJustified != XPFB_UNKNOWN)
00684     {
00685         // Check if the story uses non-left justification
00686         BOOL bJustified = IsNodeJustified(pNode);
00687         if (bJustified != m_bJustified)
00688             return(FALSE);
00689     }
00690     
00691     return(TRUE);
00692 }
00693 
00694 
00695 /****************************************************************************
00696 
00697 >   BOOL XPFCText::IsNodeJustified(Node* pNode)
00698 
00699     Author:     Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com>
00700     Created:    25/09/2005
00701 
00702     Returns:    TRUE if the node contains non-"left justified" text, FALSE 
00703                 if it only uses left justify
00704     Purpose:    This determines if a text story uses non-left justification
00705 
00706 ****************************************************************************/
00707 
00708 BOOL XPFCText::IsNodeJustified(Node* pRootNode)
00709 {
00710 //  TRACEUSER( "Gerry", _T("IsNodeJustified(%s)\n"), pRootNode->GetRuntimeClass()->m_lpszClassName);
00711 
00712     // If this isn't a renderable ink node then get out
00713     if (!pRootNode->IS_KIND_OF(NodeRenderableInk))
00714         return(FALSE);
00715 
00716     NodeRenderableInk* pInkNode = (NodeRenderableInk*)pRootNode;
00717 
00718     // We scan through the tree looking for any AttrTxtJustification nodes
00719     Node* pNode = pRootNode->FindFirstDepthFirst();
00720     while (pNode)
00721     {
00722         // Check this node
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         // Move on to the next node
00731         pNode = pNode->FindNextDepthFirst(pRootNode);
00732     }
00733 
00734     // No justification in the story so test the applied justification ignoring children
00735     AttrTxtJustification* pAttr = (AttrTxtJustification*)(pInkNode->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrTxtJustification), TRUE));
00736     if (pAttr && pAttr->Value.justification != JLEFT)
00737         return(TRUE);
00738 
00739     // We've got this far so there are no non-left attributes and we can return FALSE
00740     return(FALSE);
00741 }
00742 
00743 
00744 BOOL XPFCFill::DoAttributesMatch(RenderRegion* pRegion)
00745 {
00746     // If this item specifies the shape property
00747     if (m_Shape != XPFB_UNKNOWN)
00748     {
00749         // Get the fill attribute from the render region
00750         ColourFillAttribute* pFill = (ColourFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_FILLGEOMETRY));
00751         if (m_Shape != pFill->GetGeometryShape())
00752             return(FALSE);
00753     }
00754 
00755     // If this item specifies the repeat property
00756     if (m_Repeat != XPFB_UNKNOWN)
00757     {
00758         // Get the fill repeat attribute from the render region
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     // If this item specifies the multistage property
00786     if (m_bMultistage != XPFB_UNKNOWN)
00787     {
00788         // Get the fill attribute from the render region
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     // If this item specifies the effect property
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             // If it is a bitmap or fractal fill and has no colours then ignore the effect
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                 // Get the fill effect from the render region
00813                 EFFECTTYPE Effect = pRegion->GetFillEffect();
00814                 if (m_Effect != Effect)
00815                     return(FALSE);
00816             }
00817         }
00818     }
00819     
00820     // If this item specifies the profile property
00821     if (m_bProfile != XPFB_UNKNOWN)
00822     {
00823         // Get the fill attribute from the render region
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     // If this item specifies the contone property
00834     if (m_bContone != XPFB_UNKNOWN)
00835     {
00836         // Get the fill attribute from the render region
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     // If this item specifies the shape property
00853     if (m_Shape != XPFB_UNKNOWN)
00854     {
00855         // Get the transp attribute from the render region
00856         TranspFillAttribute* pTrans = (TranspFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLGEOMETRY));
00857         if (m_Shape != pTrans->GetGeometryShape())
00858             return(FALSE);
00859     }
00860 
00861     // If this item specifies the type property
00862     if (m_Type != XPFB_UNKNOWN)
00863     {
00864         // Get the transp attribute from the render region
00865         TranspFillAttribute* pTrans = (TranspFillAttribute*)(pRegion->GetCurrentAttribute(ATTR_TRANSPFILLGEOMETRY));
00866         // Get the type
00867         INT32 Type = pTrans->GetTranspType();
00868         // If we are flat, mix and 0% trans
00869         if (Type == TT_Mix &&
00870             pTrans->GetGeometryShape() == FILLSHAPE_FLAT &&
00871             *(pTrans->GetStartTransp()) == 0)
00872         {
00873             // We are actually type none
00874             Type = TT_NoTranspType;
00875         }
00876         if (m_Type != Type)
00877             return(FALSE);
00878     }
00879 
00880     // If this item specifies the repeat property
00881     if (m_Repeat != XPFB_UNKNOWN)
00882     {
00883         // Get the transp and repeat attributes from the render region
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     // If this item specifies the profile property
00908     if (m_bProfile != XPFB_UNKNOWN)
00909     {
00910         // Get the fill attribute from the render region
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     // If this item specifies the dash property
00928     if (m_bDash != XPFB_UNKNOWN)
00929     {
00930         DashPatternAttribute NoDash;
00931         // Get the dash pattern attribute from the render region
00932         DashPatternAttribute* pDash = (DashPatternAttribute*)(pRegion->GetCurrentAttribute(ATTR_DASHPATTERN));
00933         if (bNoStroke)
00934             pDash = &NoDash;
00935         // If the attribute is the "no dash" and m_bDash is TRUE or
00936         // the attribute is not "no dash" and m_bDash is FALSE
00937         // then we do not match
00938         if (m_bDash != NoDash.IsDifferent(pDash))
00939             return(FALSE);
00940     }
00941     
00942     // If this item specifies the arrowhead property
00943     if (m_bArrowhead != XPFB_UNKNOWN)
00944     {
00945         StartArrowAttribute DefStart;
00946         EndArrowAttribute DefEnd;
00947 
00948         // Get the arrow attributes from the render region
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     // If this item specifies the cap property
00964     if (m_Cap != XPFB_UNKNOWN)
00965     {
00966         // Get the dash pattern attribute from the render region
00967         StartCapAttribute* pCap = (StartCapAttribute*)(pRegion->GetCurrentAttribute(ATTR_STARTCAP));
00968         if (m_Cap != pCap->StartCap)
00969             return(FALSE);
00970     }
00971     
00972     // If this item specifies the join property
00973     if (m_Join != XPFB_UNKNOWN)
00974     {
00975         // Get the dash pattern attribute from the render region
00976         JoinTypeAttribute* pJoin = (JoinTypeAttribute*)(pRegion->GetCurrentAttribute(ATTR_JOINTYPE));
00977         if (m_Join != pJoin->JoinType)
00978             return(FALSE);
00979     }
00980     
00981     // If this item specifies the stroke property
00982     if (m_bStroke != XPFB_UNKNOWN)
00983     {
00984         StrokeTypeAttrValue DefStroke;
00985         VariableWidthAttrValue DefVarWidth;
00986 
00987         // Get the attributes from the render region
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     // If this item specifies the brush property
01002     if (m_bBrush != XPFB_UNKNOWN)
01003     {
01004         BrushAttrValue DefBrush;
01005 
01006         // Get the dash pattern attribute from the render region
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     // If this item specifies the type property
01022     if (m_Type != XPFB_UNKNOWN)
01023     {
01024         StrokeColourAttribute* pStrokeCol = (StrokeColourAttribute*)(pRegion->GetCurrentAttribute(ATTR_STROKECOLOUR));
01025         BOOL bNoStroke = pStrokeCol->Colour.IsTransparent();
01026 
01027         // Get the transp attribute from the render region
01028         StrokeTranspAttribute* pTrans = (StrokeTranspAttribute*)(pRegion->GetCurrentAttribute(ATTR_STROKETRANSP));
01029         // Get the type
01030         INT32 Type = pTrans->GetTranspType();
01031         // If we have no stroke colour or are mix and 0% trans
01032         if (bNoStroke || (Type == TT_Mix && *(pTrans->GetStartTransp()) == 0))
01033         {
01034             // We are actually type none
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     // Get the feather attribute from the render region
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 // Pass 1 can return the following convert types:
01097 // Spread: native, bitmap, simple
01098 // Layer: native, bitmap, simple
01099 // Objects: native, remove, simple
01100 // Attributes: native, remove
01101 // All other types are returned as native for processing in later passes
01102 
01103 XPFConvertType CapabilityTree::GetConvertTypePass1(Node* pNode, XPFRenderRegion* pRegion)
01104 {
01105     if (pNode->IsAnAttribute())
01106     {
01107         return(XPFCONVTYPE_NATIVE);
01108     }
01109 
01110     // First we need to check for spreads and layers, returning the appropriate type
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 // Pass 2 can return the following convert types:
01138 // This pass is mainly concerned with the stroked conversion type
01139 // The current state of attributes in the render region is scanned and if they result 
01140 // in the stroked conversion type then that is returned otherwise native is returned
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 // Pass 3 is concerned with the bitmapfill and bitmaptrans conversion types
01163 // The current state of attributes in the render region is scanned and if they result 
01164 // in the bitmapfill conversion type then that is returned otherwise native is returned
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 // Pass 4 is concerned with the bitmap conversion type
01191 // The object and the current state of attributes in the render region is scanned and if they result 
01192 // in the bitmap conversion type then that is returned otherwise native is returned
01193 
01194 XPFConvertType CapabilityTree::GetConvertTypePass4(Node* pNode, XPFRenderRegion* pRegion)
01195 {
01196     // This pass must NOT convert any spreads or layers to bitmap as that will 
01197     // have been done during the first pass but the spread/layer node will still 
01198     // be present in the tree
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 // Pass 5 is concerned with the bitmapspan conversion type
01222 // The current state of attributes in the render region is scanned and if they result 
01223 // in the bitmapspan conversion type then that is returned otherwise native is returned
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 }

Generated on Sat Nov 10 03:47:24 2007 for Camelot by  doxygen 1.4.4