问题描述
能否取悦别人解释我(ASCII真的欢迎)的步幅
参数代表着什么的<$c$c>Canvas.drawBitmap()$c$c>而在<$c$c>Bitmap.setPixels()/getPixels()$c$c>?我知道这是一种方式来跳过颜色数组中的元素,但如何?
Could please somebody explain me (ASCII is really welcome) what the stride
argument stands for in Canvas.drawBitmap()
and in Bitmap.setPixels()/getPixels()
? I understand it's a way to skip elements in the colors array, but how?
推荐答案
在大多数情况下,步幅是相同的宽度。跨距是,如果你要复制/绘制位图的次区域是有用的。举例来说,如果你有一个100×100的位图,你想画的50×50右上角,你可以使用一个宽度50像素的和100px的一大步。
In most cases the stride is the same as the width. The stride is useful if you are trying to copy/draw a sub-region of a Bitmap. For instance, if you have a 100x100 bitmap and you want to draw the 50x50 top-right corner, you can use a width of 50px and a stride of 100px.
这篇关于drawBitmap()和的setPixels():什么是步幅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!