Multiple use of bitmap images

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
nigelBUSrqT
Posts: 14
Joined: Fri May 11, 2012 6:24 am

Multiple use of bitmap images

Post by nigelBUSrqT » Tue Aug 14, 2012 12:16 am

Hello there

I am wanting to use (and dynamically resize) multiple copies of an image (imported icon png file) as indicators of output scores: the larger the presented size of the on-screen image, the greater is the score for a particular variable.

If I were to put a copy of the image on a separate sub-stack and reference it through the "Icons and Borders" panel for a button, I could presumably achieve a screen that uses multiple buttons that is not excessive in its use of memory (many vector graphic, low memory-consuming buttons making use of a single higher memory-consuming image). Unfortunately, both experimentation and looking back through earlier Forum posts signal that it will not be possible to generate buttons in which the image is resized to be consistent with the button size. Instead, the image size is static and becomes dwarfed by large button size and unaesthetically cropped by small button size.

In contrast, importing as controls multiple copies of the image file onto the viewed card enables independent resizing of each image in relation to score and is visually very effective. But what about consumption of memory? Is this a no-hoper way of representing the scores and should I revert to a less appealing version that just uses more memory-efficient vector graphics? Or is there a more memory-efficient way of managing the repeated use of the images that would still enable dynamic resizing to represent continually variable scores?

Many thanks in advance, Nigel

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9785
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Multiple use of bitmap images

Post by dunbarx » Tue Aug 14, 2012 4:22 am

I could be wrong, but I do not think you have to worry about memory at all. Your idea about using multiple images, and resizing them according to your whim, is the cleanest way to go.

But do remember to lock the size of your images when you close the stack. Saving won't keep the last rect intact, only locking will.

Craig Newman

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7266
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Multiple use of bitmap images

Post by jacque » Tue Aug 14, 2012 4:51 am

You can resize the image to fit the button and then assign the image as the button's icon. The icon will be whatever size you want. If you only use the image in a single button per card, it will work. If you need to use the same image in multiple buttons on the same card, and each one needs to be a different size, it won't work because each icon will be the same size.

Can you say a little more about how you will be using the image on each card?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

nigelBUSrqT
Posts: 14
Joined: Fri May 11, 2012 6:24 am

Re: Multiple use of bitmap images

Post by nigelBUSrqT » Tue Aug 14, 2012 11:22 am

Excellent - thankyou, Craig - won't locking prevent the resizing that will be necessary for an app to work on multiple devices? (but it will be a welcome change from having to resize upon reopening the stack! (I've taken to manually sizing every item by coding as a proportion of screen size, as it seems likely that would work across screen sizes).

It would be interesting to learn what general benchmarks / guidelines there are for file size in terms of speed of opening and closing an app. And I guess something similar will apply to moving from card to card but size won't be so easy to gauge. Anyway, I guess the proof of the pudding will be there as soon as I get a version available for download onto a device.

Many thanks for your advice

N

nigelBUSrqT
Posts: 14
Joined: Fri May 11, 2012 6:24 am

Re: Multiple use of bitmap images

Post by nigelBUSrqT » Tue Aug 14, 2012 11:26 am

Thankyou, Jacqueline - my challenge is that the images are being resized dynamically in response to an animation engine "constrain linear" function - but if memory is not likely to be a huge issue, it will be easier to used the naked images (not attached to buttons) - have gone through a further round of resizing and compressing images and have my fingers crossed - thank you for your thoughts

best

N

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”