I have a code from my game that do followed thing:
remove image from the screen by touch (only touched area, not all image).
and after finger move:
Paint pTouch; int X = 100; int Y = 100; Bitmap overlay; Canvas c2; Rect dest; pTouch = new Paint(Paint.ANTI_ALIAS_FLAG); pTouch.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT)); pTouch.setColor(Color.TRANSPARENT); pTouch.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL)); overlay = BitmapFactory.decodeResource(getResources(),R.drawable.wraith_spell).copy(Config.ARGB_8888, true); c2 = new Canvas(overlay); dest = new Rect(0, 0, getWidth(), getHeight()); Paint paint = new Paint(); paint.setFilterBitmap(true); ... @Override protected void onDraw(Canvas canvas) { ... c2.drawCircle(X, Y, 80, pTouch); canvas.drawBitmap(overlay, 0, 0, null); ... } @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: { X = (int) event.getX(); Y = (int) event.getY(); invalidate(); c2.drawCircle(X, Y, 80, pTouch); break; } } return true; } ...
Actually, what I do here is draw transparent layer upon the red Ball.
Does anybody knows how to implement the same in OpenGL ES 2D?
Any link, direction, snippets of code?
Thank you
Source: http://gamedev.stackexchange.com/questions/59535/image-remove-clear-effect-in-opengl-android
paul george Warm Bodies Mexico vs Jamaica Jiah Khan Teen Wolf linkedin linkedin
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.