am 548b9294: am 8738c8db: Merge "Bring back the fillAlpha and strokeAlpha." into lmp-dev

* commit '548b92941c8cea5c3aa125c0fe6ea69748c18591':
  Bring back the fillAlpha and strokeAlpha.
This commit is contained in:
ztenghui
2014-09-11 18:30:30 +00:00
committed by Android Git Automerger
8 changed files with 66 additions and 39 deletions

View File

@@ -588,6 +588,7 @@ package android {
field public static final int fastScrollThumbDrawable = 16843574; // 0x1010336
field public static final int fastScrollTrackDrawable = 16843577; // 0x1010339
field public static final int fillAfter = 16843197; // 0x10101bd
field public static final int fillAlpha = 16843981; // 0x10104cd
field public static final int fillBefore = 16843196; // 0x10101bc
field public static final int fillColor = 16843806; // 0x101041e
field public static final int fillEnabled = 16843343; // 0x101024f
@@ -1203,6 +1204,7 @@ package android {
field public static final int streamType = 16843273; // 0x1010209
field public static final int stretchColumns = 16843081; // 0x1010149
field public static final int stretchMode = 16843030; // 0x1010116
field public static final int strokeAlpha = 16843980; // 0x10104cc
field public static final int strokeColor = 16843808; // 0x1010420
field public static final int strokeLineCap = 16843813; // 0x1010425
field public static final int strokeLineJoin = 16843814; // 0x1010426

View File

@@ -20,11 +20,13 @@ Copyright (C) 2014 The Android Open Source Project
android:viewportHeight="64.0">
<path
android:fillColor="#33000000"
android:pathData="M49.062,50.0m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"/>
android:fillColor="#FF000000"
android:pathData="M49.062,50.0m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"
android:fillAlpha="0.2"/>
<path
android:fillColor="#33000000"
android:pathData="M49.0,49.5m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"/>
android:fillColor="#FF000000"
android:pathData="M49.0,49.5m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"
android:fillAlpha="0.2"/>
<path
android:pathData="M49.0,49.0m-14.0,0.0a14.0,14.0 0.0,1.0 1.0,28.0 0.0a14.0,14.0 0.0,1.0 1.0,-28.0 0.0"
android:fillColor="#FF5722"/>

View File

@@ -26,11 +26,11 @@
android:translateY="5" >
<group android:name="v21_pivot" >
<group
android:name="rectangle_path_1_position"
android:alpha="0.1" >
android:name="rectangle_path_1_position">
<path
android:name="rectangle_path_1"
android:fillColor="?attr/colorControlActivated"
android:fillAlpha="0.1"
android:pathData="M -180.0 -1.0 l 360 0 l 0 2 l -360 0 Z" />
</group>
<group

View File

@@ -5286,8 +5286,6 @@
<attr name="scaleX" />
<!-- The amount to scale the group on X coordinate -->
<attr name="scaleY" />
<!-- The alpha of the group (0 is transparent and 1 is opaque) -->
<attr name="alpha" />
</declare-styleable>
<!-- Defines the path used in VectorDrawables. -->
@@ -5298,8 +5296,14 @@
<attr name="strokeWidth" format="float" />
<!-- The color to stroke the path if not defined implies no stroke-->
<attr name="strokeColor" format="color" />
<!-- The opacity of a path stroke, as a value between 0 (completely transparent)
and 1 (completely opaque) -->
<attr name="strokeAlpha" format="float" />
<!-- The color to fill the path if not defined implies no fill-->
<attr name="fillColor" format="color" />
<!-- The alpha of the path fill, as a value between 0 (completely transparent)
and 1 (completely opaque)-->
<attr name="fillAlpha" format="float" />
<!-- The specification of the operations that define the path -->
<attr name="pathData" format="string" />
<!-- The fraction of the path to trim from the start from 0 to 1 -->

View File

@@ -2291,6 +2291,8 @@
<public type="attr" name="fragmentAllowEnterTransitionOverlap" />
<public type="attr" name="fragmentAllowReturnTransitionOverlap" />
<public type="attr" name="patternPathData" />
<public type="attr" name="strokeAlpha" />
<public type="attr" name="fillAlpha" />
<public-padding type="dimen" name="l_resource_pad" end="0x01050010" />

View File

@@ -104,8 +104,6 @@ import java.util.Stack;
* <dt><code>android:translateY</code></dt>
* <dd>The amount of translation on the Y coordinate.
* This is defined in the viewport space.</dd>
* <dt><code>android:alpha</code></dt>
* <dd>The amount of transparency.</dd>
* </dl></dd>
* </dl>
*
@@ -124,6 +122,10 @@ import java.util.Stack;
* <dd>Defines the color to draw the path outline (none if not present).</dd>
* <dt><code>android:strokeWidth</code></dt>
* <dd>The width a path stroke.</dd>
* <dt><code>android:strokeAlpha</code></dt>
* <dd>The opacity of a path stroke.</dd>
* <dt><code>android:fillAlpha</code></dt>
* <dd>The opacity to fill the path with.</dd>
* <dt><code>android:trimPathStart</code></dt>
* <dd>The fraction of the path to trim from the start, in the range from 0 to 1.</dd>
* <dt><code>android:trimPathEnd</code></dt>
@@ -825,7 +827,7 @@ public class VectorDrawable extends Drawable {
}
private void drawGroupTree(VGroup currentGroup, Matrix currentMatrix,
float currentAlpha, Canvas canvas, int w, int h) {
Canvas canvas, int w, int h) {
// Calculate current group's matrix by preConcat the parent's and
// and the current one on the top of the stack.
// Basically the Mfinal = Mviewport * M0 * M1 * M2;
@@ -834,30 +836,26 @@ public class VectorDrawable extends Drawable {
currentGroup.mStackedMatrix.preConcat(currentGroup.mLocalMatrix);
float stackedAlpha = currentAlpha * currentGroup.mGroupAlpha;
// Draw the group tree in the same order as the XML file.
for (int i = 0; i < currentGroup.mChildren.size(); i++) {
Object child = currentGroup.mChildren.get(i);
if (child instanceof VGroup) {
VGroup childGroup = (VGroup) child;
drawGroupTree(childGroup, currentGroup.mStackedMatrix,
stackedAlpha, canvas, w, h);
canvas, w, h);
} else if (child instanceof VPath) {
VPath childPath = (VPath) child;
drawPath(currentGroup, childPath, stackedAlpha, canvas, w, h);
drawPath(currentGroup, childPath, canvas, w, h);
}
}
}
public void draw(Canvas canvas, int w, int h) {
// Travese the tree in pre-order to draw.
drawGroupTree(mRootGroup, IDENTITY_MATRIX, ((float) mRootAlpha) / 0xFF,
canvas, w, h);
drawGroupTree(mRootGroup, IDENTITY_MATRIX, canvas, w, h);
}
private void drawPath(VGroup vGroup, VPath vPath, float stackedAlpha,
Canvas canvas, int w, int h) {
private void drawPath(VGroup vGroup, VPath vPath, Canvas canvas, int w, int h) {
final float scaleX = w / mViewportWidth;
final float scaleY = h / mViewportHeight;
final float minScale = Math.min(scaleX, scaleY);
@@ -905,7 +903,8 @@ public class VectorDrawable extends Drawable {
mFillPaint.setStyle(Paint.Style.FILL);
mFillPaint.setAntiAlias(true);
}
mFillPaint.setColor(applyAlpha(fullPath.mFillColor, stackedAlpha));
mFillPaint.setColor(applyAlpha(fullPath.mFillColor,
fullPath.mFillAlpha));
canvas.drawPath(mRenderPath, mFillPaint);
}
@@ -928,7 +927,8 @@ public class VectorDrawable extends Drawable {
strokePaint.setStrokeMiter(fullPath.mStrokeMiterlimit);
strokePaint.setColor(applyAlpha(fullPath.mStrokeColor, stackedAlpha));
strokePaint.setColor(applyAlpha(fullPath.mStrokeColor,
fullPath.mStrokeAlpha));
strokePaint.setStrokeWidth(fullPath.mStrokeWidth * minScale);
canvas.drawPath(mRenderPath, strokePaint);
}
@@ -952,7 +952,6 @@ public class VectorDrawable extends Drawable {
private float mScaleY = 1;
private float mTranslateX = 0;
private float mTranslateY = 0;
private float mGroupAlpha = 1;
// mLocalMatrix is updated based on the update of transformation information,
// either parsed from the XML or by animation.
@@ -969,7 +968,6 @@ public class VectorDrawable extends Drawable {
mScaleY = copy.mScaleY;
mTranslateX = copy.mTranslateX;
mTranslateY = copy.mTranslateY;
mGroupAlpha = copy.mGroupAlpha;
mThemeAttrs = copy.mThemeAttrs;
mGroupName = copy.mGroupName;
mChangingConfigurations = copy.mChangingConfigurations;
@@ -1038,7 +1036,6 @@ public class VectorDrawable extends Drawable {
mScaleY = a.getFloat(R.styleable.VectorDrawableGroup_scaleY, mScaleY);
mTranslateX = a.getFloat(R.styleable.VectorDrawableGroup_translateX, mTranslateX);
mTranslateY = a.getFloat(R.styleable.VectorDrawableGroup_translateY, mTranslateY);
mGroupAlpha = a.getFloat(R.styleable.VectorDrawableGroup_alpha, mGroupAlpha);
final String groupName = a.getString(R.styleable.VectorDrawableGroup_name);
if (groupName != null) {
@@ -1160,18 +1157,6 @@ public class VectorDrawable extends Drawable {
updateLocalMatrix();
}
}
@SuppressWarnings("unused")
public float getAlpha() {
return mGroupAlpha;
}
@SuppressWarnings("unused")
public void setAlpha(float groupAlpha) {
if (groupAlpha != mGroupAlpha) {
mGroupAlpha = groupAlpha;
}
}
}
/**
@@ -1275,8 +1260,11 @@ public class VectorDrawable extends Drawable {
int mStrokeColor = Color.TRANSPARENT;
float mStrokeWidth = 0;
int mFillColor = Color.TRANSPARENT;
float mStrokeAlpha = 1.0f;
int mFillRule;
float mFillAlpha = 1.0f;
float mTrimPathStart = 0;
float mTrimPathEnd = 1;
float mTrimPathOffset = 0;
@@ -1295,8 +1283,10 @@ public class VectorDrawable extends Drawable {
mStrokeColor = copy.mStrokeColor;
mStrokeWidth = copy.mStrokeWidth;
mStrokeAlpha = copy.mStrokeAlpha;
mFillColor = copy.mFillColor;
mFillRule = copy.mFillRule;
mFillAlpha = copy.mFillAlpha;
mTrimPathStart = copy.mTrimPathStart;
mTrimPathEnd = copy.mTrimPathEnd;
mTrimPathOffset = copy.mTrimPathOffset;
@@ -1357,6 +1347,8 @@ public class VectorDrawable extends Drawable {
mFillColor = a.getColor(R.styleable.VectorDrawablePath_fillColor,
mFillColor);
mFillAlpha = a.getFloat(R.styleable.VectorDrawablePath_fillAlpha,
mFillAlpha);
mStrokeLineCap = getStrokeLineCap(a.getInt(
R.styleable.VectorDrawablePath_strokeLineCap, -1), mStrokeLineCap);
mStrokeLineJoin = getStrokeLineJoin(a.getInt(
@@ -1365,6 +1357,8 @@ public class VectorDrawable extends Drawable {
R.styleable.VectorDrawablePath_strokeMiterLimit, mStrokeMiterlimit);
mStrokeColor = a.getColor(R.styleable.VectorDrawablePath_strokeColor,
mStrokeColor);
mStrokeAlpha = a.getFloat(R.styleable.VectorDrawablePath_strokeAlpha,
mStrokeAlpha);
mStrokeWidth = a.getFloat(R.styleable.VectorDrawablePath_strokeWidth,
mStrokeWidth);
mTrimPathEnd = a.getFloat(R.styleable.VectorDrawablePath_trimPathEnd,
@@ -1408,6 +1402,16 @@ public class VectorDrawable extends Drawable {
mStrokeWidth = strokeWidth;
}
@SuppressWarnings("unused")
float getstrokeAlpha() {
return mStrokeAlpha;
}
@SuppressWarnings("unused")
void setstrokeAlpha(float strokeAlpha) {
mStrokeAlpha = strokeAlpha;
}
@SuppressWarnings("unused")
int getFill() {
return mFillColor;
@@ -1418,6 +1422,16 @@ public class VectorDrawable extends Drawable {
mFillColor = fillColor;
}
@SuppressWarnings("unused")
float getfillAlpha() {
return mFillAlpha;
}
@SuppressWarnings("unused")
void setfillAlpha(float fillAlpha) {
mFillAlpha = fillAlpha;
}
@SuppressWarnings("unused")
float getTrimPathStart() {
return mTrimPathStart;

View File

@@ -28,7 +28,8 @@
l-5.046875,0.0 0.0-1.0Z" />
<path
android:name="two"
android:fillColor="#00ffff00"
android:fillColor="#ffff00"
android:fillAlpha="0"
android:pathData="M 2.534375,9.6875l 4.140625,0.0 0.0,1.0-5.5625,0.0 0.0-1.0q 0.671875-0.6875 1.828125-1.859375
q 1.1718752-1.1875 1.4687502-1.53125 0.578125-0.625 0.796875-1.0625
q 0.234375-0.453125 0.234375-0.875 0.0-0.703125-0.5-1.140625

View File

@@ -21,10 +21,12 @@ limitations under the License.
<group>
<path
android:fillColor="#E6000000"
android:fillColor="#FF000000"
android:fillAlpha="0.9"
android:pathData="M11.994999,2.0C6.4679985,2.0 2.0,6.4780006 2.0,12.0s4.468,10.0 9.995,10.0S22.0,17.522 22.0,12.0S17.521,2.0 11.994999,2.0zM12.0,20.0c-4.42,0.0 -8.0,-3.582 -8.0,-8.0s3.58,-8.0 8.0,-8.0s8.0,3.582 8.0,8.0S16.419998,20.0 12.0,20.0z" />
<path
android:fillColor="#E6000000"
android:fillColor="#FF000000"
android:fillAlpha="0.9"
android:pathData="M12.5,6.0l-1.5,0.0 0.0,7.0 5.3029995,3.1819992 0.75,-1.249999 -4.5529995,-2.7320004z" />
</group>