Ejemplo n.º 1
0
        public virtual unsafe float GetFloat(string p0)
        {
            if (id_getFloat_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_getFloat_Ljava_lang_String_ = JNIEnv.GetMethodID(class_ref, "getFloat", "(Ljava/lang/String;)F");
            }
            IntPtr native_p0 = JNIEnv.NewString(p0);

            try {
                JValue *__args = stackalloc JValue [1];
                __args [0] = new JValue(native_p0);

                float __ret;
                if (((object)this).GetType() == ThresholdType)
                {
                    __ret = JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getFloat_Ljava_lang_String_, __args);
                }
                else
                {
                    __ret = JNIEnv.CallNonvirtualFloatMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getFloat", "(Ljava/lang/String;)F"), __args);
                }
                return(__ret);
            } finally {
                JNIEnv.DeleteLocalRef(native_p0);
            }
        }
Ejemplo n.º 2
0
 public unsafe float GetD()
 {
     if (id_getD == IntPtr.Zero)
     {
         id_getD = JNIEnv.GetMethodID(class_ref, "getD", "()F");
     }
     return(JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getD));
 }
Ejemplo n.º 3
0
 public float ReadFloat()
 {
     if (id_readFloat == IntPtr.Zero)
     {
         id_readFloat = JNIEnv.GetMethodID(class_ref, "readFloat", "()F");
     }
     return(JNIEnv.CallFloatMethod(Handle, id_readFloat));
 }
 public float ToPDFSize(float p0)
 {
     if (id_ToPDFSize_F == IntPtr.Zero)
     {
         id_ToPDFSize_F = JNIEnv.GetMethodID(class_ref, "ToPDFSize", "(F)F");
     }
     return(JNIEnv.CallFloatMethod(Handle, id_ToPDFSize_F, new JValue(p0)));
 }
Ejemplo n.º 5
0
 public float MetersToEquatorPixels(float meters)
 {
     if (id_metersToEquatorPixels_F == IntPtr.Zero)
     {
         id_metersToEquatorPixels_F = JNIEnv.GetMethodID(class_ref, "metersToEquatorPixels", "(F)F");
     }
     return(JNIEnv.CallFloatMethod(Handle, id_metersToEquatorPixels_F, new JValue(meters)));
 }
 public float ToPDFY(float p0, float p1)
 {
     if (id_ToPDFY_FF == IntPtr.Zero)
     {
         id_ToPDFY_FF = JNIEnv.GetMethodID(class_ref, "ToPDFY", "(FF)F");
     }
     return(JNIEnv.CallFloatMethod(Handle, id_ToPDFY_FF, new JValue(p0), new JValue(p1)));
 }
Ejemplo n.º 7
0
 protected float GetPDFY(int p0)
 {
     if (id_GetPDFY_I == IntPtr.Zero)
     {
         id_GetPDFY_I = JNIEnv.GetMethodID(class_ref, "GetPDFY", "(I)F");
     }
     return(JNIEnv.CallFloatMethod(Handle, id_GetPDFY_I, new JValue(p0)));
 }
Ejemplo n.º 8
0
 public float GetX()
 {
     if (id_getX == IntPtr.Zero)
     {
         id_getX = JNIEnv.GetMethodID(class_ref, "getX", "()F");
     }
     return(JNIEnv.CallFloatMethod(Handle, id_getX));
 }
Ejemplo n.º 9
0
        public unsafe float Get(int p0)
        {
            if (id_get_I == IntPtr.Zero)
            {
                id_get_I = JNIEnv.GetMethodID(class_ref, "get", "(I)F");
            }
            JValue *__args = stackalloc JValue [1];

            __args [0] = new JValue(p0);
            return(JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_get_I, __args));
        }
Ejemplo n.º 10
0
            public float GetFloat(string p0, float p1)
            {
                if (id_getFloat_Ljava_lang_String_F == IntPtr.Zero)
                {
                    id_getFloat_Ljava_lang_String_F = JNIEnv.GetMethodID(class_ref, "getFloat", "(Ljava/lang/String;F)F");
                }
                IntPtr native_p0 = JNIEnv.NewString(p0);
                float  __ret     = JNIEnv.CallFloatMethod(Handle, id_getFloat_Ljava_lang_String_F, new JValue(native_p0), new JValue(p1));

                JNIEnv.DeleteLocalRef(native_p0);
                return(__ret);
            }
 public unsafe float MetersToEquatorPixels(float p0)
 {
     if (id_metersToEquatorPixels_F == IntPtr.Zero)
     {
         id_metersToEquatorPixels_F = JNIEnv.GetMethodID(class_ref, "metersToEquatorPixels", "(F)F");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         return(JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_metersToEquatorPixels_F, __args));
     } finally {
     }
 }
 public unsafe float GetPercentile(float p0)
 {
     if (id_getPercentile_F == IntPtr.Zero)
     {
         id_getPercentile_F = JNIEnv.GetMethodID(class_ref, "getPercentile", "(F)F");
     }
     try {
         JValue *__args = stackalloc JValue [1];
         __args [0] = new JValue(p0);
         return(JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getPercentile_F, __args));
     } finally {
     }
 }
Ejemplo n.º 13
0
        protected virtual float GetAdjustedScale(int p0, int p1)
        {
            if (id_getAdjustedScale_II == IntPtr.Zero)
            {
                id_getAdjustedScale_II = JNIEnv.GetMethodID(class_ref, "getAdjustedScale", "(II)F");
            }

            if (GetType() == ThresholdType)
            {
                return(JNIEnv.CallFloatMethod(Handle, id_getAdjustedScale_II, new JValue(p0), new JValue(p1)));
            }
            else
            {
                return(JNIEnv.CallNonvirtualFloatMethod(Handle, ThresholdClass, id_getAdjustedScale_II, new JValue(p0), new JValue(p1)));
            }
        }
        public virtual float GetRotationRate()
        {
            if (id_getRotationRate == IntPtr.Zero)
            {
                id_getRotationRate = JNIEnv.GetMethodID(class_ref, "getRotationRate", "()F");
            }

            if (GetType() == ThresholdType)
            {
                return(JNIEnv.CallFloatMethod(Handle, id_getRotationRate));
            }
            else
            {
                return(JNIEnv.CallNonvirtualFloatMethod(Handle, ThresholdClass, id_getRotationRate));
            }
        }
            public unsafe float GetFloat(string p0, float p1)
            {
                if (id_getFloat_Ljava_lang_String_F == IntPtr.Zero)
                {
                    id_getFloat_Ljava_lang_String_F = JNIEnv.GetMethodID(class_ref, "getFloat", "(Ljava/lang/String;F)F");
                }
                IntPtr native_p0 = JNIEnv.NewString(p0);

                try {
                    JValue *__args = stackalloc JValue [2];
                    __args [0] = new JValue(native_p0);
                    __args [1] = new JValue(p1);
                    float __ret = JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getFloat_Ljava_lang_String_F, __args);
                    return(__ret);
                } finally {
                    JNIEnv.DeleteLocalRef(native_p0);
                }
            }
Ejemplo n.º 16
0
 public virtual unsafe float ReadFloatLE()
 {
     if (id_readFloatLE == IntPtr.Zero)
     {
         id_readFloatLE = JNIEnv.GetMethodID(class_ref, "readFloatLE", "()F");
     }
     try {
         if (GetType() == ThresholdType)
         {
             return(JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_readFloatLE));
         }
         else
         {
             return(JNIEnv.CallNonvirtualFloatMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "readFloatLE", "()F")));
         }
     } finally {
     }
 }
        public virtual unsafe float GetFloat(int key)
        {
            if (id_getFloat_I == IntPtr.Zero)
            {
                id_getFloat_I = JNIEnv.GetMethodID(class_ref, "getFloat", "(I)F");
            }
            try {
                JValue *__args = stackalloc JValue [1];
                __args [0] = new JValue(key);

                if (((object)this).GetType() == ThresholdType)
                {
                    return(JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getFloat_I, __args));
                }
                else
                {
                    return(JNIEnv.CallNonvirtualFloatMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getFloat", "(I)F"), __args));
                }
            } finally {
            }
        }
Ejemplo n.º 18
0
        public virtual float GetFloat(string p0)
        {
            if (id_getFloat_Ljava_lang_String_ == IntPtr.Zero)
            {
                id_getFloat_Ljava_lang_String_ = JNIEnv.GetMethodID(class_ref, "getFloat", "(Ljava/lang/String;)F");
            }
            IntPtr native_p0 = JNIEnv.NewString(p0);

            float __ret;

            if (GetType() == ThresholdType)
            {
                __ret = JNIEnv.CallFloatMethod(Handle, id_getFloat_Ljava_lang_String_, new JValue(native_p0));
            }
            else
            {
                __ret = JNIEnv.CallNonvirtualFloatMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getFloat", "(Ljava/lang/String;)F"), new JValue(native_p0));
            }
            JNIEnv.DeleteLocalRef(native_p0);
            return(__ret);
        }
        protected virtual float GetHalfDiffX(global::System.Collections.Generic.IList <global::Java.Lang.Float> p0, int p1, int p2)
        {
            if (id_getHalfDiffX_Ljava_util_List_II == IntPtr.Zero)
            {
                id_getHalfDiffX_Ljava_util_List_II = JNIEnv.GetMethodID(class_ref, "getHalfDiffX", "(Ljava/util/List;II)F");
            }
            IntPtr native_p0 = global::Android.Runtime.JavaList <global::Java.Lang.Float> .ToLocalJniHandle(p0);

            float __ret;

            if (GetType() == ThresholdType)
            {
                __ret = JNIEnv.CallFloatMethod(Handle, id_getHalfDiffX_Ljava_util_List_II, new JValue(native_p0), new JValue(p1), new JValue(p2));
            }
            else
            {
                __ret = JNIEnv.CallNonvirtualFloatMethod(Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getHalfDiffX", "(Ljava/util/List;II)F"), new JValue(native_p0), new JValue(p1), new JValue(p2));
            }
            JNIEnv.DeleteLocalRef(native_p0);
            return(__ret);
        }
Ejemplo n.º 20
0
                public override unsafe float GetAlpha(global::Android.Views.View p0)
                {
                    if (id_getAlpha_Landroid_view_View_ == IntPtr.Zero)
                    {
                        id_getAlpha_Landroid_view_View_ = JNIEnv.GetMethodID(class_ref, "getAlpha", "(Landroid/view/View;)F");
                    }
                    try {
                        JValue *__args = stackalloc JValue [1];
                        __args [0] = new JValue(p0);

                        float __ret;
                        if (GetType() == ThresholdType)
                        {
                            __ret = JNIEnv.CallFloatMethod(((global::Java.Lang.Object) this).Handle, id_getAlpha_Landroid_view_View_, __args);
                        }
                        else
                        {
                            __ret = JNIEnv.CallNonvirtualFloatMethod(((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID(ThresholdClass, "getAlpha", "(Landroid/view/View;)F"), __args);
                        }
                        return(__ret);
                    } finally {
                    }
                }
Ejemplo n.º 21
0
 private static object PrimJ2C(JniLocalHandle obj, JNIEnv env, Type type)
 {
     if (type == typeof(bool))
     {
         return(env.CallBooleanMethod(obj, boolValue));
     }
     if (type == typeof(char))
     {
         return(env.CallCharMethod(obj, charValue));
     }
     if (type == typeof(byte))
     {
         return(env.CallByteMethod(obj, byteValue));
     }
     if (type == typeof(short))
     {
         return(env.CallShortMethod(obj, shortValue));
     }
     if (type == typeof(int))
     {
         return(env.CallIntMethod(obj, intValue));
     }
     if (type == typeof(long))
     {
         return(env.CallLongMethod(obj, longValue));
     }
     if (type == typeof(double))
     {
         return(env.CallDoubleMethod(obj, doubleValue));
     }
     if (type == typeof(float))
     {
         return(env.CallFloatMethod(obj, floatValue));
     }
     throw new InvalidProgramException("Unnknown primitive type" + type);
 }
Ejemplo n.º 22
0
        public T CallMethod <T>(string methodName, string sig, List <object> param)
        {
            IntPtr methodId = env.GetMethodId(javaClass, methodName, sig);

            try
            {
                if (typeof(T) == typeof(byte))
                {
                    // Call the byte method
                    byte res = env.CallByteMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(bool))
                {
                    // Call the boolean method
                    bool res = env.CallBooleanMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                if (typeof(T) == typeof(char))
                {
                    // Call the char method
                    char res = env.CallCharMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(short))
                {
                    // Call the short method
                    short res = env.CallShortMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(int))
                {
                    // Call the int method
                    int res = env.CallIntMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(long))
                {
                    // Call the long method
                    long res = env.CallLongMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(float))
                {
                    // Call the float method
                    float res = env.CallFloatMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(double))
                {
                    // Call the double method
                    double res = env.CallDoubleMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);  // need to fix this
                }
                else if (typeof(T) == typeof(string))
                {
                    // Call the string method
                    IntPtr jstr = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));

                    string res = env.JStringToString(jstr);
                    env.DeleteLocalRef(jstr);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(byte[]))
                {
                    // Call the string method
                    IntPtr jstr = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    if (jstr.ToInt32() == 0)
                    {
                        return(default(T));
                    }
                    byte[] res = env.JStringToByte(jstr);
                    env.DeleteLocalRef(jstr);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(object))
                {
                    // Call the object method and deal with whatever comes back in the call code
                    IntPtr res = env.CallObjectMethod(javaObject, methodId, ParseParameters(sig, param));
                    return((T)(object)res);
                }
                return(default(T));
            }
            catch
            {
                throw new Exception(env.CatchJavaException());
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Java object method callers
        /// </summary>
        /// <typeparam name="T">expect return type</typeparam>
        /// <param name="javaClass">Java class pointer</param>
        /// <param name="javaObject">Java Object pointer</param>
        /// <param name="methodName">Name of the method to call</param>
        /// <param name="sig">Method's JNI signature</param>
        /// <param name="param">Paramters of the method call</param>
        /// <returns></returns>
        public T CallMethod <T>(IntPtr javaClass, IntPtr javaObject, string methodName, string sig, params object[] param)
        {
            IntPtr methodId = env.GetMethodID(javaClass, methodName, sig);

            try {
                if (typeof(T) == typeof(byte))
                {
                    // Call the byte method
                    byte res = env.CallByteMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(bool))
                {
                    // Call the boolean method
                    bool res = env.CallBooleanMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                if (typeof(T) == typeof(char))
                {
                    // Call the char method
                    char res = env.CallCharMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(short))
                {
                    // Call the short method
                    short res = env.CallShortMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(int))
                {
                    // Call the int method
                    int res = env.CallIntMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(long))
                {
                    // Call the long method
                    long res = env.CallLongMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(float))
                {
                    // Call the float method
                    float res = env.CallFloatMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(double))
                {
                    // Call the double method
                    double res = env.CallDoubleMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res); // need to fix this
                }
                else if (typeof(T) == typeof(string))
                {
                    // Call the string method
                    IntPtr jstr = env.CallObjectMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));

                    string res = env.JStringToString(jstr);
                    env.DeleteLocalRef(jstr);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(byte[]))
                {
                    // Call the byte method
                    IntPtr jobj = env.CallStaticObjectMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    if (jobj == IntPtr.Zero)
                    {
                        return(default(T));
                    }
                    byte[] res = env.JStringToByte(jobj);
                    env.DeleteLocalRef(jobj);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(string[]))
                {
                    // Call the string array method
                    IntPtr jobj = env.CallObjectMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    if (jobj == IntPtr.Zero)
                    {
                        return(default(T));
                    }

                    IntPtr[] objArray = env.GetObjectArray(jobj);
                    string[] res      = new string[objArray.Length];

                    for (int i = 0; i < objArray.Length; i++)
                    {
                        res[i] = env.JStringToString(objArray[i]);
                    }

                    env.DeleteLocalRef(jobj);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(int[]))
                {
                    // Call the int array method
                    IntPtr jobj = env.CallObjectMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    if (jobj == IntPtr.Zero)
                    {
                        return(default(T));
                    }
                    int[] res = env.GetIntArray(jobj);
                    env.DeleteLocalRef(jobj);
                    return((T)(object)res);
                }
                else if (typeof(T) == typeof(IntPtr))
                {
                    // Call the object method and deal with whatever comes back in the call code
                    IntPtr res = env.CallObjectMethod(javaObject, methodId, ParseParameters(javaClass, sig, param));
                    return((T)(object)res);
                }
                return(default(T));
            } catch {
                throw new Exception(env.CatchJavaException());
            }
        }