-
-
Save trfiladelfo/5396512 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void onDraw(Canvas canvas){ | |
super.onDraw(canvas); | |
// init shader | |
BitmapShader shader; | |
shader = new BitmapShader(originalBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); | |
// init paint | |
Paint paint = new Paint(); | |
paint.setAntiAlias(true); | |
paint.setShader(shader); | |
int circleCenter = width / 2; | |
// circleCenter is the x or y of the view's center | |
// radius is the radius in pixels of the cirle to be drawn | |
// paint contains the shader that will texture the shape | |
canvas.drawCircle(circleCenter, circleCenter, radus, paint); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment