如何将较小的位图复制到较大的位图?
希望这应该是一个简单的问题。我正在尝试将一系列小位图复制到较大的位图中,将它们并排排列,像素中没有任何间隙或重叠。例如,如果我有 3 个正方形位图,我想将它们复制到一个细长的矩形中。我知道如何做相反的事情,即从较大的位图创建一个小位图,但不是这样。正确的命令是什么?
(如果有人好奇,我希望这样做是为了能够重用我为使用单个位图处理动画而编写的一些代码。)
谢谢!
Hopefully this should be an easy question. I'm trying to copy a series of small bitmaps into a larger one, arranging them side by side without any gaps or overlap in their pixels. For example, if I have 3 square bitmaps, I'd like to copy them into one long and thin rectangle. I know how to do the opposite, namely creating a small bitmap out of a larger one, but not this way around. What's the right command?
(If anyone's curious, I want to do this to be able to reuse some code I wrote for handling animation with a single bitmap.)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为大位图创建画布,然后用它来绘制小位图。我对android很陌生,但我猜它是这样的:
Create a canvas for the large bitmap, then use that to draw your small bitmaps. I'm pretty new to android, but I'm guessing that it's something like this: