Draw canvas with avoidxfermode - android

This is my first post.
I'm developing a drawing application for Android and are opposite to a problem that I can not fix.
I have an image with various geometric shapes also superimposed. Each has a different colored geometric shapes.
With Avoidxfermode I can draw on the form with a specific color.
Now I would like the colorful picture is not visible to the user.
In practice I would recognize the area in which color through the colored picture, but I would like the new color to appear on a white image

Related

Draw on specific part of Image

I want to fill the specific part of the image with certain color.
In my case I want to fill the A part with green color.
But when I am using canvas in android. It is going to draw color in the area where A is not there

OpenCV Android: Obtaining coordinates of pixels lighted at specific color

I am working on an app using OpenCV249 on android and would like to find means to obtain the coordinates of the pixels that are lighted at a specific color relative to the image. For instance if I draw a green dot using android's canvas and drawables on an image, is there a way to obtain the coordinates of that green dot relative to the image by means of finding out the pixels that are lighted at that specific color?
And if this process is extended to more complicated random sketches, ie circles or rectangles, is there a way to obtain those points as well? Imagine multiple circles/rectangles drawn and different colors, I need a way to obtain the coordinates of those circles/rectangles I've drawn using different colors.
Because I am developing for android, I appreciate any advise that comes from android perspective pls, thanks!!

draw multiple circles and set them as ImageView background in android

I have an image view with a (not really) complex background. The background is to be the composition of three circles, each with different dynamically set colors.
one circle, the largest, is actually a perimeter (i.e. stroke)
one circle, the second largest, is concentric with the perimetric circle
one circle, the smallest, sits at the base of the other two circles (so that it is not concentric).
I successfully create the 3-circle background using layer-list. But the problem is that I am not able to change the colors in the layer-list dynamically. Changing the color of these circles is a crucial part of the design.
So since my ImageView is part of a custom view anyway, I am now thinking of using the canvas in onDraw(Canvas canvas) to create my three circles and set them as the background of the ImageView. However, the problem with this approach is that I don't know how to set my composite image (the three circles) as the background of my ImageView.
Any snippet of code solving this problem is greatly appreciated.

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

Drawing bitmaps with empty areas

I need to draw a bitmap on top of a completely rendered GLSurfaceView. By completely rendered I mean that the entire thing is filled with colorized triangles. Obviously the bitmap will hide the triangles underneath it, but I would like to minimize how much is hidden.
The bitmap is 64x64 pixels and has many empty areas that are translucent in the PNG file. When I draw the bitmap by making a square with two triangles, the translucent areas become black (the green areas in the picture above), perhaps because the app background is black. Is there an easy way to get the translucent areas to not affect the image (the second image above)? Do I need to create a complex set of triangles that exactly outlines the non-translucent parts when I render the bitmap?
I am developing on a Motorola Xoom, Android 3.0. Thanks for your time.
Use the alpha test.

Categories

Resources