
Bitmap中setPiexls的解释:
public void setPixels (int[] pixels, int offset, int stride, int x, int y, int width, int height)
Since:
API Level 1
Replace pixels in the bitmap with the colors in the array. Each element in the array is a packed int prepresenting a Color
Parameters
| pixels | The colors to write to the bitmap |
|---|---|
| offset | The index of the first color to read from pixels[] |
| stride | The number of colors in pixels[] to skip between rows. Normally this value will be the same as the width of the bitmap, but it can be larger (or negative). |
| x | The x coordinate of the first pixel to write to in the bitmap. |
| y | The y coordinate of the first pixel to write to in the bitmap. |
| width | The number of colors to copy from pixels[] per row |
| height | The number of rows to write to the bitmap |
Throws
| IllegalStateException | if the bitmap is not mutable |
|---|---|
| IllegalArgumentException | if x, y, width, height are outside of the bitmap's bounds. |
| ArrayIndexOutOfBoundsException | if the pixels array is too small to receive the specified number of pixels. |
生成颜色值数组的函数:
本文介绍了一个Android应用程序示例,该程序通过不同配置创建Bitmap,并使用颜色数组填充Bitmap。此外,还介绍了如何将Bitmap压缩为JPEG和PNG格式,以及如何直接绘制颜色数组。
2万+

被折叠的 条评论
为什么被折叠?



