Android canvas: draw transparent circle on image

So finally I managed to do this. Firstly I draw a semitransparent black rectangle on whole view. After that using PorterDuff.Mode.CLEAR I cut a transparent circle to show cat’s position. I had problem with PorterDuff.Mode.CLEAR: firstly I was getting a black circle instead of a transparent one. Thanks to Romain Guy’s comments here: comment here … Read more

How do the pieces of Android’s (2D) Canvas drawing pipeline fit together?

Like Romain Guy said, “This question is difficult to answer on StackOverflow”. There wasn’t really any complete documentation, and complete documentation would be kind of large to include here. I ended up reading through the source and doing a bunch of experiments. I took notes along the way, and ended up turning them into a … Read more

Looking for an explanation of post/pre/set Translate (in Matrix object) and how to use them

The set-methods will replace the current Matrix with new values, disregarding whatever the Matrix contained before. The pre and post method will apply a new transformation before or after whatever the current Matrix contains. In this example, the rotation will be ignored since we are using the set method and the m will only contain … Read more

Android: How to detect when a scroll has ended

Here is how I solved the problem. Hope this helps. // declare class member variables private GestureDetector mGestureDetector; private OnTouchListener mGestureListener; private boolean mIsScrolling = false; public void initGestureDetection() { // Gesture detection mGestureDetector = new GestureDetector(new SimpleOnGestureListener() { @Override public boolean onDoubleTap(MotionEvent e) { handleDoubleTap(e); return true; } @Override public boolean onSingleTapConfirmed(MotionEvent e) { … Read more

How to draw circle by canvas in Android?

You can override the onDraw method of your view and draw the circle. protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawCircle(x, y, radius, paint); } For a better reference on drawing custom views check out the official Android documentation. http://developer.android.com/training/custom-views/custom-drawing.html

How to draw a filled triangle in android canvas?

Ok I’ve done it. I’m sharing this code in case someone else will need it: super.draw(canvas, mapView, true); Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); paint.setStrokeWidth(2); paint.setColor(android.graphics.Color.RED); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); Point point1_draw = new Point(); Point point2_draw = new Point(); Point point3_draw = new Point(); mapView.getProjection().toPixels(point1, point1_draw); mapView.getProjection().toPixels(point2, point2_draw); mapView.getProjection().toPixels(point3, point3_draw); Path path = new Path(); path.setFillType(Path.FillType.EVEN_ODD); path.moveTo(point1_draw.x,point1_draw.y); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)