comparison android/dw.cpp @ 2714:26bb1e4a97d0

Android: Add glue to bring up the color wheel when calling dw_color_choose().
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 03 Dec 2021 20:21:13 +0000
parents 98cc4476b376
children e9ad53d2271b
comparison
equal deleted inserted replaced
2713:6594bb323ab5 2714:26bb1e4a97d0
2964 * Returns: 2964 * Returns:
2965 * The selected color or the current color if cancelled. 2965 * The selected color or the current color if cancelled.
2966 */ 2966 */
2967 unsigned long API dw_color_choose(unsigned long value) 2967 unsigned long API dw_color_choose(unsigned long value)
2968 { 2968 {
2969 /* TODO: Implement this */ 2969 JNIEnv *env;
2970 return value; 2970 unsigned long newcolor = value;
2971
2972 if((env = (JNIEnv *)pthread_getspecific(_dw_env_key)))
2973 {
2974 unsigned long _value = _dw_get_color(value);
2975
2976 // First get the class that contains the method you need to call
2977 jclass clazz = _dw_find_class(env, DW_CLASS_NAME);
2978 // Get the method that you want to call
2979 jmethodID colorChoose = env->GetMethodID(clazz, "colorChoose",
2980 "(IIIII)I");
2981 // Call the method on the object
2982 newcolor = (unsigned long)env->CallIntMethod(_dw_obj, colorChoose, (jint)value, 0,
2983 (jint)DW_RED_VALUE(_value), (jint)DW_GREEN_VALUE(_value), (jint)DW_BLUE_VALUE(_value));
2984 if(!_dw_jni_check_exception(env))
2985 return value;
2986 }
2987 return newcolor;
2971 } 2988 }
2972 2989
2973 /* Draw a point on a window (preferably a render window). 2990 /* Draw a point on a window (preferably a render window).
2974 * Parameters: 2991 * Parameters:
2975 * handle: Handle to the window. 2992 * handle: Handle to the window.