Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 514d4aaf authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Update supported Drawable tinting modes and docs"

parents b06cb887 2f8ba8f7
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -10632,6 +10632,7 @@ package android.graphics.drawable {
    method public void setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode);
    method public final void setTileModeY(android.graphics.Shader.TileMode);
    method public void setTint(android.content.res.ColorStateList);
    method public void setTintMode(android.graphics.PorterDuff.Mode);
  }
  public class ClipDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
@@ -10909,6 +10910,7 @@ package android.graphics.drawable {
    method public void setTargetDensity(android.util.DisplayMetrics);
    method public void setTargetDensity(int);
    method public void setTint(android.content.res.ColorStateList);
    method public void setTintMode(android.graphics.PorterDuff.Mode);
  }
  public class PaintDrawable extends android.graphics.drawable.ShapeDrawable {
@@ -10999,6 +11001,9 @@ package android.graphics.drawable {
  public class TouchFeedbackDrawable extends android.graphics.drawable.LayerDrawable {
    method public android.graphics.Rect getDirtyBounds();
    method public android.content.res.ColorStateList getTint();
    method public void setTint(android.content.res.ColorStateList);
    method public void setTintMode(android.graphics.PorterDuff.Mode);
  }
  public class TransitionDrawable extends android.graphics.drawable.LayerDrawable implements android.graphics.drawable.Drawable.Callback {
+16 −7
Original line number Diff line number Diff line
@@ -4409,14 +4409,23 @@
        <!-- When a tint color is set, specifies its Porter-Duff blending mode. The
             default value is src_in, which treats the drawable as an alpha mask. -->
        <attr name="tintMode">
            <!-- [Sa * Da, Sc * Da] -->
            <enum name="src_in" value="0" />
            <!-- [Da, Sc * Da + (1 - Sa) * Dc] -->
            <enum name="src_atop" value="1" />
            <!-- [Sa * Da, Sc * Dc] -->
            <enum name="multiply" value="2" />
            <!-- The tint is drawn on top of the drawable.
                 [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] -->
            <enum name="src_over" value="3" />
            <!-- The tint is masked by the alpha channel of the drawable. The drawable’s
                 color channels are thrown out. [Sa * Da, Sc * Da] -->
            <enum name="src_in" value="5" />
            <!-- The tint is drawn above the drawable, but with the drawable’s alpha
                 channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] -->
            <enum name="src_atop" value="9" />
            <!-- Multiplies the color and alpha channels of the drawable with those of
                 the tint. [Sa * Da, Sc * Dc] -->
            <enum name="multiply" value="14" />
            <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] -->
            <enum name="screen" value="3" />
            <enum name="screen" value="15" />
            <!-- Combines the tint and drawable color and alpha channels, clamping the
                 result to valid color values. Saturate(S + D) -->
            <enum name="add" value="16" />
        </attr>
    </declare-styleable>

+1 −5
Original line number Diff line number Diff line
@@ -595,7 +595,6 @@ public class BitmapDrawable extends Drawable {
     * Specifies the blending mode used to apply tint.
     *
     * @param tintMode A Porter-Duff blending mode
     * @hide Pending finalization of supported Modes
     */
    public void setTintMode(Mode tintMode) {
        if (mBitmapState.mTintMode != tintMode) {
@@ -606,10 +605,7 @@ public class BitmapDrawable extends Drawable {
    }

    /**
     * Returns the tint mode for this drawable, or {@code null} if none set.
     *
     * @return the tint mode for this drawable, or {@code null} if none set
     * @hide
     * @hide only needed by a hack within ProgressBar
     */
    public Mode getTintMode() {
        return mBitmapState.mTintMode;
+7 −9
Original line number Diff line number Diff line
@@ -1248,16 +1248,14 @@ public abstract class Drawable {
     */
    static PorterDuff.Mode parseTintMode(int value, Mode defaultMode) {
        switch (value) {
            case 0:
                return Mode.SRC_IN;
            case 1:
                return Mode.SRC_ATOP;
            case 2:
                return Mode.MULTIPLY;
            case 3:
                return Mode.SCREEN;
        }
        return defaultMode;
            case 3: return Mode.SRC_OVER;
            case 5: return Mode.SRC_IN;
            case 9: return Mode.SRC_ATOP;
            case 14: return Mode.MULTIPLY;
            case 15: return Mode.SCREEN;
            case 16: return Mode.ADD;
            default: return defaultMode;
        }
    }
}
+0 −1
Original line number Diff line number Diff line
@@ -345,7 +345,6 @@ public class NinePatchDrawable extends Drawable {
     * Specifies the blending mode used to apply tint.
     *
     * @param tintMode A Porter-Duff blending mode
     * @hide Pending finalization of supported Modes
     */
    public void setTintMode(Mode tintMode) {
        if (mNinePatchState.mTintMode != tintMode) {
Loading