Loading tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.javadeleted 100644 → 0 +0 −70 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import java.awt.Composite; /** * Delegate implementing the native methods of android.graphics.AvoidXfermode * * Through the layoutlib_create tool, the original native methods of AvoidXfermode have been * replaced by calls to methods of the same name in this delegate class. * * This class behaves like the original native implementation, but in Java, keeping previously * native data into its own objects and mapping them to int that are sent back and forth between * it and the original AvoidXfermode class. * * Because this extends {@link Xfermode_Delegate}, there's no need to use a * {@link DelegateManager}, as all the PathEffect classes will be added to the manager owned by * {@link Xfermode_Delegate}. * */ public class AvoidXfermode_Delegate extends Xfermode_Delegate { // ---- delegate data ---- // ---- Public Helper methods ---- @Override public Composite getComposite(int alpha) { // FIXME return null; } @Override public boolean isSupported() { return false; } @Override public String getSupportMessage() { return "Avoid Xfermodes are not supported in Layout Preview mode."; } // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(int opColor, int tolerance, int nativeMode) { AvoidXfermode_Delegate newDelegate = new AvoidXfermode_Delegate(); return sManager.addNewDelegate(newDelegate); } // ---- Private delegate/helper methods ---- } tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java +2 −2 Original line number Diff line number Diff line Loading @@ -167,13 +167,13 @@ public final class Path_Delegate { } @LayoutlibDelegate /*package*/ static void native_setFillType(long nPath, int ft) { public static void native_setFillType(long nPath, int ft) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { return; } pathDelegate.mFillType = Path.sFillTypeArray[ft]; pathDelegate.setFillType(Path.sFillTypeArray[ft]); } @LayoutlibDelegate Loading tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.javadeleted 100644 → 0 +0 −70 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import java.awt.Composite; /** * Delegate implementing the native methods of android.graphics.PixelXorXfermode * * Through the layoutlib_create tool, the original native methods of PixelXorXfermode have been * replaced by calls to methods of the same name in this delegate class. * * This class behaves like the original native implementation, but in Java, keeping previously * native data into its own objects and mapping them to int that are sent back and forth between * it and the original PixelXorXfermode class. * * Because this extends {@link Xfermode_Delegate}, there's no need to use a * {@link DelegateManager}, as all the PathEffect classes will be added to the manager owned by * {@link Xfermode_Delegate}. * * @see Xfermode_Delegate */ public class PixelXorXfermode_Delegate extends Xfermode_Delegate { // ---- delegate data ---- // ---- Public Helper methods ---- @Override public Composite getComposite(int alpha) { // FIXME return null; } @Override public boolean isSupported() { return false; } @Override public String getSupportMessage() { return "Pixel XOR Xfermodes are not supported in Layout Preview mode."; } // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(int opColor) { PixelXorXfermode_Delegate newDelegate = new PixelXorXfermode_Delegate(); return sManager.addNewDelegate(newDelegate); } // ---- Private delegate/helper methods ---- } tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java +16 −1 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ public class VectorDrawable_Delegate { properties.putInt(VFullPath_Delegate.STROKE_LINE_JOIN_INDEX * 4, path.getStrokeLineJoin()); properties.putFloat(VFullPath_Delegate.STROKE_MITER_LIMIT_INDEX * 4, path.getStrokeMiterlimit()); properties.putInt(VFullPath_Delegate.FILL_TYPE_INDEX * 4, path.getFillType()); return true; } Loading @@ -186,7 +187,7 @@ public class VectorDrawable_Delegate { static void nUpdateFullPathProperties(long pathPtr, float strokeWidth, int strokeColor, float strokeAlpha, int fillColor, float fillAlpha, float trimPathStart, float trimPathEnd, float trimPathOffset, float strokeMiterLimit, int strokeLineCap, int strokeLineJoin) { int strokeLineJoin, int fillType) { VFullPath_Delegate path = VNativeObject.getDelegate(pathPtr); path.setStrokeWidth(strokeWidth); Loading @@ -200,6 +201,7 @@ public class VectorDrawable_Delegate { path.setStrokeMiterlimit(strokeMiterLimit); path.setStrokeLineCap(strokeLineCap); path.setStrokeLineJoin(strokeLineJoin); path.setFillType(fillType); } @LayoutlibDelegate Loading Loading @@ -530,6 +532,7 @@ public class VectorDrawable_Delegate { private static final int STROKE_LINE_CAP_INDEX = 8; private static final int STROKE_LINE_JOIN_INDEX = 9; private static final int STROKE_MITER_LIMIT_INDEX = 10; private static final int FILL_TYPE_INDEX = 11; private static final int LINECAP_BUTT = 0; private static final int LINECAP_ROUND = 1; Loading Loading @@ -590,6 +593,8 @@ public class VectorDrawable_Delegate { Join mStrokeLineJoin = MITER; float mStrokeMiterlimit = 4; int mFillType = 0; // WINDING(0) is the default value. See Path.FillType private VFullPath_Delegate() { // Empty constructor. } Loading @@ -612,6 +617,7 @@ public class VectorDrawable_Delegate { mStrokeGradient = copy.mStrokeGradient; mFillGradient = copy.mFillGradient; mFillType = copy.mFillType; } private int getStrokeLineCap() { Loading Loading @@ -755,6 +761,14 @@ public class VectorDrawable_Delegate { private void setFillGradient(long gradientPtr) { mFillGradient = gradientPtr; } private void setFillType(int fillType) { mFillType = fillType; } private int getFillType() { return mFillType; } } static class VGroup_Delegate implements VNativeObject { Loading Loading @@ -1124,6 +1138,7 @@ public class VectorDrawable_Delegate { assert fillPaintDelegate != null; fillPaintDelegate.setColorFilter(filterPtr); fillPaintDelegate.setShader(fullPath.mFillGradient); Path_Delegate.native_setFillType(mRenderPath.mNativePath, fullPath.mFillType); Canvas_Delegate.native_drawPath(canvasPtr, mRenderPath.mNativePath, fillPaint .getNativeInstance()); } Loading tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/vector_drawable.png +311 B (5.83 KiB) Loading image diff... Loading
tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.javadeleted 100644 → 0 +0 −70 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import java.awt.Composite; /** * Delegate implementing the native methods of android.graphics.AvoidXfermode * * Through the layoutlib_create tool, the original native methods of AvoidXfermode have been * replaced by calls to methods of the same name in this delegate class. * * This class behaves like the original native implementation, but in Java, keeping previously * native data into its own objects and mapping them to int that are sent back and forth between * it and the original AvoidXfermode class. * * Because this extends {@link Xfermode_Delegate}, there's no need to use a * {@link DelegateManager}, as all the PathEffect classes will be added to the manager owned by * {@link Xfermode_Delegate}. * */ public class AvoidXfermode_Delegate extends Xfermode_Delegate { // ---- delegate data ---- // ---- Public Helper methods ---- @Override public Composite getComposite(int alpha) { // FIXME return null; } @Override public boolean isSupported() { return false; } @Override public String getSupportMessage() { return "Avoid Xfermodes are not supported in Layout Preview mode."; } // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(int opColor, int tolerance, int nativeMode) { AvoidXfermode_Delegate newDelegate = new AvoidXfermode_Delegate(); return sManager.addNewDelegate(newDelegate); } // ---- Private delegate/helper methods ---- }
tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java +2 −2 Original line number Diff line number Diff line Loading @@ -167,13 +167,13 @@ public final class Path_Delegate { } @LayoutlibDelegate /*package*/ static void native_setFillType(long nPath, int ft) { public static void native_setFillType(long nPath, int ft) { Path_Delegate pathDelegate = sManager.getDelegate(nPath); if (pathDelegate == null) { return; } pathDelegate.mFillType = Path.sFillTypeArray[ft]; pathDelegate.setFillType(Path.sFillTypeArray[ft]); } @LayoutlibDelegate Loading
tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.javadeleted 100644 → 0 +0 −70 Original line number Diff line number Diff line /* * Copyright (C) 2010 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.graphics; import com.android.layoutlib.bridge.impl.DelegateManager; import com.android.tools.layoutlib.annotations.LayoutlibDelegate; import java.awt.Composite; /** * Delegate implementing the native methods of android.graphics.PixelXorXfermode * * Through the layoutlib_create tool, the original native methods of PixelXorXfermode have been * replaced by calls to methods of the same name in this delegate class. * * This class behaves like the original native implementation, but in Java, keeping previously * native data into its own objects and mapping them to int that are sent back and forth between * it and the original PixelXorXfermode class. * * Because this extends {@link Xfermode_Delegate}, there's no need to use a * {@link DelegateManager}, as all the PathEffect classes will be added to the manager owned by * {@link Xfermode_Delegate}. * * @see Xfermode_Delegate */ public class PixelXorXfermode_Delegate extends Xfermode_Delegate { // ---- delegate data ---- // ---- Public Helper methods ---- @Override public Composite getComposite(int alpha) { // FIXME return null; } @Override public boolean isSupported() { return false; } @Override public String getSupportMessage() { return "Pixel XOR Xfermodes are not supported in Layout Preview mode."; } // ---- native methods ---- @LayoutlibDelegate /*package*/ static long nativeCreate(int opColor) { PixelXorXfermode_Delegate newDelegate = new PixelXorXfermode_Delegate(); return sManager.addNewDelegate(newDelegate); } // ---- Private delegate/helper methods ---- }
tools/layoutlib/bridge/src/android/graphics/drawable/VectorDrawable_Delegate.java +16 −1 Original line number Diff line number Diff line Loading @@ -178,6 +178,7 @@ public class VectorDrawable_Delegate { properties.putInt(VFullPath_Delegate.STROKE_LINE_JOIN_INDEX * 4, path.getStrokeLineJoin()); properties.putFloat(VFullPath_Delegate.STROKE_MITER_LIMIT_INDEX * 4, path.getStrokeMiterlimit()); properties.putInt(VFullPath_Delegate.FILL_TYPE_INDEX * 4, path.getFillType()); return true; } Loading @@ -186,7 +187,7 @@ public class VectorDrawable_Delegate { static void nUpdateFullPathProperties(long pathPtr, float strokeWidth, int strokeColor, float strokeAlpha, int fillColor, float fillAlpha, float trimPathStart, float trimPathEnd, float trimPathOffset, float strokeMiterLimit, int strokeLineCap, int strokeLineJoin) { int strokeLineJoin, int fillType) { VFullPath_Delegate path = VNativeObject.getDelegate(pathPtr); path.setStrokeWidth(strokeWidth); Loading @@ -200,6 +201,7 @@ public class VectorDrawable_Delegate { path.setStrokeMiterlimit(strokeMiterLimit); path.setStrokeLineCap(strokeLineCap); path.setStrokeLineJoin(strokeLineJoin); path.setFillType(fillType); } @LayoutlibDelegate Loading Loading @@ -530,6 +532,7 @@ public class VectorDrawable_Delegate { private static final int STROKE_LINE_CAP_INDEX = 8; private static final int STROKE_LINE_JOIN_INDEX = 9; private static final int STROKE_MITER_LIMIT_INDEX = 10; private static final int FILL_TYPE_INDEX = 11; private static final int LINECAP_BUTT = 0; private static final int LINECAP_ROUND = 1; Loading Loading @@ -590,6 +593,8 @@ public class VectorDrawable_Delegate { Join mStrokeLineJoin = MITER; float mStrokeMiterlimit = 4; int mFillType = 0; // WINDING(0) is the default value. See Path.FillType private VFullPath_Delegate() { // Empty constructor. } Loading @@ -612,6 +617,7 @@ public class VectorDrawable_Delegate { mStrokeGradient = copy.mStrokeGradient; mFillGradient = copy.mFillGradient; mFillType = copy.mFillType; } private int getStrokeLineCap() { Loading Loading @@ -755,6 +761,14 @@ public class VectorDrawable_Delegate { private void setFillGradient(long gradientPtr) { mFillGradient = gradientPtr; } private void setFillType(int fillType) { mFillType = fillType; } private int getFillType() { return mFillType; } } static class VGroup_Delegate implements VNativeObject { Loading Loading @@ -1124,6 +1138,7 @@ public class VectorDrawable_Delegate { assert fillPaintDelegate != null; fillPaintDelegate.setColorFilter(filterPtr); fillPaintDelegate.setShader(fullPath.mFillGradient); Path_Delegate.native_setFillType(mRenderPath.mNativePath, fullPath.mFillType); Canvas_Delegate.native_drawPath(canvasPtr, mRenderPath.mNativePath, fillPaint .getNativeInstance()); } Loading
tools/layoutlib/bridge/tests/res/testApp/MyApplication/golden/vector_drawable.png +311 B (5.83 KiB) Loading image diff...