Android Question Continous line drawing with some zig zags

tufanv

Expert
Licensed User
Longtime User
Hello

I want to draw a line but not a straight one, it will go down up to 45 degress sometimes and 45 degress up sometimes. With one code i think it is not possible. I have to add the lines to eachother with drawing multiple lines right ?

Another question is i want to draw a line for example for 6000 dip width and i want to show the line with a continous effect. The screen has to slide to show the line until it reachs to end of line. Can you give me an idea about how to do it ?
TY
 

Troberg

Well-Known Member
Licensed User
Longtime User
Well, you know all the coordinates. Simply get the highest and lowest X and Y values, then scroll/zoom so that you get those inside the screen.
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
why drawpath? drawline should do the trick, not?

and it won't be a good idea to work with a canvas of 6000 pixels memory wise.

sounds like you want to do one of these "follow the line" games?
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
why drawpath? drawline should do the trick, not?

and it won't be a good idea to work with a canvas of 6000 pixels memory wise.

sounds like you want to do one of these "follow the line" games?

Yeah indeed. What is the best solution then ? Using drawline and adding to each other or ?
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
in most cases like that you have a bitmap that is a bit larger than the screen. (1.25 or so)

you move it down till it reached a specific offset (25%y)
copy what you have down (25%y)
draw a new "line block" at the top (0)
and place the imageview back to the starting offset. (0)

you could do it at every tick aswell but that might be slower than just moving it and copy/redraw every 200 frames.

you have to play with that to see what works out best.
 
Upvote 0
Top