svgtopt/SVGEngineJI/src/SvgJavaInterfaceImpl.cpp
branchRCL_3
changeset 38 db5c883ad1c5
parent 10 baacd33d915b
child 39 1902ade171ab
equal deleted inserted replaced
22:9be6eed35a80 38:db5c883ad1c5
   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     }
   243 
   271 
   244 /**
   272 /**
   245  *
   273  *
   246  */
   274  */
   247 EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocumentL( 
   275 EXPORT_C void CSvgJavaInterfaceImpl::SvgEngineRenderDocumentL( 
  1325                 }
  1353                 }
  1326             else
  1354             else
  1327                 {
  1355                 {
  1328                 if(lSvgAttrId == KCSS_ATTR_FONTSIZE)
  1356                 if(lSvgAttrId == KCSS_ATTR_FONTSIZE)
  1329                     {
  1357                     {
  1330                     if(lValue != KErrNotFound)
  1358                    // if(lValue != KErrNotFound)
  1331                         {
  1359                     //    {
  1332                         // font is internally considered to be a float.
  1360                         // font is internally considered to be a float.
  1333                         TReal32 lValue = GetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId);
  1361                         TReal32 lValue = GetElementFloatAttribute((CSvgElementImpl*)aElementHandle,lSvgAttrId);
  1334                         return short (lValue) ;
  1362                         return short (lValue) ;
  1335                         }
  1363                     //    }
  1336                     return KInvalidEnumAttribute;
  1364                     //return KInvalidEnumAttribute;
  1337                     }
  1365                     }
  1338                 TInt lResult = GetEnumAttribute((CSvgElementImpl*)aElementHandle, lSvgAttrId , lValue);
  1366                 TInt lResult = GetEnumAttribute((CSvgElementImpl*)aElementHandle, lSvgAttrId , lValue);
  1339                 if(lResult == KErrNotFound)
  1367                 if(lResult == KErrNotFound)
  1340                     {
  1368                     {
  1341                     return KInvalidEnumAttribute;
  1369                     return KInvalidEnumAttribute;
  2651 /**
  2679 /**
  2652 * This maps the Enumeration from SVG to JSR. SVG enumerated value here is string type.
  2680 * This maps the Enumeration from SVG to JSR. SVG enumerated value here is string type.
  2653 */
  2681 */
  2654 TInt CSvgJavaInterfaceImpl::SvgStringtoEnumerationMappingSVGtoJSR(const TInt aAttributeId , TPtrC16 aValue)
  2682 TInt CSvgJavaInterfaceImpl::SvgStringtoEnumerationMappingSVGtoJSR(const TInt aAttributeId , TPtrC16 aValue)
  2655 {
  2683 {
       
  2684     TInt attribVal = KErrNotFound;
       
  2685     
  2656     switch(aAttributeId)
  2686     switch(aAttributeId)
  2657     {
  2687     {
  2658     case KCSS_ATTR_FILLRULE:
  2688     case KCSS_ATTR_FILLRULE:
  2659             {
  2689             {
  2660             if(aValue == _L("evenodd"))
  2690             if(aValue == _L("evenodd"))
  2661             return FILL_RULE_EVENODD;
  2691                 attribVal = FILL_RULE_EVENODD;
  2662             if(aValue == _L("nonzero"))
  2692             else if(aValue == _L("nonzero"))
  2663             return FILL_RULE_NONZERO;
  2693                 attribVal = FILL_RULE_NONZERO;
  2664             }
  2694             }
       
  2695             break;
  2665     case KCSS_ATTR_STROKE_LINECAP:
  2696     case KCSS_ATTR_STROKE_LINECAP:
  2666             {
  2697             {
  2667             if(aValue == _L("butt"))
  2698             if(aValue == _L("butt"))
  2668             return STROKE_LINECAP_BUTT;
  2699                 attribVal = STROKE_LINECAP_BUTT;
  2669             if(aValue == _L("round"))
  2700             else if(aValue == _L("round"))
  2670             return STROKE_LINECAP_ROUND;
  2701                 attribVal = STROKE_LINECAP_ROUND;
  2671             if(aValue == _L("square"))
  2702             else if(aValue == _L("square"))
  2672             return STROKE_LINECAP_SQUARE;
  2703                 attribVal = STROKE_LINECAP_SQUARE;
  2673             }
  2704             }
  2674 
  2705             break;
  2675         case KCSS_ATTR_STROKE_LINEJOIN:
  2706     case KCSS_ATTR_STROKE_LINEJOIN:
  2676 
       
  2677             {
  2707             {
  2678             if(aValue == _L("miter"))
  2708             if(aValue == _L("miter"))
  2679             return STROKE_LINEJOIN_MITER;
  2709                 attribVal = STROKE_LINEJOIN_MITER;
  2680             if(aValue == _L("round"))
  2710             else if(aValue == _L("round"))
  2681             return STROKE_LINEJOIN_ROUND;
  2711                 attribVal = STROKE_LINEJOIN_ROUND;
  2682             if(aValue == _L("bevel"))
  2712             else if(aValue == _L("bevel"))
  2683             return STROKE_LINEJOIN_BEVEL;
  2713                 attribVal = STROKE_LINEJOIN_BEVEL;
  2684             }
  2714             }
  2685         default: return KErrNotFound;
  2715             break;
       
  2716     default: 
       
  2717         attribVal = KErrNotFound;
       
  2718     
  2686     }
  2719     }
       
  2720     return attribVal;
  2687 }
  2721 }
  2688 /**
  2722 /**
  2689 * This maps the Enumeration from SVG to JSR.
  2723 * This maps the Enumeration from SVG to JSR.
  2690 */
  2724 */
  2691 TInt  CSvgJavaInterfaceImpl::SvgEnumerationMappingSVGtoJSR(const TInt aAttributeId, TInt32 aSvgEnumValue)
  2725 TInt  CSvgJavaInterfaceImpl::SvgEnumerationMappingSVGtoJSR(const TInt aAttributeId, TInt32 aSvgEnumValue)