C++ 中的查找表
我必须实现小型多图像图形控制,其本质上是由 9 个图像组成的数组,逐一显示。最终目标是充当迷你滑块。
现在,这个图形控件将接收各种整数范围:从 5 到 25 或从 0 到 7 或从 -9 到 9。
如果我要使用比例 - “三规则”,恐怕在技术上不可持续,因为它可能是错误的根源。我的猜测是使用一些查找表,但是有人对方法有好的建议吗?
谢谢
I have to implement small multimage graphic control, which in essence is an array of 9 images, shown one by one. The final goal is to act as minislider.
Now, this graphic control is going to receive various integer ranges: from 5 to 25 or from 0 to 7 or from -9 to 9.
If I am going to use proportion - "rule of three" I am afraid is not technically suistainable because it can be a source of errors. My guess is to use some lookup tables, but has anyone an good advice for approach?
Thnx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,查找表是一个很好的解决方案
yes, a lookup table is a good solution
我不确定是否需要查找表。您可以按比例从输入值获取 0 到 9 之间的图像索引:
I'm not sure look up tables are required. You can get from your input value to an image index between 0 and 9 proportionally: