svgtopt/SVGEngineJI/src/SvgJavaInterfaceImpl.cpp
branchRCL_3
changeset 39 1902ade171ab
parent 38 db5c883ad1c5
equal deleted inserted replaced
38:db5c883ad1c5 39:1902ade171ab
   238 	myText.Copy(_L("Andrew's Test Bitmap"));
   238 	myText.Copy(_L("Andrew's Test Bitmap"));
   239 
   239 
   240 	ConvertBitmapToFileL((CFbsBitmap*)aSurfaceHandle, myText);
   240 	ConvertBitmapToFileL((CFbsBitmap*)aSurfaceHandle, myText);
   241 	*/
   241 	*/
   242 }
   242 }
   243 
       
   244 /*
       
   245  * M2G: SvgEngineRenderDocument() overloaded to pass the CSvgtBitmap object to SvgEngine
       
   246  */
       
   247 EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocument( 
       
   248     SvgEngineHandle aEngineHandle, SvgDocumentHandle aDocumentHandle, 
       
   249     SvgtBitmapHandle aSurfaceHandle, SvgtBitmapHandle aSurfaceMaskHandle, 
       
   250     TReal32 aCurrentTime ) 
       
   251     {
       
   252     CSvgEngineInterfaceImpl::iFileIsLoaded = ETrue;
       
   253 
       
   254     SetDocument( (CSvgEngineImpl*)aEngineHandle, (CSvgDocumentImpl*)aDocumentHandle );
       
   255 
       
   256     // GfxContext creation
       
   257     TRAPD(error, SetGdiContextL( (CSvgEngineImpl*)aEngineHandle, (CSvgtBitmap*)aSurfaceHandle ) );
       
   258     if ( error != KErrNone )
       
   259        {
       
   260        // ignore trap error
       
   261        }
       
   262 
       
   263     //this udpates things like Viewport with whatever preserveAspectRatio and widths are set
       
   264     //InitializeEngine((CSvgEngineImpl*)aEngineHandle);
       
   265 
       
   266     if ( ((CSvgtBitmap*)aSurfaceMaskHandle) != NULL)
       
   267     GenerateMask((CSvgtBitmap*)aSurfaceMaskHandle);
       
   268 
       
   269     RenderFrame( (CSvgEngineImpl*)aEngineHandle, (TUint)(aCurrentTime * 1000) );
       
   270     }
       
   271 
   243 
   272 /**
   244 /**
   273  *
   245  *
   274  */
   246  */
   275 EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocumentL( 
   247 EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocumentL( 
  1353                 }
  1325                 }
  1354             else
  1326             else
  1355                 {
  1327                 {
  1356                 if(lSvgAttrId == KCSS_ATTR_FONTSIZE)
  1328                 if(lSvgAttrId == KCSS_ATTR_FONTSIZE)
  1357                     {
  1329                     {
  1358                    // if(lValue != KErrNotFound)
  1330                     if(lValue != KErrNotFound)
  1359                     //    {
  1331                         {
  1360                         // font is internally considered to be a float.
  1332                         // font is internally considered to be a float.
  1361                         TReal32 lValue = GetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId);
  1333                         TReal32 lValue = GetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId);
  1362                         return short (lValue) ;
  1334                         return short (lValue) ;
  1363                     //    }
  1335                         }
  1364                     //return KInvalidEnumAttribute;
  1336                     return KInvalidEnumAttribute;
  1365                     }
  1337                     }
  1366                 TInt lResult = GetEnumAttribute((CSvgElementImpl*)aElementHandle, lSvgAttrId , lValue);
  1338                 TInt lResult = GetEnumAttribute((CSvgElementImpl*)aElementHandle, lSvgAttrId , lValue);
  1367                 if(lResult == KErrNotFound)
  1339                 if(lResult == KErrNotFound)
  1368                     {
  1340                     {
  1369                     return KInvalidEnumAttribute;
  1341                     return KInvalidEnumAttribute;
  2679 /**
  2651 /**
  2680 * This maps the Enumeration from SVG to JSR. SVG enumerated value here is string type.
  2652 * This maps the Enumeration from SVG to JSR. SVG enumerated value here is string type.
  2681 */
  2653 */
  2682 TInt CSvgJavaInterfaceImpl::SvgStringtoEnumerationMappingSVGtoJSR(const TInt aAttributeId , TPtrC16 aValue)
  2654 TInt CSvgJavaInterfaceImpl::SvgStringtoEnumerationMappingSVGtoJSR(const TInt aAttributeId , TPtrC16 aValue)
  2683 {
  2655 {
  2684     TInt attribVal = KErrNotFound;
       
  2685     
       
  2686     switch(aAttributeId)
  2656     switch(aAttributeId)
  2687     {
  2657     {
  2688     case KCSS_ATTR_FILLRULE:
  2658     case KCSS_ATTR_FILLRULE:
  2689             {
  2659             {
  2690             if(aValue == _L("evenodd"))
  2660             if(aValue == _L("evenodd"))
  2691                 attribVal = FILL_RULE_EVENODD;
  2661             return FILL_RULE_EVENODD;
  2692             else if(aValue == _L("nonzero"))
  2662             if(aValue == _L("nonzero"))
  2693                 attribVal = FILL_RULE_NONZERO;
  2663             return FILL_RULE_NONZERO;
  2694             }
  2664             }
  2695             break;
       
  2696     case KCSS_ATTR_STROKE_LINECAP:
  2665     case KCSS_ATTR_STROKE_LINECAP:
  2697             {
  2666             {
  2698             if(aValue == _L("butt"))
  2667             if(aValue == _L("butt"))
  2699                 attribVal = STROKE_LINECAP_BUTT;
  2668             return STROKE_LINECAP_BUTT;
  2700             else if(aValue == _L("round"))
  2669             if(aValue == _L("round"))
  2701                 attribVal = STROKE_LINECAP_ROUND;
  2670             return STROKE_LINECAP_ROUND;
  2702             else if(aValue == _L("square"))
  2671             if(aValue == _L("square"))
  2703                 attribVal = STROKE_LINECAP_SQUARE;
  2672             return STROKE_LINECAP_SQUARE;
  2704             }
  2673             }
  2705             break;
  2674 
  2706     case KCSS_ATTR_STROKE_LINEJOIN:
  2675         case KCSS_ATTR_STROKE_LINEJOIN:
       
  2676 
  2707             {
  2677             {
  2708             if(aValue == _L("miter"))
  2678             if(aValue == _L("miter"))
  2709                 attribVal = STROKE_LINEJOIN_MITER;
  2679             return STROKE_LINEJOIN_MITER;
  2710             else if(aValue == _L("round"))
  2680             if(aValue == _L("round"))
  2711                 attribVal = STROKE_LINEJOIN_ROUND;
  2681             return STROKE_LINEJOIN_ROUND;
  2712             else if(aValue == _L("bevel"))
  2682             if(aValue == _L("bevel"))
  2713                 attribVal = STROKE_LINEJOIN_BEVEL;
  2683             return STROKE_LINEJOIN_BEVEL;
  2714             }
  2684             }
  2715             break;
  2685         default: return KErrNotFound;
  2716     default: 
       
  2717         attribVal = KErrNotFound;
       
  2718     
       
  2719     }
  2686     }
  2720     return attribVal;
       
  2721 }
  2687 }
  2722 /**
  2688 /**
  2723 * This maps the Enumeration from SVG to JSR.
  2689 * This maps the Enumeration from SVG to JSR.
  2724 */
  2690 */
  2725 TInt  CSvgJavaInterfaceImpl::SvgEnumerationMappingSVGtoJSR(const TInt aAttributeId, TInt32 aSvgEnumValue)
  2691 TInt  CSvgJavaInterfaceImpl::SvgEnumerationMappingSVGtoJSR(const TInt aAttributeId, TInt32 aSvgEnumValue)