How to make a triangle, rectangle, polygon in Android? - android

If I select shapes like Triangle, Rectangle, Polygon, Curve etc then it must be able to draw specific selected shapes. Like Paint (this is an application offered by Microsoft for creating shapes and sketches). In Android, I have to select the shapes and should be able to draw like a Free hand drawing but it completely should be done it in code wise.
Same: I have to draw either directly select the triangle shape from the options given, or can draw a triangle of any base and height from scratch.
How could I do this in Android application?

You can use OpenGL ES
Open this link
Hope it will useful

Related

Digging a polygon according to another with libgdx

I actually develop a 3D application on Android, and i manipulate 3D object.
I want to dig a polygon according to another polygon form such as a cube or a cylinder.
In the following image you can imagine I have two superimposed polygons, a cylinder and a rectangular cuboid.
If I get the intersection of these two polygons and I calculate the inverse (included in the rectangular cuboid) I get a new polygon with a hole in the shape of the cylinder like in this picture.
I don't know how to achieve this with libGDX, I know the Intersector class, but I do not know how to retrieve the reverse of an intersection between two polygons.

Create curved gradients with `Paint` and `Canvas`

I am looking to dynamically create (bezier) curves in Android using Canvas and Paint. I can easily do nice curves with setStrokeWidth or doing a more complex polygon/path.
But how can I make the gradient follow the curve like in this example? LinearGradient in either direction would not give the same feel.
In some parts of the curve there is a narrower gradient as well.
Is it made by some inner shadow or maybe just redrawing lots and lots of curves?
I'm afraid curving the gradient is not possible using the built-in gradient classes (LinearGradient, RadialGradient, SweepGradient). It's possible to draw lots of curves, but that would basically mean writing the curved gradient yourself. :)
(And the shading of the surface looks a bit even more subtle to me, resembling a 3D render.)

Drawing shapes on canvas in android

I have some problem. I would like to create applications paint which enabling them to draw different shapes. He wants to use the strategy pattern to change the tool used to draw. Unfortunately, I do not know how to keep the drawn shapes to be the ability to undo and change the color of specific shapes by clicking on them.

How can I draw a filled in circle with andengine?

I am using Andengine GLES 2.0 anchor center branch and I am trying to draw a filled in circle. I tried using the Ellipse class it comes with but all I can get is an outline of a circle not a filled in one like I want. I looked around and all I could find were places showing how to draw an outline so this must be a simple thing. So how can I draw a filled in circle with Andengine GLES 2.0 anchor center?
To make a filled circle/ellipse just go
mEllipse.setDrawMode(DrawMode.TRIANGLE_FAN);

opencv - Detect and optimize shapes

I have a challenge where I have to implement a sample apps on Android. This app allows user draw some shapes on the screen (by finger) and then optimize it to vertex based shapes. I am thinking about Opencv but I don't know what function/feature can help me detect a shape and optimize it. I need some hints or recommendations.
Update: User can draw any type of shapes such as: Circle, ellipse, rectangle, line, curve, polygon, ... So I think it should have an general algorithm for all kind of shapes.
Thanks.

Categories

Resources