Search in sources :

Example 56 with PathIterator

use of java.awt.geom.PathIterator in project android_frameworks_base by crdroidandroid.

the class PathMeasure_Delegate method native_isClosed.

@LayoutlibDelegate
static /*package*/
boolean native_isClosed(long native_instance) {
    PathMeasure_Delegate pathMeasure = sManager.getDelegate(native_instance);
    assert pathMeasure != null;
    Path_Delegate path = Path_Delegate.getDelegate(pathMeasure.mNativePath);
    if (path == null) {
        return false;
    }
    int type = 0;
    float[] segment = new float[6];
    for (PathIterator pi = path.getJavaShape().getPathIterator(null); !pi.isDone(); pi.next()) {
        type = pi.currentSegment(segment);
    }
    // A path is a closed path if the last element is SEG_CLOSE
    return type == PathIterator.SEG_CLOSE;
}
Also used : CachedPathIterator(com.android.layoutlib.bridge.util.CachedPathIteratorFactory.CachedPathIterator) PathIterator(java.awt.geom.PathIterator) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Aggregations

PathIterator (java.awt.geom.PathIterator)56 AffineTransform (java.awt.geom.AffineTransform)16 GeneralPath (java.awt.geom.GeneralPath)14 LayoutlibDelegate (com.android.tools.layoutlib.annotations.LayoutlibDelegate)10 ArrayList (java.util.ArrayList)9 Point2D (java.awt.geom.Point2D)7 CachedPathIterator (com.android.layoutlib.bridge.util.CachedPathIteratorFactory.CachedPathIterator)5 Point (java.awt.Point)4 Rectangle2D (java.awt.geom.Rectangle2D)4 Path2D (java.awt.geom.Path2D)3 Paint (java.awt.Paint)2 Rectangle (java.awt.Rectangle)2 TDoubleArrayList (gnu.trove.TDoubleArrayList)1 GradientPaint (java.awt.GradientPaint)1 LinearGradientPaint (java.awt.LinearGradientPaint)1 RadialGradientPaint (java.awt.RadialGradientPaint)1 Shape (java.awt.Shape)1 TexturePaint (java.awt.TexturePaint)1 FontRenderContext (java.awt.font.FontRenderContext)1 GlyphVector (java.awt.font.GlyphVector)1