Search in sources :

Example 16 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.

the class Region_Delegate method nativeOp.

@LayoutlibDelegate
static /*package*/
boolean nativeOp(long native_dst, Rect rect, long native_region, int op) {
    Region_Delegate region = sManager.getDelegate(native_dst);
    if (region == null) {
        return false;
    }
    region.mArea = combineShapes(region.mArea, new Rectangle2D.Float(rect.left, rect.top, rect.width(), rect.height()), op);
    assert region.mArea != null;
    if (region.mArea != null) {
        region.mArea = new Area();
    }
    return region.mArea.getBounds().isEmpty() == false;
}
Also used : Area(java.awt.geom.Area) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 17 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.

the class Region_Delegate method nativeGetBounds.

@LayoutlibDelegate
static /*package*/
boolean nativeGetBounds(long native_region, Rect rect) {
    Region_Delegate region = sManager.getDelegate(native_region);
    if (region == null) {
        return true;
    }
    Rectangle bounds = region.mArea.getBounds();
    if (bounds.isEmpty()) {
        rect.left = rect.top = rect.right = rect.bottom = 0;
        return false;
    }
    rect.left = bounds.x;
    rect.top = bounds.y;
    rect.right = bounds.x + bounds.width;
    rect.bottom = bounds.y + bounds.height;
    return true;
}
Also used : Rectangle(java.awt.Rectangle) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 18 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.

the class AnimatedVectorDrawable_Delegate method nCreateGroupPropertyHolder.

@LayoutlibDelegate
static /*package*/
long nCreateGroupPropertyHolder(long nativePtr, int propertyId, float startValue, float endValue) {
    VGroup_Delegate group = VNativeObject.getDelegate(nativePtr);
    Consumer<Float> setter = group.getPropertySetter(propertyId);
    return sHolders.addNewDelegate(FloatPropertySetter.of(setter, startValue, endValue));
}
Also used : VGroup_Delegate(android.graphics.drawable.VectorDrawable_Delegate.VGroup_Delegate) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 19 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.

the class AnimatedVectorDrawable_Delegate method nCreatePathColorPropertyHolder.

@LayoutlibDelegate
static /*package*/
long nCreatePathColorPropertyHolder(long nativePtr, int propertyId, int startValue, int endValue) {
    VFullPath_Delegate path = VNativeObject.getDelegate(nativePtr);
    Consumer<Integer> setter = path.getIntPropertySetter(propertyId);
    return sHolders.addNewDelegate(IntPropertySetter.of(setter, startValue, endValue));
}
Also used : VFullPath_Delegate(android.graphics.drawable.VectorDrawable_Delegate.VFullPath_Delegate) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Example 20 with LayoutlibDelegate

use of com.android.tools.layoutlib.annotations.LayoutlibDelegate in project platform_frameworks_base by android.

the class AnimatedVectorDrawable_Delegate method nCreatePathPropertyHolder.

@LayoutlibDelegate
static /*package*/
long nCreatePathPropertyHolder(long nativePtr, int propertyId, float startValue, float endValue) {
    VFullPath_Delegate path = VNativeObject.getDelegate(nativePtr);
    Consumer<Float> setter = path.getFloatPropertySetter(propertyId);
    return sHolders.addNewDelegate(FloatPropertySetter.of(setter, startValue, endValue));
}
Also used : VFullPath_Delegate(android.graphics.drawable.VectorDrawable_Delegate.VFullPath_Delegate) LayoutlibDelegate(com.android.tools.layoutlib.annotations.LayoutlibDelegate)

Aggregations

LayoutlibDelegate (com.android.tools.layoutlib.annotations.LayoutlibDelegate)334 ArrayResourceValue (com.android.ide.common.rendering.api.ArrayResourceValue)56 DensityBasedResourceValue (com.android.ide.common.rendering.api.DensityBasedResourceValue)56 ResourceValue (com.android.ide.common.rendering.api.ResourceValue)56 BufferedImage (java.awt.image.BufferedImage)46 AffineTransform (java.awt.geom.AffineTransform)42 Area (java.awt.geom.Area)42 File (java.io.File)30 GcSnapshot (com.android.layoutlib.bridge.impl.GcSnapshot)29 FileNotFoundException (java.io.FileNotFoundException)24 Graphics2D (java.awt.Graphics2D)19 TypedValue (android.util.TypedValue)17 NotFoundException (android.content.res.Resources.NotFoundException)16 BridgeContext (com.android.layoutlib.bridge.android.BridgeContext)16 BridgeXmlBlockParser (com.android.layoutlib.bridge.android.BridgeXmlBlockParser)16 ArrayList (java.util.ArrayList)16 XmlPullParser (org.xmlpull.v1.XmlPullParser)16 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)16 IOException (java.io.IOException)14 NinePatchInputStream (com.android.layoutlib.bridge.util.NinePatchInputStream)12