Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Efficient coding solution for this simple problem 1

Status
Not open for further replies.

LEICJDN1

Technical User
Nov 27, 2002
201
GB
I have a main image into which sequential images are copied for pixel analysis. All that is fine. However, I want to control how the images are StretchDrawn into the main image.

Basically, I need to determine how many times I can increase the image size before it no longer fits into the main image.

I have an integer variable 'zoomlevel', set to 1 to 10. I then multiply the sourceimage.width integer by zoom level. If the result is > than 875 it won't fit, so I know only to zoom by zoomlevel - 1 for that iteration.

Sounds simple - work out zoomlevel for each image in turn. However due to severe brain fade I cannot come up with a simple piece of code to calculate largest zoomlevel that will return an image width nearest but not greater than 875.

Can anyone help. I am sure the solution is simple and obvious but it will not come to me!

Thanks.
 
Doh!

Thanks. Hate it when can't see the wood for the trees and am actually staring at the answer!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top