Java Code Examples for android.graphics.Paint#Style
The following examples show how to use
android.graphics.Paint#Style .
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: TitleLineGraphSeries.java From WiFiAnalyzer with GNU General Public License v3.0 | 6 votes |
@Override public void drawSelection(GraphView graphView, Canvas canvas, boolean b, DataPointInterface value) { double spanX = graphView.getViewport().getMaxX(false) - graphView.getViewport().getMinX(false); double spanXPixel = graphView.getGraphContentWidth(); double spanY = graphView.getViewport().getMaxY(false) - graphView.getViewport().getMinY(false); double spanYPixel = graphView.getGraphContentHeight(); double pointX = (value.getX() - graphView.getViewport().getMinX(false)) * spanXPixel / spanX; pointX += graphView.getGraphContentLeft(); double pointY = (value.getY() - graphView.getViewport().getMinY(false)) * spanYPixel / spanY; pointY = graphView.getGraphContentTop() + spanYPixel - pointY; // border canvas.drawCircle((float) pointX, (float) pointY, 30f, mSelectionPaint); // fill Paint.Style prevStyle = mPaint.getStyle(); mPaint.setStyle(Paint.Style.FILL); canvas.drawCircle((float) pointX, (float) pointY, 23f, mPaint); mPaint.setStyle(prevStyle); }
Example 2
Source File: DrawUtils.java From zone-sdk with MIT License | 5 votes |
public static Paint getStrokePaint(Paint.Style style) { Paint mPaint2 = new Paint(); mPaint2.setAntiAlias(true); mPaint2.setStyle(style); mPaint2.setStrokeWidth(3); return mPaint2; }
Example 3
Source File: Spans.java From Pioneer with Apache License 2.0 | 5 votes |
public ShapeSpan(Shape shape, Paint.Style style, int strokeWidth, @ColorInt int color, boolean includePad, CharacterStyle... styles) { super(styles); this.shape = shape; this.style = style; this.strokeWidth = strokeWidth; this.color = color; this.includePad = includePad; }
Example 4
Source File: CustomQuoteSpan.java From Android-WYSIWYG-Editor with Apache License 2.0 | 5 votes |
@Override public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, CharSequence text, int start, int end, boolean first, Layout layout) { Paint.Style style = p.getStyle(); int paintColor = p.getColor(); p.setStyle(Paint.Style.FILL); p.setColor(stripeColor); c.drawRect(x, top, x + dir * stripeWidth, bottom, p); p.setStyle(style); p.setColor(paintColor); }
Example 5
Source File: MarkDownBulletSpan.java From Markdown with MIT License | 5 votes |
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, CharSequence text, int start, int end, boolean first, Layout l) { if (((Spanned) text).getSpanStart(this) != start) { return; } int oldColor = p.getColor(); p.setColor(mBulletColor); if (mIndex != null) { c.drawText(mIndex, x + mMargin - GAP_WIDTH - 2 * BULLET_RADIUS, baseline, p); } else { float dy = (p.getFontMetricsInt().descent - p.getFontMetricsInt().ascent) * 0.5f + top; Paint.Style oldStyle = p.getStyle(); p.setStyle(mLevel == 1 ? Paint.Style.STROKE : Paint.Style.FILL); if (!c.isHardwareAccelerated()) { Path path = mLevel >= 2 ? RECT_BULLET_PATH : CIRCLE_BULLET_PATH; c.save(); c.translate(x + mMargin - GAP_WIDTH, dy); c.drawPath(path, p); c.restore(); } else { c.drawCircle(x + mMargin - GAP_WIDTH, dy, BULLET_RADIUS, p); } p.setStyle(oldStyle); } p.setColor(oldColor); }
Example 6
Source File: SpannableStringUtils.java From Android-UtilCode with Apache License 2.0 | 5 votes |
public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, CharSequence text, int start, int end, boolean first, Layout layout) { Paint.Style style = p.getStyle(); int color = p.getColor(); p.setStyle(Paint.Style.FILL); p.setColor(this.color); c.drawRect(x, top, x + dir * stripeWidth, bottom, p); p.setStyle(style); p.setColor(color); }
Example 7
Source File: AbstractPaintAssert.java From assertj-android with Apache License 2.0 | 5 votes |
public S hasStyle(Paint.Style style) { isNotNull(); Paint.Style actualStyle = actual.getStyle(); assertThat(actualStyle) // .overridingErrorMessage("Expected style <%s> but was <%s>.", style, actualStyle) // .isEqualTo(style); return myself; }
Example 8
Source File: SpansV1.java From Pioneer with Apache License 2.0 | 5 votes |
@Override public void draw(@NonNull Canvas canvas, CharSequence text, @IntRange(from = 0) int start, @IntRange(from = 0) int end, float x, int top, int y, int bottom, @NonNull Paint paint) { drawDebugLines(canvas, x, top, y, bottom, paint); float oldStrokeWidth = paint.getStrokeWidth(); Paint.Style oldStyle = paint.getStyle(); int oldColor = paint.getColor(); paint.setStrokeWidth(strokeWidth); paint.setStyle(style); paint.setColor(color); canvas.save(); canvas.translate(x + strokeWidth / 2, fontMetricsInt.ascent - fontMetricsInt.top + strokeWidth / 2); shape.draw(canvas, paint); canvas.restore(); paint.setColor(oldColor); paint.setStyle(oldStyle); paint.setStrokeWidth(oldStrokeWidth); int width = frame.width(); paint.setTextSize(paint.getTextSize() * 0.8f); if (drawText) { if (false) { paint.setTextAlign(Paint.Align.CENTER); canvas.drawText(text, start, end, frame.centerX(), y, paint); } else { canvas.drawText(text, start, end, x + (width * 0.2f) / 2, y, paint); } } }
Example 9
Source File: CustomQuoteSpan.java From Slide with GNU General Public License v3.0 | 5 votes |
@Override public void drawLeadingMargin(Canvas c, Paint p, int x, int dir, int top, int baseline, int bottom, CharSequence text, int start, int end, boolean first, Layout layout) { Paint.Style style = p.getStyle(); int paintColor = p.getColor(); p.setStyle(Paint.Style.FILL); p.setColor(stripeColor); c.drawRect(x, top, x + dir * stripeWidth, bottom, p); p.setStyle(style); p.setColor(paintColor); }
Example 10
Source File: RadarChartView.java From RadarChartView with Apache License 2.0 | 4 votes |
public final void setChartStyle(Paint.Style chartStyle) { this.chartStyle = chartStyle; invalidate(); }
Example 11
Source File: FabricView.java From FabricView with Apache License 2.0 | 4 votes |
/** * @return The drawing style. Can be Paint.Style.FILL, Paint.Style.STROKE, or Paint.Style.FILL_AND_STROKE. Default is Paint.Style.STROKE. */ public Paint.Style getStyle() { return mStyle; }
Example 12
Source File: Spans.java From Pioneer with Apache License 2.0 | 4 votes |
public TextSpan(Paint.Align align, Paint.Style style, float strokeWidth, CharacterStyle... styles) { super(styles); this.align = align; this.strokeWidth = strokeWidth; this.style = style; }
Example 13
Source File: SpansV1.java From Pioneer with Apache License 2.0 | 4 votes |
public ShapeSpan(Shape shape, @ColorInt int color, Paint.Style style, boolean drawText) { this.shape = shape; this.color = color; this.style = style; this.drawText = drawText; }
Example 14
Source File: ICandleDataSet.java From Stayfit with Apache License 2.0 | 2 votes |
/** * Returns paint style when open > close * * @return */ Paint.Style getDecreasingPaintStyle();
Example 15
Source File: CandleDataSet.java From StockChart-MPAndroidChart with MIT License | 2 votes |
/** * Sets paint style when open < close * * @param paintStyle */ public void setIncreasingPaintStyle(Paint.Style paintStyle) { this.mIncreasingPaintStyle = paintStyle; }
Example 16
Source File: BarDataSet.java From StockChart-MPAndroidChart with MIT License | 2 votes |
/** * Sets paint style when open > close * * @param decreasingPaintStyle */ public void setDecreasingPaintStyle(Paint.Style decreasingPaintStyle) { this.mDecreasingPaintStyle = decreasingPaintStyle; }
Example 17
Source File: CandleDataSet.java From NetKnight with Apache License 2.0 | 2 votes |
/** * Sets paint style when open > close * * @param decreasingPaintStyle */ public void setDecreasingPaintStyle(Paint.Style decreasingPaintStyle) { this.mDecreasingPaintStyle = decreasingPaintStyle; }
Example 18
Source File: RealmCandleDataSet.java From JNChartDemo with Apache License 2.0 | 2 votes |
/** * Sets paint style when open < close * * @param paintStyle */ public void setIncreasingPaintStyle(Paint.Style paintStyle) { this.mIncreasingPaintStyle = paintStyle; }
Example 19
Source File: LimitLine.java From NetKnight with Apache License 2.0 | 2 votes |
/** * Returns the color of the value-text that is drawn next to the LimitLine. * * @return */ public Paint.Style getTextStyle() { return mTextStyle; }
Example 20
Source File: ICandleDataSet.java From NetKnight with Apache License 2.0 | 2 votes |
/** * Returns paint style when open > close * * @return */ Paint.Style getDecreasingPaintStyle();