File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to set traverse string using canvas

 
nagarjuan pula
Greenhorn
Posts: 9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17624
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The text crawl effect is done by erasing the old text and writing it back into the canvas again only with a shifted "X" co-ordinate. You can do erasing in several different ways. One is by just resetting the rectangle that bounds the text to the canvas background color. Another is to rewrite the text in its original position, but using the canvas background color as the text color.

Then again, if the UI supports clipping (and I don't remember for the case of JME), you could simply set a clip rectangle to only repaint the area that holds the text and update the X co-ordinate in the paint method. Which is the preferred way to do things in systems that do painting in separate threads. For one thing, the clip/paint mechanism usually makes most effective use of the available graphics hardware and isn't impacted by other UI events.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic