I'm trying to draw path on the map in Android and I want that the path line is an animation. I can draw lines in any static color (blue, red etc.) but not an animation. The line must be an animation. This link explains what I want to do.
Tugrul.
I believe this is not easy thing to do, but if you are using canvas to draw the path, you can use the functions canvas.translate() canvas.rotate() canvas.scale() with some sort of timers to achieve what you need, if you are using something else please state it.
Related
I tried using pixmap , but every time i draw a path and increaase drag speed , it shows space betweeen two pixmap circles.
I also tried by saving touch points in an array and drawind all the points by shaperenderer but same thing happened.
I need to draw a smooth line like in some image editor apps.
Right now using this method.
while (cIter.hasNext()) {
penpoint = cIter.next();
shapeRenderer.circle(penpoint.getPosition().x,
penpoint.getPosition().y, 3);
}
but it shows like this.
https://s3.amazonaws.com/pushbullet-uploads/ujCRdpmszeu-lp4uLBpI5MftwHBvmk58QP4w4mrzfkJx/Screenshot_2014-12-14-15-23-41.png
do not know if this is what you want, but maybe you can use it for whatever you want to do, hope it helps.
https://github.com/libgdx/libgdx/wiki/Path-interface-%26-Splines
https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/PathTest.java
P.S:maybe you can look on Beizer curves
https://www.google.es/?gws_rd=ssl#q=http://devmag.org.za+/2011/04/05+/bzier-curves-a-tutorial/
I am creating an image painting app in libgdx where user would touch the portion of the image. e.g If the user touch the wheels of a car that should turn into the selected color.
I don't really know how to specify the custom area around the touch. That can be a wheel, a door which are not always rectangle and circle. I just need an idea to do it. Whether libgdx pixelmap can achive this. I have to paint the image inside the border line of the touch region. I hope my problem is clearly stated.
I woule really appreciate for your time for giving the answers. Thanks in advance
I think you want to look at flood fill algorithms. I don't think there is any built-in support for this in libGDX, but you should be able to implement your own flood fill on a libGDX pixmap.
I'm trying to play gif animations on certain x,y coordinates.
i tried using the Movie class, but sadly most gif animations plays wired and not smooth enough.
In the Movie class i could simply set x,y coordinates of where i want my movie to be,
Now i want to use the GifDecoder class, but have no idea how to play it in dynamic x,y coordinates which changes all the time, and also make it seem smooth.
If you want to use GifDecoder, then here are some resources that I think might help you.
A tutorial can be found here.
I have two views called x and y they are both black lines (for example I made the height of the x line is 1dp and width 230dp and as background filled with the color black).
Now i want to move the position of the lines programmatically (for example I want the y line 50dp to the right of the orginal position).
Can someone help me how to do this?
I have tried things such as setpadding but the line doesn't move.
Thanks in advance!
(ps: my minimum sdk is set for 7 so i can't use the newest api's).
Old Answer
Have a look at the Absolute Layout, it allows you to position
child elements using x, y coordinates. It is deprecated but it's the
only way in Android to do real x,y coordinate positioning.
I would ask what the main point behind what you are trying to do is
though? It sounds like you started with a goal, were led down a path
and now are asking how to get to the end of that path, rather than
asking how to do what you need to do.
Edited
For drawing graphs have a look instead at https://stackoverflow.com/questions/2271248/how-to-draw-charts-in-android.
Using a Layout class to draw a chart will only lead to a really slow app, since the layout classes are designed for creating relatively static layouts, not drawing full graphics.
Instead use either the Canvas and draw your drawables yourself or use the graphing packages listed in the SO question I linked above.
I am trying to use JXMapViewer (from swingx-ws) with Open Street Maps. I was wondering if it would be possible to display the map tiles in the JXMapViewer based on heading up, rather than on North up. For example, the normal car GPS navigation systems let you do that.
I've looked through the documentation and there doesn't seem to be a straightforward way to do this. Is there something else that accomplish this, besides JXMapViewer?
Nevermind, I found a solution. Here is how I did it(if anybody is interested) :
I subclassed JXMapViewer, and overrode the paint method.
In the paint method contents of the JPanel are converted to a BufferedImage which is then rotated according to an angle and then painted on top of the panel.
so super.paint()-> BufferedImage-> apply an affineTransformation to it-> draw the new Image.
Of course, you would also need to override the convertGeoPositionToPoint and convertPointToGeoPosition methods taking into account the fact that the image is rotated.