I’m wondering actually one thing about Paint class in Android. I was looking the code of FingerPaint example in Android SDK Demos and I’m curious is there any way to set a custom style for mPaint which they are using there. I mean to create something like new brushes which user can use to draw something.
mPaint = new Paint();
mPaint.setAntiAlias(true);
mPaint.setDither(true);
mPaint.setColor(0xFFFF0000);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(12);
Or maybe it’s not calling style, not really sure but I didn’t find anything useful over the internet about this question, so that’s why I’m asking it here.
I’ll be really happy if someone can give me suggestions/advices and information if it’s possible and how can I do that.
Thanks in advance!
it is possible to achieve what you want by using BitmapShaders. So you need a small Bitmap which acts as a mask containing the small lines and dots which make up the Brush. Use Shader.TileMode.REPEAT or MIRROR. To change the color of the brush you apply ColorFilter to the Paint with setColorFilter.