Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw multi colored gesture in same gesture overlay

I am developing a drawing application and i'm using android's gesture for the same. So if i want to change the gesture color at runtime the old gestures which i have already drawn is also taking the new color. Any solution for the same?

Below is my gesture in xml

    <android.gesture.GestureOverlayView
    android:id="@+id/gestures_overlay1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:eventsInterceptionEnabled="true"
    android:fadeEnabled="false"
    android:fadeOffset="5000000000"
    android:gestureStrokeAngleThreshold="0"
    android:gestureStrokeLengthThreshold="0"
    android:gestureStrokeSquarenessThreshold="0"
    android:gestureStrokeType="multiple"
    android:gestureStrokeWidth="2"
    android:orientation="vertical" />

And my gesture in java call is like

    overlay = (GestureOverlayView) findViewById(R.id.gestures_overlay1);
    overlay.addOnGesturePerformedListener(this);
    overlay.setGestureStrokeWidth(stroke);
    overlay.setGestureColor(color);
    overlay.setDrawingCacheEnabled(true);
like image 234
Froyo Avatar asked Nov 10 '22 05:11

Froyo


1 Answers

I was facing the same problem to change the gesture color after it's drawn. Found a workaround where you just need to:
1. Get and store the gesture drawn.
2. Set the gesture color of your choice
3. Set the gesture back to your view, that's it!

Hope I am not too late found this though..

Gesture gesture = signGesture.getGesture();
signGesture.setGestureColor(Color.parseColor("#FFFF0000"));
signGesture.setGesture(gesture);
like image 193
Jiyeh Avatar answered Nov 15 '22 11:11

Jiyeh