Android Question Continous line drawing with some zig zags

Discussion in 'Android Questions' started by tufanv, Apr 1, 2015.

  1. tufanv

    tufanv Expert Licensed 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
     
  2. Troberg

    Troberg Well-Known Member Licensed User

    Canvas.DrawPath should do the trick, if I understand what you are trying to do correctly.
     
    tufanv likes this.
  3. tufanv

    tufanv Expert Licensed User

    exactly TY !
     
  4. tufanv

    tufanv Expert Licensed User

    any idea to scroll the screen to show the whole path ?
     
  5. Troberg

    Troberg Well-Known Member Licensed 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.
     
    tufanv likes this.
  6. tufanv

    tufanv Expert Licensed User

    ok Thank you ! :)
     
  7. sorex

    sorex Expert Licensed 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?
     
  8. tufanv

    tufanv Expert Licensed User

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

    sorex Expert Licensed 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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice