Android Question image indexing?

DaOne

Member
Licensed User
Longtime User
I am trying to use an image that is basically a bunch of images stuck together of exactly the same size. I want it to show only the part and hide the rest. Then change its index (whats displayed) based on an input value . I know this method is quite common but I am not sure what its called. Is there a way to do this in B4A? I included an image of what I am describing. I want it to display an individual number based on the input. Not the whole image.
 

Attachments

  • number_12.zip
    1,008 bytes · Views: 114

DonManfred

Expert
Licensed User
Longtime User
Check this digital-clock-example. It uses a special ttf-font to display. You could do the same principle to display the number you need. But without need for Images. Otherwise you need to draw your image on an canvas and then copy the part you need on a new canvas and save this canvas as new image. A lot of work, much more memory-usage...
 
Upvote 0

DaOne

Member
Licensed User
Longtime User
I know there has to be a way as I see this done on just about every program that is graphical. The image I showed was just an example. I am wanting to do it as an information display that is very graphical. Here s a better example.
 

Attachments

  • btn_power.zip
    6.9 KB · Views: 144
Upvote 0

DaOne

Member
Licensed User
Longtime User
That's it I think. Thank you a bunch. Searching for this stuff is hard sometimes when you not 100% sure what to call it. Thanks again.
 
Upvote 0

James Chamblin

Active Member
Licensed User
Longtime User
You should be able to use SrcRect to show only the part of the image you want to see. Just use index*WidthOfCell to find where the image begins.
 

Attachments

  • numbers.zip
    7.3 KB · Views: 129
Upvote 0
Top