javauis/m2g_qt/src/jni/M2GSVGElement.cpp
changeset 80 d6dafc5d983f
child 87 1627c337e51e
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
       
     1 /*
       
     2 * Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  JNI methods
       
    15 *
       
    16 */
       
    17 
       
    18 // INCLUDE FILES
       
    19 #include "com_nokia_microedition_m2g_M2GSVGElement.h"
       
    20 #include "MM2GSVGProxy.h"
       
    21 
       
    22 M2G_NS_START
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 
       
    26 // EXTERNAL FUNCTION PROTOTYPES
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // LOCAL CONSTANTS AND MACROS
       
    33 
       
    34 // MODULE DATA STRUCTURES
       
    35 
       
    36 // LOCAL FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 // CLASS DECLARATION
       
    41 
       
    42 // ================================ FUNCTIONS ==================================
       
    43 
       
    44 // -----------------------------------------------------------------------------
       
    45 // Java_com_nokia_microedition_m2g_M2GSVGElement::_appendChild
       
    46 // -----------------------------------------------------------------------------
       
    47 /**
       
    48  * Calls MM2GSVGProxy::AppendChildL method.
       
    49  * @since Series S60 3.0
       
    50  * @param aProxy Proxy instance.
       
    51  * @param aElementHandle Element handle
       
    52  * @param aChildElementHandle Child handle
       
    53  */
       
    54 JNIEXPORT void JNICALL
       
    55 Java_com_nokia_microedition_m2g_M2GSVGElement__1appendChild(
       
    56     JNIEnv* aJni,
       
    57     jclass,
       
    58     jint aSvgProxyHandle,
       
    59     jint aElementHandle,
       
    60     jint aChildElementHandle)
       
    61 {
       
    62     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - begin");
       
    63     TInt err = KM2GNotOk;
       
    64 
       
    65     M2G_DO_LOCK
       
    66     if (aSvgProxyHandle)
       
    67         {
       
    68         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
    69         TRAP(err,   aProxy->AppendChildL(
       
    70             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
    71             STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle)); );
       
    72         }
       
    73     M2G_DO_UNLOCK(aJni)
       
    74     
       
    75     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _appendChild - end");
       
    76     M2GGeneral::CheckErrorCode(aJni, err);
       
    77 }
       
    78 
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // Java_com_nokia_microedition_m2g_M2GSVGElement::_checkRemoveable
       
    82 // -----------------------------------------------------------------------------
       
    83 /**
       
    84  * Calls MM2GSVGProxy::CheckRemoveableL method.
       
    85  * @since Series S60 3.0
       
    86  * @param aProxy Proxy instance.
       
    87  * @param aElementHandle Element handle
       
    88  * @param aRemoveable Result
       
    89  */
       
    90 JNIEXPORT jint JNICALL Java_com_nokia_microedition_m2g_M2GSVGElement__1checkRemoveable(
       
    91     JNIEnv* aJni,
       
    92     jclass,
       
    93     jint aSvgProxyHandle,
       
    94     jint aElementHandle)
       
    95 {
       
    96     TInt removeable = -1;
       
    97     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable - begin");
       
    98     TInt err = KM2GNotOk;
       
    99     
       
   100     
       
   101     M2G_DO_LOCK
       
   102     if (aSvgProxyHandle)
       
   103         {
       
   104         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   105     
       
   106         TRAP(err, aProxy->CheckRemoveableL(aElementHandle, removeable););
       
   107         }
       
   108     M2G_DO_UNLOCK(aJni)
       
   109 
       
   110     M2GGeneral::CheckErrorCode(aJni, err);
       
   111     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _checkRemoveable: %d - end", removeable);
       
   112     return removeable;
       
   113 }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getBBox
       
   117 // -----------------------------------------------------------------------------
       
   118 /**
       
   119  * Calls MM2GSVGProxy::GetBBoxL method.
       
   120  * @since Series S60 3.0
       
   121  * @param aProxy Proxy instance.
       
   122  * @param aElementHandle Element handle
       
   123  * @param aAttributeTypeId Attribute type id
       
   124  * @param aRectData Returns rect components
       
   125  * @param aResult Result "0" ok
       
   126  */
       
   127 JNIEXPORT jint JNICALL
       
   128 Java_com_nokia_microedition_m2g_M2GSVGElement__1getBBox(
       
   129     JNIEnv* aJni,
       
   130     jclass,
       
   131     jint aSvgProxyHandle,
       
   132     jint aElementHandle,
       
   133     jshort aAttributeTypeId,
       
   134     jfloatArray aRectComponents)
       
   135 {
       
   136     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox - begin");
       
   137 
       
   138     TM2GRectData rect;
       
   139     TInt result = 0;
       
   140     TInt err = KM2GNotOk;
       
   141     
       
   142     M2G_DO_LOCK
       
   143     if (aSvgProxyHandle)
       
   144         {
       
   145         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   146 
       
   147         TRAP(err, aProxy->GetBBoxL(
       
   148            STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   149            STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   150            rect, result); );
       
   151         }
       
   152     M2G_DO_UNLOCK(aJni)
       
   153   
       
   154     M2GGeneral::CheckErrorCode(aJni, err);
       
   155 
       
   156     aJni->SetFloatArrayRegion(
       
   157         REINTERPRET_CAST(jfloatArray, aRectComponents),
       
   158         0,
       
   159         rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
       
   160 
       
   161     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getBBox: %d - end", result);
       
   162     return result;
       
   163 }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getColorTrait
       
   167 // -----------------------------------------------------------------------------
       
   168 /**
       
   169  * Calls MM2GSVGProxy::GetColorTraitL method.
       
   170  * @since Series S60 3.0
       
   171  * @param aProxy Proxy instance.
       
   172  * @param aElementHandle Element handle
       
   173  * @param aAttributeTypeId Attribute type id
       
   174  * @param aColors Color elements ( RGB )
       
   175  * @param aTrait Result
       
   176  */
       
   177 JNIEXPORT jint JNICALL
       
   178 Java_com_nokia_microedition_m2g_M2GSVGElement__1getColorTrait(
       
   179     JNIEnv* aJni,
       
   180     jclass,
       
   181     jint aSvgProxyHandle,
       
   182     jint aElementHandle,
       
   183     jshort aAttributeTypeId,
       
   184     jintArray aColorComponents)
       
   185 {
       
   186     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait - begin");
       
   187     TM2GColorData color;
       
   188     TInt result = -1;
       
   189     TInt err = KM2GNotOk;
       
   190     
       
   191     M2G_DO_LOCK
       
   192     if (aSvgProxyHandle)
       
   193         {
       
   194         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   195         TRAP(err, aProxy->GetColorTraitL(
       
   196             aElementHandle,
       
   197             aAttributeTypeId,
       
   198             color,
       
   199             result); );
       
   200         }
       
   201     M2G_DO_UNLOCK(aJni)
       
   202 
       
   203     M2GGeneral::CheckErrorCode(aJni, err);
       
   204     if (color[ 0 ] == -1 && color[ 1 ] == -1 && color[ 2 ] == -1)
       
   205     {
       
   206         result = 0;
       
   207         aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(), &(color[ 0 ]));
       
   208     }
       
   209     else if (result != -1)
       
   210     {
       
   211         result = 1;
       
   212         aJni->SetIntArrayRegion(aColorComponents, 0, color.Count(),  color.Begin());
       
   213     }
       
   214 
       
   215     M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getColorTrait: %d, R=%d, G=%d, B=%d - end", result, color[ 0 ], color[ 1 ], color[ 2 ]);
       
   216     return result;
       
   217 }
       
   218 
       
   219 
       
   220 // -----------------------------------------------------------------------------
       
   221 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getElementTypeId
       
   222 // -----------------------------------------------------------------------------
       
   223 /**
       
   224  * Calls MM2GSVGProxy::GetElementTypeIdL method.
       
   225  * @since Series S60 3.0
       
   226  * @param aProxy Proxy instance.
       
   227  * @param aElementHandle Element handle
       
   228  * @param aId
       
   229  */
       
   230 JNIEXPORT jshort JNICALL
       
   231 Java_com_nokia_microedition_m2g_M2GSVGElement__1getElementTypeId(
       
   232     JNIEnv* aJni,
       
   233     jclass,
       
   234     jint aSvgProxyHandle,
       
   235     jint aElementHandle)
       
   236 {
       
   237     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId - begin");
       
   238     TInt16 id = 0;
       
   239     TInt err = KM2GNotOk;
       
   240     
       
   241     M2G_DO_LOCK
       
   242     if (aSvgProxyHandle)
       
   243         {
       
   244         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   245         TRAP(err,  aProxy->GetElementTypeIdL(aElementHandle, id); );
       
   246         }
       
   247     M2G_DO_UNLOCK(aJni)
       
   248     
       
   249     M2GGeneral::CheckErrorCode(aJni, err);
       
   250     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getElementTypeId: %d - end", id);
       
   251     return id;
       
   252 }
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getEnumTrait
       
   256 // -----------------------------------------------------------------------------
       
   257 /**
       
   258  * Calls MM2GSVGProxy::GetEnumTraitL method.
       
   259  * @since Series S60 3.0
       
   260  * @param aProxy Proxy instance.
       
   261  * @param aElementHandle Element handle
       
   262  * @param aAttributeTypeId Attribute type id
       
   263  * @param aEnumTrait The enumeration value of the specified attribute
       
   264  */
       
   265 JNIEXPORT jshort JNICALL
       
   266 Java_com_nokia_microedition_m2g_M2GSVGElement__1getEnumTrait(
       
   267     JNIEnv* aJni,
       
   268     jclass,
       
   269     jint aSvgProxyHandle,
       
   270     jint aElementHandle,
       
   271     jshort aAttributeTypeId)
       
   272 {
       
   273     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait - begin");
       
   274     TInt16 enumTrait = 0;
       
   275     TInt err = KM2GNotOk;
       
   276     
       
   277     M2G_DO_LOCK
       
   278     if (aSvgProxyHandle)
       
   279         {
       
   280         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   281 
       
   282         TRAP(err, aProxy->GetEnumTraitL(
       
   283             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   284             STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   285             enumTrait); );
       
   286         }
       
   287     M2G_DO_UNLOCK(aJni)
       
   288         
       
   289     M2GGeneral::CheckErrorCode(aJni, err);
       
   290     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getEnumTrait: %d - end", enumTrait);
       
   291     return enumTrait;
       
   292 }
       
   293 // -----------------------------------------------------------------------------
       
   294 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getFirstElementChild
       
   295 // -----------------------------------------------------------------------------
       
   296 /**
       
   297  * Calls MM2GSVGProxy::GetFirstElementChildL method.
       
   298  * @since Series S60 3.0
       
   299  * @param aProxy Proxy instance.
       
   300  * @param aElementHandle Element handle
       
   301  * @param aHandle Element handle to be returned.
       
   302  */
       
   303 JNIEXPORT jint JNICALL
       
   304 Java_com_nokia_microedition_m2g_M2GSVGElement__1getFirstElementChild(
       
   305     JNIEnv* aJni,
       
   306     jclass,
       
   307     jint aSvgProxyHandle,
       
   308     jint aElementHandle)
       
   309 {
       
   310     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild - begin");
       
   311 
       
   312     TInt childHandle = M2G_INVALID_HANDLE;
       
   313     TInt err = KM2GNotOk;
       
   314 
       
   315     M2G_DO_LOCK
       
   316     if (aSvgProxyHandle)
       
   317         {
       
   318         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   319         TRAP(err, aProxy->GetFirstElementChildL(aElementHandle, childHandle); );
       
   320         }
       
   321     M2G_DO_UNLOCK(aJni)
       
   322 
       
   323     M2GGeneral::CheckErrorCode(aJni, err);
       
   324     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFirstElementChild: %d - end", childHandle);
       
   325     return childHandle;
       
   326 }
       
   327 // -----------------------------------------------------------------------------
       
   328 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getFloatTrait
       
   329 // -----------------------------------------------------------------------------
       
   330 /**
       
   331  * Calls MM2GSVGProxy::GetFloatTraitL method.
       
   332  * @since Series S60 3.0
       
   333  * @param aProxy Proxy instance.
       
   334  * @param aElementHandle Element handle
       
   335  * @param aAttributeTypeId Attribute type id
       
   336  * @param aFloatTrait Float attribute to be returned
       
   337  */
       
   338 JNIEXPORT jfloat JNICALL
       
   339 Java_com_nokia_microedition_m2g_M2GSVGElement__1getFloatTrait(
       
   340     JNIEnv* aJni,
       
   341     jclass,
       
   342     jint aSvgProxyHandle,
       
   343     jint aElementHandle,
       
   344     jshort aAttributeTypeId)
       
   345 {
       
   346     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait - begin");
       
   347     TInt err = KM2GNotOk;
       
   348     TReal32 floatTrait = 0;
       
   349     
       
   350     M2G_DO_LOCK
       
   351     if (aSvgProxyHandle)
       
   352         {
       
   353        MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   354 
       
   355        TRAP(err ,aProxy->GetFloatTraitL(
       
   356            STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   357            STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   358            floatTrait););
       
   359         }
       
   360     M2G_DO_UNLOCK(aJni)
       
   361 
       
   362     M2GGeneral::CheckErrorCode(aJni, err);
       
   363     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getFloatTrait: %f - end", floatTrait);
       
   364     return STATIC_CAST(jfloat, floatTrait);
       
   365 }
       
   366 
       
   367 // -----------------------------------------------------------------------------
       
   368 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getMatrixTrait
       
   369 // -----------------------------------------------------------------------------
       
   370 /**
       
   371  * Calls MM2GSVGProxy::GetMatrixTraitL method.
       
   372  * @since Series S60 3.0
       
   373  * @param aProxy Proxy instance.
       
   374  * @param aElementHandle Element handle
       
   375  * @param aAttributeTypeId Attribute type id
       
   376  * @param aResult Result: "0" if ok and "-1" if nok
       
   377  s*/
       
   378 JNIEXPORT jint JNICALL
       
   379 Java_com_nokia_microedition_m2g_M2GSVGElement__1getMatrixTrait(
       
   380     JNIEnv* aJni,
       
   381     jclass,
       
   382     jint aSvgProxyHandle,
       
   383     jint aElementHandle,
       
   384     jshort aAttributeTypeId,
       
   385     jfloatArray aMatrixComponents)
       
   386 {
       
   387     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait - begin");
       
   388     TM2GMatrixData matrix;
       
   389     TInt result = -1;
       
   390     TInt err = KM2GNotOk;
       
   391     
       
   392     M2G_DO_LOCK
       
   393     if (aSvgProxyHandle)
       
   394         {
       
   395         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   396 
       
   397         TRAP(err, aProxy->GetMatrixTraitL(
       
   398             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   399             STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   400              matrix, result); );
       
   401         }
       
   402     M2G_DO_UNLOCK(aJni)
       
   403 
       
   404     if (M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk)
       
   405     {
       
   406         // Init matrix object
       
   407         jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents, 0);
       
   408         TInt count =
       
   409             M2GGeneral::Min(aJni->GetArrayLength(aMatrixComponents), matrix.Count());
       
   410         for (TInt index = 0; index < count; index++)
       
   411         {
       
   412             components[ index ] = matrix[ index ];
       
   413         }
       
   414         // Release data source
       
   415         aJni->ReleaseFloatArrayElements(aMatrixComponents, components, 0);
       
   416     }
       
   417 
       
   418     M2G_DEBUG_6("M2G_DEBUG: JNI ( M2GSVGElement ) _getMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
       
   419     return result;
       
   420 }
       
   421 
       
   422 // -----------------------------------------------------------------------------
       
   423 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getNextElementSibling
       
   424 // -----------------------------------------------------------------------------
       
   425 /**
       
   426  * Calls MM2GSVGProxy::GetNextElementSiblingL method.
       
   427  * @since Series S60 3.0
       
   428  * @param aProxy Proxy instance.
       
   429  * @param aElementHandle Element pointer.
       
   430  * @param aSiblingHandle Sibling handle
       
   431  */
       
   432 JNIEXPORT jint JNICALL
       
   433 Java_com_nokia_microedition_m2g_M2GSVGElement__1getNextElementSibling(
       
   434     JNIEnv* aJni,
       
   435     jclass,
       
   436     jint aSvgProxyHandle,
       
   437     jint aElementHandle)
       
   438 {
       
   439     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling - begin");
       
   440     TInt siblingHandle = M2G_INVALID_HANDLE;
       
   441     TInt err = KM2GNotOk;
       
   442     
       
   443     M2G_DO_LOCK
       
   444     if (aSvgProxyHandle)
       
   445         {
       
   446            MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   447            TRAP(err, aProxy->GetNextElementSiblingL(aElementHandle, siblingHandle); );
       
   448         }
       
   449     M2G_DO_UNLOCK(aJni)
       
   450    
       
   451     M2GGeneral::CheckErrorCode(aJni, err);
       
   452     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getNextElementSibling: %d - end", siblingHandle);
       
   453     return siblingHandle;
       
   454 }
       
   455 // -----------------------------------------------------------------------------
       
   456 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getParent
       
   457 // -----------------------------------------------------------------------------
       
   458 /**
       
   459  * Calls MM2GSVGProxy::GetParentL method.
       
   460  * @since Series S60 3.0
       
   461  * @param aProxy Proxy instance.
       
   462  * @param aElementHandle Element pointer.
       
   463  * @param aParentHandle Parent handle to be returned.
       
   464  */
       
   465 JNIEXPORT jint JNICALL
       
   466 Java_com_nokia_microedition_m2g_M2GSVGElement__1getParent(
       
   467     JNIEnv* aJni,
       
   468     jclass,
       
   469     jint aSvgProxyHandle,
       
   470     jint aElementHandle)
       
   471 {
       
   472     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent - begin");
       
   473     TInt parentHandle = M2G_INVALID_HANDLE;
       
   474     TInt err = KM2GNotOk;
       
   475     
       
   476     M2G_DO_LOCK
       
   477     
       
   478     if (aSvgProxyHandle)
       
   479         {
       
   480         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   481         TRAP(err,    aProxy->GetParentL(aElementHandle, parentHandle););
       
   482         }
       
   483     M2G_DO_UNLOCK(aJni)
       
   484 
       
   485     M2GGeneral::CheckErrorCode(aJni, err);
       
   486     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getParent: %d - end", parentHandle);
       
   487     return parentHandle;
       
   488 }
       
   489 
       
   490 // -----------------------------------------------------------------------------
       
   491 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getPathTrait
       
   492 // -----------------------------------------------------------------------------
       
   493 /**
       
   494  * Calls MM2GSVGProxy::GetPathTraitL method.
       
   495  * @since Series S60 3.0
       
   496  * @param aProxy Proxy instance.
       
   497  * @param aElementHandle Element pointer.
       
   498  * @param aAttributeTypeId Attribute type.
       
   499  */
       
   500 JNIEXPORT jint JNICALL
       
   501 Java_com_nokia_microedition_m2g_M2GSVGElement__1getPathTrait(
       
   502     JNIEnv* aJni,
       
   503     jclass,
       
   504     jint aSvgProxyHandle,
       
   505     jint aElementHandle,
       
   506     jshort aAttributeTypeId)
       
   507 {
       
   508     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait - begin");
       
   509     TInt aPathTrait = 0;
       
   510     TInt err = KM2GNotOk;
       
   511     
       
   512     M2G_DO_LOCK
       
   513     if (aSvgProxyHandle)
       
   514         {
       
   515         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   516 
       
   517         TRAP(err, aProxy->GetPathTraitL(
       
   518            STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   519            STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   520            aPathTrait); );
       
   521         }
       
   522     M2G_DO_UNLOCK(aJni)
       
   523  
       
   524     M2GGeneral::CheckErrorCode(aJni, err);
       
   525     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getPathTrait: %d - end", aPathTrait);
       
   526     return aPathTrait;
       
   527 }
       
   528 
       
   529 // -----------------------------------------------------------------------------
       
   530 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getRectTrait
       
   531 // -----------------------------------------------------------------------------
       
   532 /**
       
   533  * Calls MM2GSVGProxy::GetRectTraitL method.
       
   534  * @since Series S60 3.0
       
   535  * @param aProxy Proxy instance.
       
   536  * @param aElementHandle Element handle
       
   537  * @param aAttributeTypeId Attribute type id
       
   538  * @param aRectData Returns rect components
       
   539  * @param aResult Result "0" if ok and "-1" if nok
       
   540  */
       
   541 JNIEXPORT jint JNICALL
       
   542 Java_com_nokia_microedition_m2g_M2GSVGElement__1getRectTrait(
       
   543     JNIEnv* aJni,
       
   544     jclass,
       
   545     jint aSvgProxyHandle,
       
   546     jint aElementHandle,
       
   547     jshort aAttributeTypeId,
       
   548     jfloatArray aRectComponents)
       
   549 {
       
   550     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - begin");
       
   551     TM2GRectData rect;
       
   552     TInt result = 0;
       
   553     TInt err = KM2GNotOk;
       
   554     
       
   555     M2G_DO_LOCK
       
   556     if (aSvgProxyHandle)
       
   557         {
       
   558         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   559 
       
   560         TRAP(err , aProxy->GetRectTraitL(
       
   561             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   562             STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   563             rect, result); );
       
   564         }
       
   565     M2G_DO_UNLOCK(aJni)
       
   566     
       
   567     M2GGeneral::CheckErrorCode(aJni, err);
       
   568     aJni->SetFloatArrayRegion(
       
   569         REINTERPRET_CAST(jfloatArray, aRectComponents),
       
   570         0,
       
   571         rect.Count(), REINTERPRET_CAST(jfloat*, rect.Begin()));
       
   572 
       
   573     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait: %d - end", result);
       
   574     return result;
       
   575 }
       
   576 // -----------------------------------------------------------------------------
       
   577 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getRootElement
       
   578 // -----------------------------------------------------------------------------
       
   579 /**
       
   580  * Calls MM2GSVGProxy::GetRootElementL method.
       
   581  * @since Series S60 3.0
       
   582  * @param aProxy Proxy instance.
       
   583  * @param aDocumentHandle Document pointer.
       
   584  * @param aRootElementHandle Root element handle
       
   585  */
       
   586 JNIEXPORT jint JNICALL
       
   587 Java_com_nokia_microedition_m2g_M2GSVGElement__1getRootElement(
       
   588     JNIEnv* aJni,
       
   589     jclass,
       
   590     jint aSvgProxyHandle,
       
   591     jint aDocumentHandle)
       
   592 {
       
   593     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement - begin");
       
   594     TInt rootElementHandle = M2G_INVALID_HANDLE;
       
   595     TInt err = KM2GNotOk;
       
   596     M2G_DO_LOCK
       
   597     if (aSvgProxyHandle)
       
   598         {
       
   599         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   600 
       
   601         TRAP(err, aProxy->GetRootElementL(
       
   602            STATIC_CAST(TM2GSvgDocumentHandle, aDocumentHandle),
       
   603            rootElementHandle); );
       
   604         }
       
   605     M2G_DO_UNLOCK(aJni)
       
   606  
       
   607     M2GGeneral::CheckErrorCode(aJni, err);
       
   608 
       
   609     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getRootElement: %d - end", rootElementHandle);
       
   610     return rootElementHandle;
       
   611 }
       
   612 
       
   613 // -----------------------------------------------------------------------------
       
   614 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getScreenBBox
       
   615 // -----------------------------------------------------------------------------
       
   616 /**
       
   617  * Calls MM2GSVGProxy::GetScreenBBoxL method.
       
   618  * @since Series S60 3.0
       
   619  * @param aProxy Proxy instance.
       
   620  * @param aElementHandle Element handle
       
   621  * @param aRectData Returns rect components
       
   622  */
       
   623 JNIEXPORT void JNICALL
       
   624 Java_com_nokia_microedition_m2g_M2GSVGElement__1getScreenBBox(
       
   625     JNIEnv* aJni,
       
   626     jclass,
       
   627     jint aSvgProxyHandle,
       
   628     jint aElementHandle,
       
   629     jfloatArray aScreenBBoxComponents)
       
   630 {
       
   631     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox - begin");
       
   632     TM2GScreenBBoxData screenBBox;
       
   633     TInt err = KM2GNotOk;
       
   634     
       
   635     M2G_DO_LOCK
       
   636     if (aSvgProxyHandle)
       
   637         {
       
   638         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   639 
       
   640         TRAP(err, aProxy->GetScreenBBoxL(
       
   641             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   642             screenBBox); );
       
   643         }
       
   644     M2G_DO_UNLOCK(aJni)
       
   645  
       
   646     M2GGeneral::CheckErrorCode(aJni, err);
       
   647 
       
   648     aJni->SetFloatArrayRegion(
       
   649         REINTERPRET_CAST(jfloatArray, aScreenBBoxComponents),
       
   650         0,
       
   651         screenBBox.Count(), REINTERPRET_CAST(jfloat*, screenBBox.Begin()));
       
   652 
       
   653     M2G_DEBUG_4("M2G_DEBUG: JNI ( M2GSVGElement ) _getScreenBBox: %f, %f, %f, %f - end", screenBBox[ 0 ], screenBBox[ 1 ], screenBBox[ 2 ], screenBBox[ 3 ]);
       
   654 }
       
   655 
       
   656 // -----------------------------------------------------------------------------
       
   657 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getStringTrait
       
   658 // -----------------------------------------------------------------------------
       
   659 /**
       
   660  * Calls MM2GSVGProxy::GetStringTraitL method.
       
   661  * @since Series S60 3.0
       
   662  * @param aProxy Proxy instance.
       
   663  * @param aElementHandle Element pointer.
       
   664  * @param aAttributeTypeId Attribute type.
       
   665  * @param aAttribute Returns a string attribute
       
   666  */
       
   667 JNIEXPORT jstring JNICALL
       
   668 Java_com_nokia_microedition_m2g_M2GSVGElement__1getStringTrait(
       
   669     JNIEnv* aJni,
       
   670     jclass,
       
   671     jint aSvgProxyHandle,
       
   672     jint aElementHandle,
       
   673     jshort aAttributeTypeId)
       
   674 {
       
   675     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait - begin");
       
   676 
       
   677     TPtrC16 attribute;
       
   678     TInt err = KM2GNotOk;
       
   679     
       
   680     M2G_DO_LOCK
       
   681     if (aSvgProxyHandle)
       
   682         {
       
   683         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   684 
       
   685         TRAP(err, aProxy->GetStringTraitL(
       
   686            STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   687            STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   688            attribute); );
       
   689         }
       
   690     M2G_DO_UNLOCK(aJni)
       
   691    
       
   692     if ((M2GGeneral::CheckErrorCode(aJni, err) == KM2GOk) &&
       
   693             (attribute.Length() > 0))
       
   694     {
       
   695         return CreateJavaString(*aJni, attribute);
       
   696     }
       
   697 
       
   698     return NULL;
       
   699     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getStringTrait: %d - end", err);
       
   700 }
       
   701 // -----------------------------------------------------------------------------
       
   702 // Java_com_nokia_microedition_m2g_M2GSVGElement::_getUsedFromElement
       
   703 // -----------------------------------------------------------------------------
       
   704 /**
       
   705  * Calls MM2GSVGProxy::GetUsedFromElementL method.
       
   706  * @since Series S60 3.0
       
   707  * @param aProxy Proxy instance.
       
   708  * @param aElementHandle Element pointer.
       
   709  * @param aHandle Return element handle
       
   710  */
       
   711 JNIEXPORT jint JNICALL
       
   712 Java_com_nokia_microedition_m2g_M2GSVGElement__1getUsedFromElement(
       
   713     JNIEnv* aJni,
       
   714     jclass,
       
   715     jint aSvgProxyHandle,
       
   716     jint aElementHandle)
       
   717 {
       
   718     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement - begin");
       
   719     TInt handle = M2G_INVALID_HANDLE;
       
   720     TInt err = KM2GNotOk;
       
   721     
       
   722     M2G_DO_LOCK
       
   723     if (aSvgProxyHandle)
       
   724         {
       
   725         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   726 
       
   727         TRAP(err, aProxy->GetUsedFromElementL(
       
   728         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   729         handle); );
       
   730         }
       
   731     M2G_DO_UNLOCK(aJni)
       
   732  
       
   733     M2GGeneral::CheckErrorCode(aJni, err);
       
   734     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _getUsedFromElement: %d - end", handle);
       
   735     return handle;
       
   736 }
       
   737 
       
   738 
       
   739 // -----------------------------------------------------------------------------
       
   740 // Java_com_nokia_microedition_m2g_M2GSVGElement::_insertBefore
       
   741 // -----------------------------------------------------------------------------
       
   742 /**
       
   743  * Class: com_nokia_microedition_m2g_M2GSVGElement
       
   744  * Method: insertBefore
       
   745  * Signature:
       
   746  */
       
   747 JNIEXPORT void JNICALL
       
   748 Java_com_nokia_microedition_m2g_M2GSVGElement__1insertBefore(
       
   749     JNIEnv* aJni,
       
   750     jclass,
       
   751     jint aSvgProxyHandle,
       
   752     jint aElementHandle,
       
   753     jint aNewChildElementHandle,
       
   754     jint aReferenceElementHandle)
       
   755 {
       
   756     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - begin");
       
   757     TInt err = KM2GNotOk;
       
   758     
       
   759     M2G_DO_LOCK
       
   760     
       
   761     if (aSvgProxyHandle)
       
   762         {
       
   763         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   764     
       
   765         TRAP(err, aProxy->InsertBeforeL(
       
   766           STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   767           STATIC_CAST(TM2GSvgElementHandle, aNewChildElementHandle),
       
   768           STATIC_CAST(TM2GSvgElementHandle, aReferenceElementHandle)); );
       
   769         }
       
   770     M2G_DO_UNLOCK(aJni)
       
   771 
       
   772     M2GGeneral::CheckErrorCode(aJni, err);
       
   773     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _insertBefore - end");
       
   774 }
       
   775 // -----------------------------------------------------------------------------
       
   776 // Java_com_nokia_microedition_m2g_M2GSVGElement::_isUsed
       
   777 // -----------------------------------------------------------------------------
       
   778 /**
       
   779  * Calls MM2GSVGProxy::IsUsedL method.
       
   780  * @since Series S60 3.0
       
   781  * @param aProxy Proxy instance.
       
   782  * @param aElementHandle Element pointer.
       
   783  * @param aResult Return "1" if used otherwise returns "0"
       
   784  */
       
   785 JNIEXPORT jint JNICALL
       
   786 Java_com_nokia_microedition_m2g_M2GSVGElement__1isUsed(
       
   787     JNIEnv* aJni,
       
   788     jclass,
       
   789     jint aSvgProxyHandle,
       
   790     jint aElementHandle )
       
   791 {
       
   792     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed - begin");
       
   793     TInt result = KM2GNotOk;
       
   794     TInt err = KM2GNotOk;
       
   795     
       
   796     M2G_DO_LOCK
       
   797     if (aSvgProxyHandle)
       
   798         {
       
   799         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   800         TRAP(err, aProxy->IsUsedL(STATIC_CAST(TM2GSvgElementHandle, aElementHandle), result); );
       
   801         }
       
   802     M2G_DO_UNLOCK(aJni)
       
   803 
       
   804     
       
   805     M2GGeneral::CheckErrorCode(aJni, err);
       
   806     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _isUsed: %d - end", result);
       
   807     return result;
       
   808 }
       
   809 
       
   810 // -----------------------------------------------------------------------------
       
   811 // Java_com_nokia_microedition_m2g_M2GSVGElement::_removeChild
       
   812 // -----------------------------------------------------------------------------
       
   813 /**
       
   814  * Calls MM2GSVGProxy::RemoveChild method.
       
   815  * @since Series S60 3.0
       
   816  * @param aProxy Proxy instance.
       
   817  * @param aElementHandle Element pointer.
       
   818  * @param aChildElementHandle child element pointer
       
   819  * @param aHandle Handle to removed element.
       
   820  */
       
   821 JNIEXPORT jint JNICALL
       
   822 Java_com_nokia_microedition_m2g_M2GSVGElement__1removeChild(
       
   823     JNIEnv* aJni,
       
   824     jclass,
       
   825     jint aSvgProxyHandle,
       
   826     jint aElementHandle,
       
   827     jint aChildElementHandle)
       
   828 {
       
   829     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild - begin");
       
   830     TInt handle = M2G_INVALID_HANDLE;
       
   831     TInt err = KM2GNotOk;
       
   832 
       
   833     M2G_DO_LOCK
       
   834     if (aSvgProxyHandle)
       
   835         {
       
   836         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   837 
       
   838          TRAP(err ,aProxy->RemoveChildL(
       
   839            STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   840            STATIC_CAST(TM2GSvgElementHandle, aChildElementHandle), handle); );
       
   841         }
       
   842     M2G_DO_UNLOCK(aJni)
       
   843   
       
   844     M2GGeneral::CheckErrorCode(aJni, err);
       
   845 
       
   846     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _removeChild: %d - end", handle);
       
   847     return handle;
       
   848 }
       
   849 
       
   850 // -----------------------------------------------------------------------------
       
   851 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setColorTrait
       
   852 // -----------------------------------------------------------------------------
       
   853 /**
       
   854  * Calls MM2GSVGProxy::SetColorTraitL method.
       
   855  * @since Series S60 3.0
       
   856  * @param aProxy Proxy instance.
       
   857  * @param aElementHandle Element pointer.
       
   858  * @param aAttributeTypeId -
       
   859  * @param aColorData -
       
   860  */
       
   861 JNIEXPORT void JNICALL
       
   862 Java_com_nokia_microedition_m2g_M2GSVGElement__1setColorTrait(
       
   863     JNIEnv* aJni,
       
   864     jclass,
       
   865     jint aSvgProxyHandle,
       
   866     jint aElementHandle,
       
   867     jshort aAttributeTypeId,
       
   868     jint aRed, jint aGreen, jint aBlue)
       
   869 {
       
   870     M2G_DEBUG_3("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: R=%d, G=%d, B=%d - begin", aRed, aGreen, aBlue);
       
   871     TM2GColorData color;
       
   872     color[ 0 ] = aRed;
       
   873     color[ 1 ] = aGreen;
       
   874     color[ 2 ] = aBlue;
       
   875     TInt err = KM2GNotOk;
       
   876 
       
   877     M2G_DO_LOCK
       
   878     if (aSvgProxyHandle)
       
   879         {
       
   880            MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   881 
       
   882            TRAP(err, aProxy->SetColorTraitL(
       
   883             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   884             STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   885             color); );
       
   886         }
       
   887     M2G_DO_UNLOCK(aJni)
       
   888  
       
   889     M2GGeneral::CheckErrorCode(aJni, err);
       
   890     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setColorTrait: %d - end", err);
       
   891 }
       
   892 
       
   893 // -----------------------------------------------------------------------------
       
   894 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setEnumTrait
       
   895 // -----------------------------------------------------------------------------
       
   896 /**
       
   897  * Calls MM2GSVGProxy::SetEnumTraitL method.
       
   898  * @since Series S60 3.0
       
   899  * @param aProxy Proxy instance.
       
   900  * @param aElementHandle Element pointer.
       
   901  * @param aAttributeTypeId -
       
   902  * @param aValue 
       
   903  */
       
   904 JNIEXPORT void JNICALL
       
   905 Java_com_nokia_microedition_m2g_M2GSVGElement__1setEnumTrait(
       
   906     JNIEnv* aJni,
       
   907     jclass,
       
   908     jint aSvgProxyHandle,
       
   909     jint aElementHandle,
       
   910     jshort aAttributeTypeId,
       
   911     jshort aValue)
       
   912 {
       
   913     M2G_DEBUG_2("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait: type=%d, value=%d - begin", aAttributeTypeId, aValue);
       
   914     TInt err = KM2GNotOk;
       
   915     
       
   916     M2G_DO_LOCK
       
   917     if (aSvgProxyHandle)
       
   918         {
       
   919         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   920     
       
   921         TRAP(err, aProxy->SetEnumTraitL(
       
   922         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   923         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   924         aValue); );
       
   925         }
       
   926     M2G_DO_UNLOCK(aJni)
       
   927 
       
   928     M2GGeneral::CheckErrorCode(aJni, err);
       
   929     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setEnumTrait - end");
       
   930 }
       
   931 // -----------------------------------------------------------------------------
       
   932 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setFloatTrait
       
   933 // -----------------------------------------------------------------------------
       
   934 /**
       
   935  * Calls MM2GSVGProxy::SetFloatTraitL method.
       
   936  * @since Series S60 3.0
       
   937  * @param aProxy Proxy instance.
       
   938  * @param aElementHandle Element pointer.
       
   939  * @param aAttributeTypeId -
       
   940  * @param aValue -
       
   941  */
       
   942 JNIEXPORT void JNICALL
       
   943 Java_com_nokia_microedition_m2g_M2GSVGElement__1setFloatTrait(
       
   944     JNIEnv* aJni,
       
   945     jclass,
       
   946     jint aSvgProxyHandle,
       
   947     jint aElementHandle,
       
   948     jshort aAttributeTypeId,
       
   949     jfloat aValue)
       
   950 {
       
   951     M2G_DEBUG_1("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: %f - begin", aValue);
       
   952     TInt err = KM2GNotOk;
       
   953     
       
   954     M2G_DO_LOCK
       
   955     if (aSvgProxyHandle)
       
   956         {
       
   957         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
   958 
       
   959         TRAP(err, aProxy->SetFloatTraitL(
       
   960         STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
   961         STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
   962         aValue); );
       
   963         }
       
   964     M2G_DO_UNLOCK(aJni)
       
   965 
       
   966     M2GGeneral::CheckErrorCode(aJni, err);
       
   967     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setFloatTrait: - end");
       
   968 }
       
   969 
       
   970 // -----------------------------------------------------------------------------
       
   971 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setMatrixTrait
       
   972 // -----------------------------------------------------------------------------
       
   973 /**
       
   974  * Calls MM2GSVGProxy::SetMatrixTraitL method.
       
   975  * @since Series S60 3.0
       
   976  * @param aProxy Proxy instance.
       
   977  * @param aElementHandle Element handle
       
   978  * @param aAttributeTypeId Attribute type id
       
   979  * @param aMatrixData -
       
   980  */
       
   981 JNIEXPORT void JNICALL
       
   982 Java_com_nokia_microedition_m2g_M2GSVGElement__1setMatrixTrait(
       
   983     JNIEnv* aJni,
       
   984     jclass,
       
   985     jint aSvgProxyHandle,
       
   986     jint aElementHandle,
       
   987     jshort aAttributeTypeId,
       
   988     jfloatArray aMatrixComponents)
       
   989 {
       
   990     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setMatrixTrait - begin");
       
   991     TInt err = KM2GNotOk;
       
   992     TM2GMatrixData matrix;
       
   993     // Init matrix object
       
   994     jfloat* components = aJni->GetFloatArrayElements(aMatrixComponents,0);
       
   995     TInt count = aJni->GetArrayLength(aMatrixComponents);
       
   996     for (TInt index = 0; index < count; index++)
       
   997     {
       
   998         matrix[ index ] = components[ index ];
       
   999     }
       
  1000     // Release data source
       
  1001     aJni->ReleaseFloatArrayElements(aMatrixComponents, components, JNI_ABORT);
       
  1002     
       
  1003     M2G_DO_LOCK
       
  1004     if (aSvgProxyHandle)
       
  1005         {
       
  1006         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1007 
       
  1008         TRAP(err, aProxy->SetMatrixTraitL(
       
  1009             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1010             STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1011             matrix); );
       
  1012         }
       
  1013     M2G_DO_UNLOCK(aJni)
       
  1014    
       
  1015     M2GGeneral::CheckErrorCode(aJni, err);
       
  1016     M2G_DEBUG_6("JNI ( M2GSVGElement ) _setMatrixTrait: %f, %f, %f, %f, %f, %f - end", matrix[ 0 ], matrix[ 1 ], matrix[ 2 ], matrix[ 3 ], matrix[ 4 ], matrix[ 5 ]);
       
  1017 }
       
  1018 // -----------------------------------------------------------------------------
       
  1019 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setPathTrait
       
  1020 // -----------------------------------------------------------------------------
       
  1021 /**
       
  1022  * Calls MM2GSVGProxy::SetPathTraitL method.
       
  1023  * @since Series S60 3.0
       
  1024  * @param aProxy Proxy instance.
       
  1025  * @param aElementHandle Element handle
       
  1026  * @param aAttributeTypeId Attribute type id
       
  1027  * @param aMatrixData -
       
  1028  */
       
  1029 JNIEXPORT void JNICALL
       
  1030 Java_com_nokia_microedition_m2g_M2GSVGElement__1setPathTrait(
       
  1031     JNIEnv* aJni,
       
  1032     jclass,
       
  1033     jint aSvgProxyHandle,
       
  1034     jint aElementHandle,
       
  1035     jshort aAttributeTypeId,
       
  1036     jint aPathHandle)
       
  1037 {
       
  1038     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - begin");
       
  1039     TInt err = KM2GNotOk;
       
  1040     
       
  1041     M2G_DO_LOCK
       
  1042     if (aSvgProxyHandle)
       
  1043         {
       
  1044         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1045 
       
  1046         TRAP(err,aProxy->SetPathTraitL(
       
  1047            STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1048            STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1049            STATIC_CAST(TM2GSvgPathHandle, aPathHandle)); );
       
  1050         }
       
  1051     M2G_DO_UNLOCK(aJni)
       
  1052 
       
  1053     M2GGeneral::CheckErrorCode(aJni, err);
       
  1054     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setPathTrait - end");
       
  1055 }
       
  1056 // -----------------------------------------------------------------------------
       
  1057 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setRectTrait
       
  1058 // -----------------------------------------------------------------------------
       
  1059 /**
       
  1060  * Calls MM2GSVGProxy::SetRectTraitL method.
       
  1061  * @since Series S60 3.0
       
  1062  * @param aProxy Proxy instance.
       
  1063  * @param aElementHandle Element handle
       
  1064  * @param aAttributeTypeId Attribute type id
       
  1065  * @param aMatrixData -
       
  1066  */
       
  1067 JNIEXPORT void JNICALL
       
  1068 Java_com_nokia_microedition_m2g_M2GSVGElement__1setRectTrait(
       
  1069     JNIEnv* aJni,
       
  1070     jclass,
       
  1071     jint aSvgProxyHandle,
       
  1072     jint aElementHandle,
       
  1073     jshort aAttributeTypeId,
       
  1074     jfloat aX, jfloat aY, jfloat aWidth, jfloat aHeight)
       
  1075 {
       
  1076     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setRectTrait - begin");
       
  1077     TM2GRectData rect;
       
  1078     rect[ 0 ] = aX;
       
  1079     rect[ 1 ] = aY;
       
  1080     rect[ 2 ] = aWidth;
       
  1081     rect[ 3 ] = aHeight;
       
  1082     TInt err = KM2GNotOk;
       
  1083 
       
  1084     M2G_DO_LOCK
       
  1085     if (aSvgProxyHandle)
       
  1086         {
       
  1087         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1088     
       
  1089         TRAP(err,  aProxy->SetRectTraitL(
       
  1090                 STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1091                 STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1092                 rect); );
       
  1093         }
       
  1094     M2G_DO_UNLOCK(aJni)
       
  1095 
       
  1096     M2GGeneral::CheckErrorCode(aJni, err);
       
  1097     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _getRectTrait - end");
       
  1098 }
       
  1099 
       
  1100 // -----------------------------------------------------------------------------
       
  1101 // Java_com_nokia_microedition_m2g_M2GSVGElement::_setStringTrait
       
  1102 // -----------------------------------------------------------------------------
       
  1103 /**
       
  1104  * Calls MM2GSVGProxy::SetStringTraitL method.
       
  1105  * @since Series S60 3.0
       
  1106  * @param aElementHandle Element handle
       
  1107  * @param aAttributeTypeId Attribute type id
       
  1108  * @param aString -
       
  1109  */
       
  1110 JNIEXPORT void JNICALL
       
  1111 Java_com_nokia_microedition_m2g_M2GSVGElement__1setStringTrait(
       
  1112     JNIEnv* aJni,
       
  1113     jclass,
       
  1114     jint aSvgProxyHandle,
       
  1115     jint aElementHandle,
       
  1116     jshort aAttributeTypeId,
       
  1117     jstring aValue)
       
  1118 {
       
  1119     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - begin");
       
  1120     //RJString str(*aJni, aValue);
       
  1121     JStringUtils str(*aJni, aValue);
       
  1122     TInt err = KM2GNotOk;
       
  1123     
       
  1124     M2G_DO_LOCK
       
  1125     if (aSvgProxyHandle)
       
  1126         {
       
  1127         MM2GSVGProxy* aProxy = JavaUnhand<MM2GSVGProxy>(aSvgProxyHandle);
       
  1128         TPtrC16 lValue=STATIC_CAST(TPtrC16, str);
       
  1129         
       
  1130         TRAP(err, aProxy->SetStringTraitL(
       
  1131             STATIC_CAST(TM2GSvgElementHandle, aElementHandle),
       
  1132             STATIC_CAST(TM2GSvgAttrType, aAttributeTypeId),
       
  1133             lValue); );
       
  1134         }
       
  1135     M2G_DO_UNLOCK(aJni)
       
  1136    
       
  1137     M2GGeneral::CheckErrorCode(aJni, err);
       
  1138     M2G_DEBUG_0("M2G_DEBUG: JNI ( M2GSVGElement ) _setStringTrait - end");
       
  1139 }
       
  1140 
       
  1141 M2G_NS_END