Android finger paint - android

I m developing an application to paint the the canvas using finger stroke with the help of FingerPaint application given at the site Here one of the recently drawn color overlap the color previously drawn at same palce. Is there any way to limit one or two color that doesn't get overlapped by other In other words if i had drawn red(or any that user wants) color on canvas then none of the color should hide this it will show ever n ever.Let me know if the problem is not clear to you
thanks in advance,..

If you are using a GLSurface you can use the normal method of GL pixel manipulation - in particular, getPixels(). There are many ways to have fun with pixels in GL - you can add blending, scaling, etc and even convert the existing canvas into a texture on a model in the scene.
If you are not using a GLSurface... someone else will need to help. :)

Related

Android OpenGL ES - ingame scoreboard

I am currently working on an Android OpenGL ES 2.0 2D game and I need to implement scrolling scoreboard, something like this:
but when there are so many players they overflow from the specified region (white). When I implement scrolling (using Matrix translation), the same problem happens on top of the list. Anyone can help me?
One approach is to use the scissor test to limit where drawing occurs. Set the scissor with glScissor(), enable it with glEnable(GL_SCISSOR_TEST), draw the text, and disable it with glDisable(GL_SCISSOR_TEST).
Note the scissor is specified in window coordinates.
Another approach would be to arrange the drawing such that the blue border is drawn on top of the text, either by setting the depth or drawing it last. (This assumes you're not drawing it with glClear().)

canvas drawing issue where paint needs to be restricted by black sketch

I need to create the painting application for the kids where kid can colour inside the black bordered sketch of any image
But, I am struck with the problem,that colouring can come outside the black bordering of the image...which i don't want to.Please guys help me to find out how to restrict the colouring by user within the black border of sketch
Also, I want that no colour should cover the black border.it should be inside the border.
I can post my code if required.
Look at Canvas clipPath and use the clipping built in to android to limit the 'coloring' of the kid/user to the regions you specify. You can then draw your objects as layers, kid/user colored layer on bottom, your sketch on top.
Finally..i have implemented it using mask bitmap and right usage of Portet.Duff mode

Draw on imageview image in android?

Fellow Programmers,
I am new to android and I am trying to draw on a image based on giving the x and y axis of the image as the input.So that he pixel value corresponding to the coordinate gets filled with a color that I mention. Say Red color for now.
User Story: Render a image through image view and on a button click I need to pass the co-ordinate value for the image that represents the pixel of the image and fill it with red color. Keep on doing it looks like drawing on the image that I render using image view.
Is this user story is possible to do in Android? If then help me on this. I referred the draw class and canvas class and not sure how to implement.
Looking forward to ur help on developing this user story on android application.
Best,
Googler
Take a blank canvas.
Draw your image on the canvas.
Draw points on the canvas by specifying x and y co-ordinates and red color in paint.

Android: Custom masking 2 bitmaps layered one above the other

easy now.
What I want eventually:
I want to have 2 bitmaps overlayed on a view. Same bitmaps with the one above have higher brightness than the below one.
Now when the user strokes(with touch event (like paint brush)) on the upper bitmap, I want those parts of the upper bitmap to go invisible.
For those who are familiar with adobe photoshop perhaps this will make more sense:
I want to draw a mask on an image being display so that only the unmasked parts remain visible. But the mask can be drawn from a brush with variable hardness/size.
How do I achieve this functionality? Direct me in in the line where I should research or give sample code.
Also, is it possible to draw strokes on an imageview with a brush which has variable hardness? I know that I can drawPath and drawArc on a canvas, but I do not know how to achieve the different brush strokes/styles.
Please pardon me if I haven't phrased my question right, or wasn't able to find similar duplicates.
You can use FrameLayout to overlay one image over other in Android and for Custom Masking search FingerPaint on google.
I think the best way is to do your own off-screen compositing, then render the composited image using an ImageView or perhaps a subclass with custom interaction. See this sample code for an example of how to do such compositing using the Porter-Duff transfer modes.

On an android Canvas, how do I draw overlapping shapes with non-interacting alphas?

On an android Canvas, if I draw a circle with alpha 0xCC and color Color.RED and then draw another circle which partially overlaps the first circle with the same parameters, I'll end up with a venn diagram.
Here is a random example I found (just ignore the [Text] in there). I want to draw overlapping circles like in this diagram, but I don't want the center to be darker, but I do want the whole thing to have alpha so that the map underneath is visible.
Is there a way to do this directly or do I need to draw to a bitmap without alpha and then set the alpha for the whole bitmap and draw it to a canvas? (I haven't used bitmaps yet, so I am not sure how they are used yet.)
The easy way would be your suggested solution, ie. drawing all circles with no alpha to a bitmap, then draw that bitmap to another one using the desired alpha.
The hard way would be using blend modes, specifically PorterDuff.Mode in Android. An example can be found here.

Categories

Resources