Android RadialGradient - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android RadialGradient class.

This code example shows how to use the following methods:setLocalMatrix
            mPaint.setShader(mSweepGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);
 
            canvas.translate(-800.0f, 300.0f);
 
            mRadialGradient.setLocalMatrix(null);
            mPaint.setShader(mRadialGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);
             
            canvas.translate(400.0f, 000.0f);
             
            mRadialGradient.setLocalMatrix(mMatrix);
            mPaint.setShader(mRadialGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);
 
            canvas.translate(400.0f, 000.0f);
             
            mRadialGradient.setLocalMatrix(mMatrix2);
            mPaint.setShader(mRadialGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            int green = (int)(100 + Math.random() * 155);
            int blue = (int)(100 + Math.random() * 155);
            int color = 0xff000000 | red << 16 | green << 8 | blue;
            Paint paint = drawable.getPaint(); //new Paint(Paint.ANTI_ALIAS_FLAG);
            int darkColor = 0xff000000 | red/4 << 16 | green/4 << 8 | blue/4;
            RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
                    50f, color, darkColor, Shader.TileMode.CLAMP);
            paint.setShader(gradient);
            shapeHolder.setPaint(paint);
            balls.add(shapeHolder);
            return shapeHolder;
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            for (int i = 0; i < balls.size(); ++i) {
                ShapeHolder shapeHolder = balls.get(i);
                canvas.save();
                canvas.translate(shapeHolder.getX(), shapeHolder.getY());
                shapeHolder.getShape().draw(canvas);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLocalMatrix
            mPaint.setShader(mSweepGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);
 
            canvas.translate(-800.0f, 300.0f);
 
            mRadialGradient.setLocalMatrix(null);
            mPaint.setShader(mRadialGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);
             
            canvas.translate(400.0f, 000.0f);
             
            mRadialGradient.setLocalMatrix(mMatrix);
            mPaint.setShader(mRadialGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);
 
            canvas.translate(400.0f, 000.0f);
             
            mRadialGradient.setLocalMatrix(mMatrix2);
            mPaint.setShader(mRadialGradient);
            canvas.drawRect(0.0f, 0.0f, 200.0f, 200.0f, mPaint);

7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:
This code example shows how to use the following methods:
            int green = (int)(Math.random() * 255);
            int blue = (int)(Math.random() * 255);
            int color = 0xff000000 | red << 16 | green << 8 | blue;
            Paint paint = drawable.getPaint(); //new Paint(Paint.ANTI_ALIAS_FLAG);
            int darkColor = 0xff000000 | red/4 << 16 | green/4 << 8 | blue/4;
            RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
                    50f, color, darkColor, Shader.TileMode.CLAMP);
            paint.setShader(gradient);
            shapeHolder.setPaint(paint);
            return shapeHolder;
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            canvas.save();
            canvas.translate(ball.getX(), ball.getY());
            ball.getShape().draw(canvas);
            canvas.restore();
        } 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
        private final Paint mPaint;
 
        RadialGradientView(Context c) {
            super(c);
 
            RadialGradient gradient = new RadialGradient(0.0f, 0.0f, 100.0f, 0xff000000, 0xffffffff,
                    Shader.TileMode.MIRROR);
            mPaint = new Paint();
            mPaint.setShader(gradient);
        } 
 
        @Override 
        protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
            super.onMeasure(widthMeasureSpec, heightMeasureSpec);
            setMeasuredDimension(200, 200); 
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            int green = (int)(100 + Math.random() * 155);
            int blue = (int)(100 + Math.random() * 155);
            int color = 0xff000000 | red << 16 | green << 8 | blue;
            Paint paint = drawable.getPaint(); //new Paint(Paint.ANTI_ALIAS_FLAG);
            int darkColor = 0xff000000 | red/4 << 16 | green/4 << 8 | blue/4;
            RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
                    50f, color, darkColor, Shader.TileMode.CLAMP);
            paint.setShader(gradient);
            shapeHolder.setPaint(paint);
            balls.add(shapeHolder);
            return shapeHolder;
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            for (int i = 0; i < balls.size(); ++i) {
                ShapeHolder shapeHolder = balls.get(i);
                canvas.save();
                canvas.translate(shapeHolder.getX(), shapeHolder.getY());
                shapeHolder.getShape().draw(canvas);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            int green = (int)(100 + Math.random() * 155);
            int blue = (int)(100 + Math.random() * 155);
            int color = 0xff000000 | red << 16 | green << 8 | blue;
            Paint paint = drawable.getPaint();
            int darkColor = 0xff000000 | red/4 << 16 | green/4 << 8 | blue/4;
            RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
                    50f, color, darkColor, Shader.TileMode.CLAMP);
            paint.setShader(gradient);
            shapeHolder.setPaint(paint);
            balls.add(shapeHolder);
            return shapeHolder;
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            canvas.translate(ball.getX(), ball.getY());
            ball.getShape().draw(canvas);
        } 
 
        public void onAnimationUpdate(ValueAnimator animation) {
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
            int green = (int)(Math.random() * 255);
            int blue = (int)(Math.random() * 255);
            int color = 0xff000000 | red << 16 | green << 8 | blue;
            Paint paint = drawable.getPaint(); //new Paint(Paint.ANTI_ALIAS_FLAG);
            int darkColor = 0xff000000 | red/4 << 16 | green/4 << 8 | blue/4;
            RadialGradient gradient = new RadialGradient(37.5f, 12.5f,
                    50f, color, darkColor, Shader.TileMode.CLAMP);
            paint.setShader(gradient);
            shapeHolder.setPaint(paint);
            return shapeHolder;
        } 
 
        @Override 
        protected void onDraw(Canvas canvas) {
            canvas.save();
            canvas.translate(ball.getX(), ball.getY());
            ball.getShape().draw(canvas);
            canvas.restore();
        } 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Android RadialGradient Questions & Answers:

See Code Examples for Android RadialGradient Methods: