public S hasStrokeCap(Paint.Cap cap) { isNotNull(); Paint.Cap actualCap = actual.getStrokeCap(); assertThat(actualCap) // .overridingErrorMessage("Expected stroke cap <%s> but was <%s>.", cap, actualCap) // .isEqualTo(cap); return myself; }
/** * Determine the minimum sweep angle that should be allowed for the current settings. If the * sweep is 360 a complete circle is drawn, if the sweep is 0 nothing is drawn. In some * states even if the data is say 0 out of 100 and mathematically the sweep angle is 0 we * want to draw a point anyway which is why this function exists * * @return minimum number of degrees allowed in the current state */ protected float getMinSweepAngle() { if (!mSeriesItem.showPointWhenEmpty()) { return MIN_SWEEP_ANGLE_NONE; } if (mSeriesItem.getChartStyle() == SeriesItem.ChartStyle.STYLE_PIE) { return MIN_SWEEP_ANGLE_PIE; } if (mPaint.getStrokeCap() == Paint.Cap.ROUND) { return MIN_SWEEP_ANGLE; } return MIN_SWEEP_ANGLE_FLAT; }
/** * Return the paint's Cap, controlling how the start and end of stroked * lines and paths are treated. * * @return the line cap style for the paint, used whenever the paint's * style is Stroke or StrokeAndFill. */ public Paint.Cap getStrokeCap() { return mPaint.getStrokeCap(); }
/** * Return the paint's Cap, controlling how the start and end of stroked * lines and paths are treated. * * @return the line cap style for the paint, used whenever the paint's * style is Stroke or StrokeAndFill. */ public Paint.Cap getStrokeCap() { return mPaint.getStrokeCap(); }
/** * Return the paint's Cap, controlling how the start and end of stroked * lines and paths are treated. * * @return the line cap style for the paint, used whenever the paint's * style is Stroke or StrokeAndFill. */ public Paint.Cap getStrokeCap() { return mPaint.getStrokeCap(); }
@Cap public int getProgressStrokeCap() { return (progressPaint.getStrokeCap() == Paint.Cap.ROUND) ? CAP_ROUND : CAP_BUTT; }
@Override public EndCap getEndCap() { switch(this.paint.getStrokeCap()) { case BUTT: return EndCap.BUTT; case SQUARE: return EndCap.SQUARE; case ROUND: return EndCap.ROUND; default: throw new IllegalStateException(); } }
/** * Set the paint's Cap. * * @param cap set the paint's line cap style, used whenever the paint's * style is Stroke or StrokeAndFill. */ public void setStrokeCap(Paint.Cap cap) { if (mPaint.getStrokeCap() == cap) return; mPaint.setStrokeCap(cap); invalidateSelf(); }
public void setProgressStrokeCap(@Cap int cap) { Paint.Cap paintCap = (cap == CAP_ROUND) ? Paint.Cap.ROUND : Paint.Cap.BUTT; if (progressPaint.getStrokeCap() != paintCap) { progressPaint.setStrokeCap(paintCap); invalidate(); } }
/** * Set the paint's Cap. * * @param cap set the paint's line cap style, used whenever the paint's * style is Stroke or StrokeAndFill. */ public void setStrokeCap(Paint.Cap cap) { if (mPaint.getStrokeCap() == cap) return; mPaint.setStrokeCap(cap); invalidateSelf(); }
/** * Set the paint's Cap. * * @param cap set the paint's line cap style, used whenever the paint's * style is Stroke or StrokeAndFill. */ public void setStrokeCap(Paint.Cap cap) { if (mPaint.getStrokeCap() == cap) return; mPaint.setStrokeCap(cap); if (mProvider != null) invalidateSelf(); }
public S hasStrokeCap(Paint.Cap cap) { isNotNull(); Paint.Cap actualCap = actual.getStrokeCap(); assertThat(actualCap) // .overridingErrorMessage("Expected stroke cap <%s> but was <%s>.", cap, actualCap) // .isEqualTo(cap); return myself; }
private void changePaintColor(int color) { Paint drawPaint = BaseTool.BITMAP_PAINT; float strokeWidth = drawPaint.getStrokeWidth(); Paint.Cap strokeCap = drawPaint.getStrokeCap(); canvasPaint.reset(); canvasPaint.setStyle(Paint.Style.STROKE); canvasPaint.setStrokeWidth(strokeWidth); canvasPaint.setStrokeCap(strokeCap); canvasPaint.setAntiAlias(true); if (Color.alpha(color) == 0x00) { canvasPaint.setShader(checkeredPattern.getShader()); canvasPaint.setColor(Color.BLACK); } else { canvasPaint.setColor(color); } }
public void setCurrentPaint(Paint currentPaint) { if (currentPaint.getStrokeCap() == Cap.ROUND) { buttonCircle.setSelected(true); buttonRect.setSelected(false); } else { buttonCircle.setSelected(false); buttonRect.setSelected(true); } brushWidthSeekBar.setProgress((int) currentPaint.getStrokeWidth()); brushSizeText.setText(String.format(Locale.getDefault(), "%d", (int) currentPaint.getStrokeWidth())); }
public ToolPropertiesInteraction checkCap(Cap expectedCap) { Paint strokePaint = PaintroidApplication.currentTool.getDrawPaint(); assertEquals(expectedCap, strokePaint.getStrokeCap()); return this; }
public static void assertPaintEquals(String message, Paint expectedPaint, Paint actualPaint) { assertEquals(message, expectedPaint.getColor(), actualPaint.getColor()); assertEquals(message, expectedPaint.getStrokeCap(), actualPaint.getStrokeCap()); assertEquals(message, expectedPaint.getStrokeWidth(), actualPaint.getStrokeWidth(), Float.MIN_VALUE); }
@UiThreadTest @Test public void testShouldReturnPaint() { toolToTest.setDrawPaint(paint); Paint drawPaint = BaseTool.BITMAP_PAINT; assertEquals(paint.getColor(), drawPaint.getColor()); assertEquals(paint.getStrokeWidth(), drawPaint.getStrokeWidth(), Double.MIN_VALUE); assertEquals(paint.getStrokeCap(), drawPaint.getStrokeCap()); assertEquals(paint.getShader(), drawPaint.getShader()); }
private void assertStrokePaint(Paint strokePaint, int expectedStrokeWidth, Cap expectedCap) { int paintStrokeWidth = (int) strokePaint.getStrokeWidth(); Cap paintCap = strokePaint.getStrokeCap(); assertEquals("Stroke did not change", expectedStrokeWidth, paintStrokeWidth); assertEquals("Stroke cap not " + expectedCap.toString(), expectedCap, paintCap); }
@UiThreadTest @Test public void testShouldChangePaintFromBrushPicker() { toolToTest.setupToolOptions(); toolToTest.setDrawPaint(this.paint); BrushPickerView brushPicker = toolToTest.brushPickerView; List<BrushPickerView.OnBrushChangedListener> brushPickerListener = brushPicker.brushChangedListener; for (BrushPickerView.OnBrushChangedListener onBrushChangedListener : brushPickerListener) { onBrushChangedListener.setCap(Paint.Cap.ROUND); onBrushChangedListener.setStroke(15); assertEquals(Paint.Cap.ROUND, toolToTest.getDrawPaint().getStrokeCap()); assertEquals(15f, toolToTest.getDrawPaint().getStrokeWidth(), Double.MIN_VALUE); } }
@Test public void testChangeLineToolForm() throws NoSuchFieldException, IllegalAccessException { PointF pointOnSurface = getSurfacePointFromScreenPoint(pointOnScreenMiddle); PointF pointOnCanvas = PaintroidApplication.perspective.getCanvasPointFromSurfacePoint(pointOnSurface); int currentColor = PaintroidApplication.drawingSurface.getPixel(pointOnCanvas); assertEquals("Color before doing anything has to be transparent", Color.TRANSPARENT, currentColor); openToolOptionsForCurrentTool(); onView(withId(R.id.pocketpaint_stroke_ibtn_rect)).perform(click()); Paint strokePaint = getCurrentToolPaint(); int paintStrokeWidth = (int) strokePaint.getStrokeWidth(); assertEquals("Paint width not changed after tool options changes", DEFAULT_STROKE_WIDTH, paintStrokeWidth); assertEquals("Wrong line form", Cap.SQUARE, strokePaint.getStrokeCap()); // Close tool options clickSelectedToolButton(); } }