Search in sources :

Example 96 with RectF

use of android.graphics.RectF in project Carbon by ZieIony.

the class FrameLayout method initCorners.

private void initCorners() {
    if (cornerRadius > 0) {
        cornerRadius = Math.min(cornerRadius, Math.min(getWidth(), getHeight()) / 2.0f);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setClipToOutline(true);
            setOutlineProvider(ShadowShape.viewOutlineProvider);
        } else {
            cornersMask = new Path();
            cornersMask.addRoundRect(new RectF(0, 0, getWidth(), getHeight()), cornerRadius, cornerRadius, Path.Direction.CW);
            cornersMask.setFillType(Path.FillType.INVERSE_WINDING);
        }
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }
}
Also used : Path(android.graphics.Path) RectF(android.graphics.RectF)

Example 97 with RectF

use of android.graphics.RectF in project Carbon by ZieIony.

the class RelativeLayout method initCorners.

private void initCorners() {
    if (cornerRadius > 0) {
        cornerRadius = Math.min(cornerRadius, Math.min(getWidth(), getHeight()) / 2.0f);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setClipToOutline(true);
            setOutlineProvider(ShadowShape.viewOutlineProvider);
        } else {
            cornersMask = new Path();
            cornersMask.addRoundRect(new RectF(0, 0, getWidth(), getHeight()), cornerRadius, cornerRadius, Path.Direction.CW);
            cornersMask.setFillType(Path.FillType.INVERSE_WINDING);
        }
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }
}
Also used : Path(android.graphics.Path) RectF(android.graphics.RectF)

Example 98 with RectF

use of android.graphics.RectF in project Carbon by ZieIony.

the class ImageView method setStroke.

@Override
public void setStroke(ColorStateList colorStateList) {
    stroke = colorStateList;
    if (stroke == null)
        return;
    if (strokePaint == null) {
        strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        strokePaint.setStyle(Paint.Style.STROKE);
        strokeRect = new RectF();
    }
}
Also used : RectF(android.graphics.RectF) Paint(android.graphics.Paint)

Example 99 with RectF

use of android.graphics.RectF in project Carbon by ZieIony.

the class GridLayout method initCorners.

private void initCorners() {
    if (cornerRadius > 0) {
        cornerRadius = Math.min(cornerRadius, Math.min(getWidth(), getHeight()) / 2.0f);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setClipToOutline(true);
            setOutlineProvider(ShadowShape.viewOutlineProvider);
        } else {
            cornersMask = new Path();
            cornersMask.addRoundRect(new RectF(0, 0, getWidth(), getHeight()), cornerRadius, cornerRadius, Path.Direction.CW);
            cornersMask.setFillType(Path.FillType.INVERSE_WINDING);
        }
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }
}
Also used : Path(android.graphics.Path) RectF(android.graphics.RectF)

Example 100 with RectF

use of android.graphics.RectF in project Carbon by ZieIony.

the class FlowLayout method initCorners.

private void initCorners() {
    if (cornerRadius > 0) {
        cornerRadius = Math.min(cornerRadius, Math.min(getWidth(), getHeight()) / 2.0f);
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            setClipToOutline(true);
            setOutlineProvider(ShadowShape.viewOutlineProvider);
        } else {
            cornersMask = new Path();
            cornersMask.addRoundRect(new RectF(0, 0, getWidth(), getHeight()), cornerRadius, cornerRadius, Path.Direction.CW);
            cornersMask.setFillType(Path.FillType.INVERSE_WINDING);
        }
    } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
            setOutlineProvider(ViewOutlineProvider.BOUNDS);
    }
}
Also used : Path(android.graphics.Path) RectF(android.graphics.RectF)

Aggregations

RectF (android.graphics.RectF)1216 Paint (android.graphics.Paint)437 Rect (android.graphics.Rect)176 Matrix (android.graphics.Matrix)150 Bitmap (android.graphics.Bitmap)148 Path (android.graphics.Path)140 Canvas (android.graphics.Canvas)134 Point (android.graphics.Point)78 ImageView (android.widget.ImageView)74 PorterDuffXfermode (android.graphics.PorterDuffXfermode)49 View (android.view.View)39 LinearGradient (android.graphics.LinearGradient)38 SuppressLint (android.annotation.SuppressLint)32 Drawable (android.graphics.drawable.Drawable)26 PointF (android.graphics.PointF)21 RadialGradient (android.graphics.RadialGradient)21 TextPaint (android.text.TextPaint)21 ArrayList (java.util.ArrayList)21 BitmapDrawable (android.graphics.drawable.BitmapDrawable)20 TypedArray (android.content.res.TypedArray)14