Loading api/current.txt +14 −3 Original line number Diff line number Diff line Loading @@ -9100,6 +9100,9 @@ package android.graphics { public class ColorMatrixColorFilter extends android.graphics.ColorFilter { ctor public ColorMatrixColorFilter(android.graphics.ColorMatrix); ctor public ColorMatrixColorFilter(float[]); method public android.graphics.ColorMatrix getColorMatrix(); method public void setColorMatrix(android.graphics.ColorMatrix); method public void setColorMatrix(float[]); } public class ComposePathEffect extends android.graphics.PathEffect { Loading Loading @@ -9175,6 +9178,10 @@ package android.graphics { public class LightingColorFilter extends android.graphics.ColorFilter { ctor public LightingColorFilter(int, int); method public int getColorAdd(); method public int getColorMultiply(); method public void setColorAdd(int); method public void setColorMultiply(int); } public class LinearGradient extends android.graphics.Shader { Loading Loading @@ -9649,6 +9656,10 @@ package android.graphics { public class PorterDuffColorFilter extends android.graphics.ColorFilter { ctor public PorterDuffColorFilter(int, android.graphics.PorterDuff.Mode); method public int getColor(); method public android.graphics.PorterDuff.Mode getMode(); method public void setColor(int); method public void setMode(android.graphics.PorterDuff.Mode); } public class PorterDuffXfermode extends android.graphics.Xfermode { Loading Loading @@ -42441,11 +42452,11 @@ package java.util.concurrent { } public class ConcurrentHashMap extends java.util.AbstractMap implements java.util.concurrent.ConcurrentMap java.io.Serializable { ctor public ConcurrentHashMap(int, float, int); ctor public ConcurrentHashMap(int, float); ctor public ConcurrentHashMap(int); ctor public ConcurrentHashMap(); ctor public ConcurrentHashMap(int); ctor public ConcurrentHashMap(java.util.Map<? extends K, ? extends V>); ctor public ConcurrentHashMap(int, float); ctor public ConcurrentHashMap(int, float, int); method public boolean contains(java.lang.Object); method public java.util.Enumeration<V> elements(); method public java.util.Set<java.util.Map.Entry<K, V>> entrySet(); core/jni/android/graphics/ColorFilter.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -33,10 +33,10 @@ using namespace uirenderer; class SkColorFilterGlue { public: static void finalizer(JNIEnv* env, jobject clazz, SkColorFilter* obj, SkiaColorFilter* f) { SkSafeUnref(obj); if (obj) SkSafeUnref(obj); // f == NULL when not !USE_OPENGL_RENDERER, so no need to delete outside the ifdef #ifdef USE_OPENGL_RENDERER if (android::uirenderer::Caches::hasInstance()) { if (f && android::uirenderer::Caches::hasInstance()) { android::uirenderer::Caches::getInstance().resourceCache.destructor(f); } else { delete f; Loading Loading @@ -112,7 +112,7 @@ public: }; static JNINativeMethod colorfilter_methods[] = { {"finalizer", "(II)V", (void*) SkColorFilterGlue::finalizer} {"destroyFilter", "(II)V", (void*) SkColorFilterGlue::finalizer} }; static JNINativeMethod porterduff_methods[] = { Loading graphics/java/android/graphics/ColorFilter.java +11 −3 Original line number Diff line number Diff line Loading @@ -21,22 +21,30 @@ package android.graphics; /** * A color filter can be used with a {@link Paint} to modify the color of * each pixel drawn with that paint. This is an abstract class that should * never be used directly. */ public class ColorFilter { // Holds the pointer to the native SkColorFilter instance int native_instance; /** * Holds the pointer to the native SkiaColorFilter instance, from libhwui. * * @hide */ public int nativeColorFilter; @Override protected void finalize() throws Throwable { try { super.finalize(); } finally { finalizer(native_instance, nativeColorFilter); destroyFilter(native_instance, nativeColorFilter); } } private static native void finalizer(int native_instance, int nativeColorFilter); static native void destroyFilter(int native_instance, int nativeColorFilter); } graphics/java/android/graphics/ColorMatrix.java +23 −20 Original line number Diff line number Diff line Loading @@ -18,23 +18,29 @@ package android.graphics; import android.util.FloatMath; import java.util.Arrays; /** * 5x4 matrix for transforming the color+alpha components of a Bitmap. * The matrix is stored in a single array, and its treated as follows: * <pre> * [ a, b, c, d, e, * f, g, h, i, j, * k, l, m, n, o, * p, q, r, s, t ] * </pre> * * When applied to a color [r, g, b, a], the resulting color is computed as * (after clamping) * When applied to a color <code>[r, g, b, a]</code>, the resulting color * is computed as (after clamping): * <pre> * R' = a*R + b*G + c*B + d*A + e; * G' = f*R + g*G + h*B + i*A + j; * B' = k*R + l*G + m*B + n*A + o; * A' = p*R + q*G + r*B + s*A + t; * </pre> */ @SuppressWarnings({ "MismatchedReadAndWriteOfArray", "PointlessArithmeticExpression" }) public class ColorMatrix { private final float[] mArray = new float[20]; /** Loading Loading @@ -66,17 +72,16 @@ public class ColorMatrix { /** * Set this colormatrix to identity: * <pre> * [ 1 0 0 0 0 - red vector * 0 1 0 0 0 - green vector * 0 0 1 0 0 - blue vector * 0 0 0 1 0 ] - alpha vector * </pre> */ public void reset() { final float[] a = mArray; for (int i = 19; i > 0; --i) { a[i] = 0; } Arrays.fill(a, 0); a[0] = a[6] = a[12] = a[18] = 1; } Loading Loading @@ -112,9 +117,9 @@ public class ColorMatrix { /** * Set the rotation on a color axis by the specified values. * axis=0 correspond to a rotation around the RED color * axis=1 correspond to a rotation around the GREEN color * axis=2 correspond to a rotation around the BLUE color * <code>axis=0</code> correspond to a rotation around the RED color * <code>axis=1</code> correspond to a rotation around the GREEN color * <code>axis=2</code> correspond to a rotation around the BLUE color */ public void setRotate(int axis, float degrees) { reset(); Loading Loading @@ -152,12 +157,10 @@ public class ColorMatrix { * matB to be the same colormatrix as this. */ public void setConcat(ColorMatrix matA, ColorMatrix matB) { float[] tmp = null; float[] tmp; if (matA == this || matB == this) { tmp = new float[20]; } else { } else { tmp = mArray; } Loading graphics/java/android/graphics/ColorMatrixColorFilter.java +82 −8 Original line number Diff line number Diff line Loading @@ -16,7 +16,15 @@ package android.graphics; /** * A color filter that transforms colors through a 4x5 color matrix. This filter * can be used to change the saturation of pixels, convert from YUV to RGB, etc. * * @see ColorMatrix */ public class ColorMatrixColorFilter extends ColorFilter { private final ColorMatrix mMatrix = new ColorMatrix(); /** * Create a color filter that transforms colors through a 4x5 color matrix. * Loading @@ -25,15 +33,14 @@ public class ColorMatrixColorFilter extends ColorFilter { * is constructed will not be reflected in the filter. */ public ColorMatrixColorFilter(ColorMatrix matrix) { final float[] colorMatrix = matrix.getArray(); native_instance = nativeColorMatrixFilter(colorMatrix); nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix); mMatrix.set(matrix); update(); } /** * Create a color filter that transforms colors through a 4x5 color matrix. * * @param array array of floats used to transform colors, treated as a 4x5 * @param array Array of floats used to transform colors, treated as a 4x5 * matrix. The first 20 entries of the array are copied into * the filter. See ColorMatrix. */ Loading @@ -41,8 +48,75 @@ public class ColorMatrixColorFilter extends ColorFilter { if (array.length < 20) { throw new ArrayIndexOutOfBoundsException(); } native_instance = nativeColorMatrixFilter(array); nativeColorFilter = nColorMatrixFilter(native_instance, array); mMatrix.set(array); update(); } /** * Returns the {@link ColorMatrix} used by this filter. The returned * value is never null. Modifying the returned matrix does not have * any effect until you call {@link #setColorMatrix(ColorMatrix)}. * * @see #setColorMatrix(ColorMatrix) */ public ColorMatrix getColorMatrix() { return mMatrix; } /** * Specifies the color matrix used by this filter. If the specified * color matrix is null, this filter's color matrix will be reset to * the identity matrix. * * @param matrix A {@link ColorMatrix} or null * * @see #getColorMatrix() * @see android.graphics.ColorMatrix#reset() * @see #setColorMatrix(float[]) */ public void setColorMatrix(ColorMatrix matrix) { if (matrix == null) { mMatrix.reset(); } else if (matrix != mMatrix) { mMatrix.set(matrix); } update(); } /** * Specifies the color matrix used by this filter. If the specified * color matrix is null, this filter's color matrix will be reset to * the identity matrix. * * @param array Array of floats used to transform colors, treated as a 4x5 * matrix. The first 20 entries of the array are copied into * the filter. See {@link ColorMatrix}. * * @see #getColorMatrix() * @see android.graphics.ColorMatrix#reset() * @see #setColorMatrix(ColorMatrix) * * @throws ArrayIndexOutOfBoundsException if the specified array's * length is < 20 */ public void setColorMatrix(float[] array) { if (array == null) { mMatrix.reset(); } else { if (array.length < 20) { throw new ArrayIndexOutOfBoundsException(); } mMatrix.set(array); } update(); } private void update() { final float[] colorMatrix = mMatrix.getArray(); destroyFilter(native_instance, nativeColorFilter); native_instance = nativeColorMatrixFilter(colorMatrix); nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix); } private static native int nativeColorMatrixFilter(float[] array); Loading Loading
api/current.txt +14 −3 Original line number Diff line number Diff line Loading @@ -9100,6 +9100,9 @@ package android.graphics { public class ColorMatrixColorFilter extends android.graphics.ColorFilter { ctor public ColorMatrixColorFilter(android.graphics.ColorMatrix); ctor public ColorMatrixColorFilter(float[]); method public android.graphics.ColorMatrix getColorMatrix(); method public void setColorMatrix(android.graphics.ColorMatrix); method public void setColorMatrix(float[]); } public class ComposePathEffect extends android.graphics.PathEffect { Loading Loading @@ -9175,6 +9178,10 @@ package android.graphics { public class LightingColorFilter extends android.graphics.ColorFilter { ctor public LightingColorFilter(int, int); method public int getColorAdd(); method public int getColorMultiply(); method public void setColorAdd(int); method public void setColorMultiply(int); } public class LinearGradient extends android.graphics.Shader { Loading Loading @@ -9649,6 +9656,10 @@ package android.graphics { public class PorterDuffColorFilter extends android.graphics.ColorFilter { ctor public PorterDuffColorFilter(int, android.graphics.PorterDuff.Mode); method public int getColor(); method public android.graphics.PorterDuff.Mode getMode(); method public void setColor(int); method public void setMode(android.graphics.PorterDuff.Mode); } public class PorterDuffXfermode extends android.graphics.Xfermode { Loading Loading @@ -42441,11 +42452,11 @@ package java.util.concurrent { } public class ConcurrentHashMap extends java.util.AbstractMap implements java.util.concurrent.ConcurrentMap java.io.Serializable { ctor public ConcurrentHashMap(int, float, int); ctor public ConcurrentHashMap(int, float); ctor public ConcurrentHashMap(int); ctor public ConcurrentHashMap(); ctor public ConcurrentHashMap(int); ctor public ConcurrentHashMap(java.util.Map<? extends K, ? extends V>); ctor public ConcurrentHashMap(int, float); ctor public ConcurrentHashMap(int, float, int); method public boolean contains(java.lang.Object); method public java.util.Enumeration<V> elements(); method public java.util.Set<java.util.Map.Entry<K, V>> entrySet();
core/jni/android/graphics/ColorFilter.cpp +3 −3 Original line number Diff line number Diff line Loading @@ -33,10 +33,10 @@ using namespace uirenderer; class SkColorFilterGlue { public: static void finalizer(JNIEnv* env, jobject clazz, SkColorFilter* obj, SkiaColorFilter* f) { SkSafeUnref(obj); if (obj) SkSafeUnref(obj); // f == NULL when not !USE_OPENGL_RENDERER, so no need to delete outside the ifdef #ifdef USE_OPENGL_RENDERER if (android::uirenderer::Caches::hasInstance()) { if (f && android::uirenderer::Caches::hasInstance()) { android::uirenderer::Caches::getInstance().resourceCache.destructor(f); } else { delete f; Loading Loading @@ -112,7 +112,7 @@ public: }; static JNINativeMethod colorfilter_methods[] = { {"finalizer", "(II)V", (void*) SkColorFilterGlue::finalizer} {"destroyFilter", "(II)V", (void*) SkColorFilterGlue::finalizer} }; static JNINativeMethod porterduff_methods[] = { Loading
graphics/java/android/graphics/ColorFilter.java +11 −3 Original line number Diff line number Diff line Loading @@ -21,22 +21,30 @@ package android.graphics; /** * A color filter can be used with a {@link Paint} to modify the color of * each pixel drawn with that paint. This is an abstract class that should * never be used directly. */ public class ColorFilter { // Holds the pointer to the native SkColorFilter instance int native_instance; /** * Holds the pointer to the native SkiaColorFilter instance, from libhwui. * * @hide */ public int nativeColorFilter; @Override protected void finalize() throws Throwable { try { super.finalize(); } finally { finalizer(native_instance, nativeColorFilter); destroyFilter(native_instance, nativeColorFilter); } } private static native void finalizer(int native_instance, int nativeColorFilter); static native void destroyFilter(int native_instance, int nativeColorFilter); }
graphics/java/android/graphics/ColorMatrix.java +23 −20 Original line number Diff line number Diff line Loading @@ -18,23 +18,29 @@ package android.graphics; import android.util.FloatMath; import java.util.Arrays; /** * 5x4 matrix for transforming the color+alpha components of a Bitmap. * The matrix is stored in a single array, and its treated as follows: * <pre> * [ a, b, c, d, e, * f, g, h, i, j, * k, l, m, n, o, * p, q, r, s, t ] * </pre> * * When applied to a color [r, g, b, a], the resulting color is computed as * (after clamping) * When applied to a color <code>[r, g, b, a]</code>, the resulting color * is computed as (after clamping): * <pre> * R' = a*R + b*G + c*B + d*A + e; * G' = f*R + g*G + h*B + i*A + j; * B' = k*R + l*G + m*B + n*A + o; * A' = p*R + q*G + r*B + s*A + t; * </pre> */ @SuppressWarnings({ "MismatchedReadAndWriteOfArray", "PointlessArithmeticExpression" }) public class ColorMatrix { private final float[] mArray = new float[20]; /** Loading Loading @@ -66,17 +72,16 @@ public class ColorMatrix { /** * Set this colormatrix to identity: * <pre> * [ 1 0 0 0 0 - red vector * 0 1 0 0 0 - green vector * 0 0 1 0 0 - blue vector * 0 0 0 1 0 ] - alpha vector * </pre> */ public void reset() { final float[] a = mArray; for (int i = 19; i > 0; --i) { a[i] = 0; } Arrays.fill(a, 0); a[0] = a[6] = a[12] = a[18] = 1; } Loading Loading @@ -112,9 +117,9 @@ public class ColorMatrix { /** * Set the rotation on a color axis by the specified values. * axis=0 correspond to a rotation around the RED color * axis=1 correspond to a rotation around the GREEN color * axis=2 correspond to a rotation around the BLUE color * <code>axis=0</code> correspond to a rotation around the RED color * <code>axis=1</code> correspond to a rotation around the GREEN color * <code>axis=2</code> correspond to a rotation around the BLUE color */ public void setRotate(int axis, float degrees) { reset(); Loading Loading @@ -152,12 +157,10 @@ public class ColorMatrix { * matB to be the same colormatrix as this. */ public void setConcat(ColorMatrix matA, ColorMatrix matB) { float[] tmp = null; float[] tmp; if (matA == this || matB == this) { tmp = new float[20]; } else { } else { tmp = mArray; } Loading
graphics/java/android/graphics/ColorMatrixColorFilter.java +82 −8 Original line number Diff line number Diff line Loading @@ -16,7 +16,15 @@ package android.graphics; /** * A color filter that transforms colors through a 4x5 color matrix. This filter * can be used to change the saturation of pixels, convert from YUV to RGB, etc. * * @see ColorMatrix */ public class ColorMatrixColorFilter extends ColorFilter { private final ColorMatrix mMatrix = new ColorMatrix(); /** * Create a color filter that transforms colors through a 4x5 color matrix. * Loading @@ -25,15 +33,14 @@ public class ColorMatrixColorFilter extends ColorFilter { * is constructed will not be reflected in the filter. */ public ColorMatrixColorFilter(ColorMatrix matrix) { final float[] colorMatrix = matrix.getArray(); native_instance = nativeColorMatrixFilter(colorMatrix); nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix); mMatrix.set(matrix); update(); } /** * Create a color filter that transforms colors through a 4x5 color matrix. * * @param array array of floats used to transform colors, treated as a 4x5 * @param array Array of floats used to transform colors, treated as a 4x5 * matrix. The first 20 entries of the array are copied into * the filter. See ColorMatrix. */ Loading @@ -41,8 +48,75 @@ public class ColorMatrixColorFilter extends ColorFilter { if (array.length < 20) { throw new ArrayIndexOutOfBoundsException(); } native_instance = nativeColorMatrixFilter(array); nativeColorFilter = nColorMatrixFilter(native_instance, array); mMatrix.set(array); update(); } /** * Returns the {@link ColorMatrix} used by this filter. The returned * value is never null. Modifying the returned matrix does not have * any effect until you call {@link #setColorMatrix(ColorMatrix)}. * * @see #setColorMatrix(ColorMatrix) */ public ColorMatrix getColorMatrix() { return mMatrix; } /** * Specifies the color matrix used by this filter. If the specified * color matrix is null, this filter's color matrix will be reset to * the identity matrix. * * @param matrix A {@link ColorMatrix} or null * * @see #getColorMatrix() * @see android.graphics.ColorMatrix#reset() * @see #setColorMatrix(float[]) */ public void setColorMatrix(ColorMatrix matrix) { if (matrix == null) { mMatrix.reset(); } else if (matrix != mMatrix) { mMatrix.set(matrix); } update(); } /** * Specifies the color matrix used by this filter. If the specified * color matrix is null, this filter's color matrix will be reset to * the identity matrix. * * @param array Array of floats used to transform colors, treated as a 4x5 * matrix. The first 20 entries of the array are copied into * the filter. See {@link ColorMatrix}. * * @see #getColorMatrix() * @see android.graphics.ColorMatrix#reset() * @see #setColorMatrix(ColorMatrix) * * @throws ArrayIndexOutOfBoundsException if the specified array's * length is < 20 */ public void setColorMatrix(float[] array) { if (array == null) { mMatrix.reset(); } else { if (array.length < 20) { throw new ArrayIndexOutOfBoundsException(); } mMatrix.set(array); } update(); } private void update() { final float[] colorMatrix = mMatrix.getArray(); destroyFilter(native_instance, nativeColorFilter); native_instance = nativeColorMatrixFilter(colorMatrix); nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix); } private static native int nativeColorMatrixFilter(float[] array); Loading