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.
Related
I want to draw some path with user's touch. if users moves finger from one position to another position a path will be drawn exactly as user moved finger.
We can draw a line with by defining color but i want to draw that line with sprite(image).
What I exactly meant is I just want to use image using sprite instead of using color to draw line. is it possible with LibGDX? if yes , how can we do that? and how will I generate image to use as sprite for that?
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!!
is there any way to blur only part of an image in android?
searched a lot but dint find any help.
most of the examples use gaussian blur which blurs full imageview.
i want to allow user to dynamically draw rectangle on imageview & on action up
area within rectangle should be blured.
any help will be really appreciated.
Bluring images on the fly is not an easy task, ask Roman Nurik (The one behind Muzei app)
He gave useful tips on this Google+ post but it's for animated images, from focus to blur.
In your case, I would say that you need to (roughly):
Get the bounds of the drawn rectangle
Get the image part that corresponds to the previous bounds
Blur on the fly the previous image part
Draw, into the same canvas, the blurred image part on top of the original image
Set up a onDrag Listener to move the drawn rectangle and do again step 1
EDIT: After re-thinking about it, computing and draw a blurred area each time the drawn rectangle move it too heavy, it won't work. The solution is probably this:
Blur the entire image and keep it into memory
Get the bounds of the drawn rectangle
Get the part of the blurred image that corresponds to the previous bounds
Draw, into the same canvas, the blurred image part on top of the original image
Set up a onDrag Listener to move the drawn rectangle to do again step 2-3-4
put the image view in a relative layout.
you detect the touch events of the user.
for each rectangle that he is drawing, you add an image view of it is size superposed to the initial one (I mean in the same relative layout) and of course with your blur effect.
you will see your image view blured part by part ...
put another layout on the half part of the image and set a translucent type background to the layout.
Once you have drawn your rectangle set alpha = 0.5 or as per your need so that your dynamic view that you have drawn will look blurred.
This is code for blur:
http://shaikhhamadali.blogspot.in/2013/07/gaussian-blur-imagebitmap-in-imageview.html
In this code computeConvolution3x3 method is used for computing the blur.For computing blur it convert the bitmap in to pixel array then it apply on those pixel. So you have to just do is get pixels array of that part of the image that you want blur.
i'm making a drawing application.
i have several shapes on the screen like rectangle, circle, heart, line.
i want to make a pattern background with that kind of shapes.
if user chooes circle background my photo is drawn following on the circle path in the background.
first i have to draw the background shape of circle or whatever.
so i think i have a chance to save coordinates of path during drawing the background shape.
but i have no idea how to get coordinates during drawing the shape.
if i have array of coordinates of path, i think i can position my photo image following the path.
and i have tomove shape images following the bg path too.
i need to get coordinates from certain path that i drawing.
could anybody help..
alright, i found the answer myself.
PathMeasure and matrix is the solution.
http://www.mail-archive.com/android-developers#googlegroups.com/msg14567.html
I want to crop an image in alphabet(A-Z,0-9) in Andorid any idea ?
Here is an example of what I am looking for Cut out image in shape of text
but he uses java's awt api(I am looking for Android) also it is too slow.
After some googling and reading android docs found that we can specified drawing area for canvas using canvas.clipPath(path) then I can draw a rectangular image on canvas and image will only be visible that is drawn in clipped area,hopefully :)
So now I can crop image in small rectangle and draw rectangle on Text path is it possible to get Outline of an Alphabet for given font ?
On Android you should be able to do that very easily by using a BitmapShader.
Instantiate your BitmapShader.
Instantiate a Paint, and call setShader(bitmapShader).
Draw text with Canvas.drawText("Cat", x,y, paint).