android.graphics.PathDashPathEffect Java Examples
The following examples show how to use
android.graphics.PathDashPathEffect.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BorderTest.java From litho with Apache License 2.0 | 6 votes |
@Test public void testEffectSetting() { final ComponentContext c = new ComponentContext(getApplicationContext()); Border border = Border.create(c).dashEffect(new float[] {1f, 1f}, 0f).build(); assertThat(border.mPathEffect).isInstanceOf(DashPathEffect.class); border = Border.create(c).discreteEffect(1f, 0f).build(); assertThat(border.mPathEffect).isInstanceOf(DiscretePathEffect.class); border = Border.create(c) .pathDashEffect(new Path(), 0f, 0f, PathDashPathEffect.Style.ROTATE) .build(); assertThat(border.mPathEffect).isInstanceOf(PathDashPathEffect.class); border = Border.create(c).discreteEffect(1f, 1f).dashEffect(new float[] {1f, 2f}, 1f).build(); assertThat(border.mPathEffect).isInstanceOf(ComposePathEffect.class); }
Example #2
Source File: DashboardView.java From Android_UE with Apache License 2.0 | 6 votes |
@Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mRect = new RectF(getWidth() / 2 - RADIUS, PADDING, getWidth() / 2 + RADIUS, getHeight() - PADDING); // 刻度的数量 Path arcPath = new Path(); arcPath.addArc(mRect, START_ANAGLE, 360 - (START_ANAGLE - 45)); PathMeasure pathMeasure = new PathMeasure(arcPath, false); float pathMeasureLength = pathMeasure.getLength(); // 短刻度 mShortEffect = new PathDashPathEffect(mShortDash, (pathMeasureLength - Utils.dp2px(2)) / 50,// 每个间距为多少 0,// 第一个从什么地方开始 PathDashPathEffect.Style.ROTATE); // 长刻度 mLongEffect = new PathDashPathEffect(mLongDash, (pathMeasureLength - Utils.dp2px(2)) / 10,// 每个间距为多少 0,// 第一个从什么地方开始 PathDashPathEffect.Style.ROTATE); }
Example #3
Source File: BorderTest.java From litho with Apache License 2.0 | 5 votes |
@Test(expected = IllegalArgumentException.class) public void testTooManyEffectsThrows() { final ComponentContext c = new ComponentContext(getApplicationContext()); Border.create(c) .pathDashEffect(new Path(), 1f, 1f, PathDashPathEffect.Style.MORPH) .dashEffect(new float[] {1f, 2f}, 1f) .discreteEffect(1f, 2f) .build(); }
Example #4
Source File: HollowTextActivity.java From android-graphics-demo with Apache License 2.0 | 5 votes |
private PathEffect getTrianglePathEffect(int strokeWidth) { return new PathDashPathEffect( getTriangle(strokeWidth), strokeWidth, 0.0f, PathDashPathEffect.Style.ROTATE); }
Example #5
Source File: ChatHeadOverlayView.java From springy-heads with Apache License 2.0 | 4 votes |
/** * Will be called by animator * @param phase */ private void setPhase(float phase) { pathDashEffect = new PathDashPathEffect(makeDot(OVAL_RADIUS), STAMP_SPACING, phase, PathDashPathEffect.Style.ROTATE); invalidate(); }
Example #6
Source File: SafeDashPathEffect.java From OpenMapKitAndroid with BSD 3-Clause "New" or "Revised" License | 4 votes |
public SafeDashPathEffect(float[] intervals, float phase, float strokeWidth) { super(createSafeDashedPath(intervals, phase, strokeWidth, null), floatSum(intervals), phase, PathDashPathEffect.Style.MORPH); }
Example #7
Source File: Border.java From litho with Apache License 2.0 | 3 votes |
/** * Applies a path dash effect to the border * * <p>Specifying two effects will compose them where the first specified effect acts as the * outer effect and the second acts as the inner path effect, e.g. outer(inner(path)) * * @param shape The path to stamp along * @param advance The spacing between each stamp * @param phase Amount to offset before the first stamp * @param style How to transform the shape at each position */ public Builder pathDashEffect( Path shape, float advance, float phase, PathDashPathEffect.Style style) { checkNotBuilt(); checkEffectCount(); mPathEffects[mNumPathEffects++] = new PathDashPathEffect(shape, advance, phase, style); return this; }