How to draw round edges rectangle in android? - android

I want to draw a rectangle with 2 rounded edges in android like this, please give me a solution, thanks
I haven't enough reputation to post image this is my image link:
https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/10748614_625637960879181_1248600195_n.jpg?oh=55df952450fe6392bdc04576852ba113&oe=545369D0&gda=1414743424_4de198add38ec1c5748f101338b7e238

Related

How to draw a Dotted Outline on a image according to its shape on touch it?

I need to draw a dotted outline on a image according to its shape. how to draw the path according to the object shape? Attached an sample image .
Please suggest some idea

Draw a rounded corner square in android canvas

Picture 1 depicting path to draw. Picture 2 depicting the final result
This is a bit more of a geometry-inside-java question. Basically, I want to round a single corner of a square I drew on a canvas, sometimes it's on the top left, other times on the top right, or bottom left or right. How could a shape like the red highlight be drawn and filled using Android's drawing methods? I've read the drawing tutorials on Oracle, but I can't still figure out how to draw something like that in that position. Any help would be greatly appreciated.

Andengine: How to draw a transparent rectangle with rounded corners and border?

I've been trying to figure out how to draw a transparent rectangle with rounded corners and border with no avail.
Being new to andengine, I'm wondering if it is possible at all. Can someone please provide some pointers or help with a link to a sample. Wasn't able to find any when searching over the internet.
There already Rectangle class in andengine..
Rectangle rec=new Rectangle(x,y,width,height,....);
For transparency:
rec.setAlpha(0):
Attach to your scene, if you are using rectangle as physics object like used for collision then create box body from PhysicsFactory.createBoxBody();
scene.attachChild(rec);
Instead of using a Rectangle can you use a Sprite. Just create an image in Photoshop or another program, apply some transparency and export as .png. Then just load the image as Sprite.

Bluring Part of an Image in Android

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.

draw canvas 3d rectangle

I Have extended View class and override draw method. In draw method I draw rectangle using canvas. but this rectangle is simple I need to show as blow. how can I draw rectangle like shown in below image?
create a Path for the top side using 4 points (moveTo and lineTo) and then draw it with Canvas.drawPath. Do the same for the right side
Here is the link for the HoloGraphLibrary. Just check it.
It has no 3d effect as you want but it has Same ui as you want. You will have to play little to have effect like 3d rectangle.
Try a look and let me know if it do not help you.
Enjoy Coding and All The Best. :)

Categories

Resources