语言

RecordingCanvas.DrawBitmap 方法

定义

重载

名称 说明
DrawBitmap(Bitmap, Matrix, Paint)

使用指定的矩阵绘制位图。

DrawBitmap(Bitmap, Rect, Rect, Paint)

绘制指定的位图,自动缩放/转换以填充目标矩形。

DrawBitmap(Bitmap, Rect, RectF, Paint)

绘制指定的位图,自动缩放/转换以填充目标矩形。

DrawBitmap(Bitmap, Single, Single, Paint)

使用指定的绘图(由当前矩阵转换)绘制指定位图,其左上角为 (x,y)。

DrawBitmap(Int32[], Int32, Int32, Int32, Int32, Int32, Int32, Boolean, Paint)
已过时.

用于 x,y 的 drawBitmap(int[] 颜色,...)的旧版本

DrawBitmap(Int32[], Int32, Int32, Single, Single, Int32, Int32, Boolean, Paint)
已过时.

将指定的颜色数组视为位图,并绘制它。

DrawBitmap(Bitmap, Matrix, Paint)

使用指定的矩阵绘制位图。

[Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Matrix;Landroid/graphics/Paint;)V", "", ApiSince=29)]
public override sealed void DrawBitmap(Android.Graphics.Bitmap bitmap, Android.Graphics.Matrix matrix, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Matrix;Landroid/graphics/Paint;)V", "", ApiSince=29)>]
override this.DrawBitmap : Android.Graphics.Bitmap * Android.Graphics.Matrix * Android.Graphics.Paint -> unit

参数

bitmap
Bitmap

提供像素数据的位图。

matrix
Matrix

应用于位图坐标的转换。

paint
Paint

提供位图呈现属性的可选油漆,或 null 用于默认呈现。

特性

注解

使用指定的矩阵绘制位图。

Android 参考。android.graphics.RecordingCanvas.drawBitmap

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

DrawBitmap(Bitmap, Rect, Rect, Paint)

绘制指定的位图,自动缩放/转换以填充目标矩形。

[Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V", "", ApiSince=29)]
public override sealed void DrawBitmap(Android.Graphics.Bitmap bitmap, Android.Graphics.Rect? src, Android.Graphics.Rect dst, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/Rect;Landroid/graphics/Paint;)V", "", ApiSince=29)>]
override this.DrawBitmap : Android.Graphics.Bitmap * Android.Graphics.Rect * Android.Graphics.Rect * Android.Graphics.Paint -> unit

参数

bitmap
Bitmap

提供像素数据的位图。

src
Rect

要采样的位图子区域,或使用 null 整个位图。

dst
Rect

用于放置和调整采样位图大小的目标边界。

paint
Paint

提供位图呈现属性的可选油漆,或 null 用于默认呈现。

特性

注解

绘制指定的位图,自动缩放/转换以填充目标矩形。 如果源矩形不为 null,则指定要绘制的位图子集。 注意:如果油漆包含一个掩码,它生成一个掩码,该掩码超出了位图的原始宽度/高度(例如 BlurMaskFilter),则位图将像处于具有 CLAMP 模式的着色器中一样绘制。 因此,原始宽度/高度之外的颜色将是复制边缘颜色。 此函数忽略与位图关联的密度。 这是因为源矩形坐标空间和目标矩形坐标空间各自密度,因此必须已应用适当的缩放因子。

Android 参考。android.graphics.RecordingCanvas.drawBitmap

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

DrawBitmap(Bitmap, Rect, RectF, Paint)

绘制指定的位图,自动缩放/转换以填充目标矩形。

[Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/RectF;Landroid/graphics/Paint;)V", "", ApiSince=29)]
public override sealed void DrawBitmap(Android.Graphics.Bitmap bitmap, Android.Graphics.Rect? src, Android.Graphics.RectF dst, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;Landroid/graphics/Rect;Landroid/graphics/RectF;Landroid/graphics/Paint;)V", "", ApiSince=29)>]
override this.DrawBitmap : Android.Graphics.Bitmap * Android.Graphics.Rect * Android.Graphics.RectF * Android.Graphics.Paint -> unit

参数

bitmap
Bitmap

提供像素数据的位图。

src
Rect

要采样的位图子区域,或使用 null 整个位图。

dst
RectF

用于放置和调整采样位图大小的目标边界。

paint
Paint

提供位图呈现属性的可选油漆,或 null 用于默认呈现。

特性

注解

绘制指定的位图,自动缩放/转换以填充目标矩形。 如果源矩形不为 null,则指定要绘制的位图子集。 注意:如果油漆包含一个掩码,它生成一个掩码,该掩码超出了位图的原始宽度/高度(例如 BlurMaskFilter),则位图将像处于具有 CLAMP 模式的着色器中一样绘制。 因此,原始宽度/高度之外的颜色将是复制边缘颜色。 此函数忽略与位图关联的密度。 这是因为源矩形坐标空间和目标矩形坐标空间各自密度,因此必须已应用适当的缩放因子。

Android 参考。android.graphics.RecordingCanvas.drawBitmap

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

DrawBitmap(Bitmap, Single, Single, Paint)

使用指定的绘图(由当前矩阵转换)绘制指定位图,其左上角为 (x,y)。

[Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V", "", ApiSince=29)]
public override sealed void DrawBitmap(Android.Graphics.Bitmap bitmap, float left, float top, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("drawBitmap", "(Landroid/graphics/Bitmap;FFLandroid/graphics/Paint;)V", "", ApiSince=29)>]
override this.DrawBitmap : Android.Graphics.Bitmap * single * single * Android.Graphics.Paint -> unit

参数

bitmap
Bitmap

提供像素数据的位图。

left
Single

要绘制的位图左侧的位置

top
Single

正在绘制的位图的上侧的位置

paint
Paint

提供位图呈现属性的可选油漆,或 null 用于默认呈现。

特性

注解

使用指定的绘图(由当前矩阵转换)绘制指定位图,其左上角为 (x,y)。 注意:如果油漆包含一个掩码,它生成一个掩码,该掩码超出了位图的原始宽度/高度(例如 BlurMaskFilter),则位图将像处于具有 CLAMP 模式的着色器中一样绘制。 因此,原始宽度/高度之外的颜色将是复制边缘颜色。 如果位图和画布具有不同的密度,此函数将负责自动缩放位图以与画布相同的密度绘制。

Android 参考。android.graphics.RecordingCanvas.drawBitmap

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

DrawBitmap(Int32[], Int32, Int32, Int32, Int32, Int32, Int32, Boolean, Paint)

注意

deprecated

用于 x,y 的 drawBitmap(int[] 颜色,...)的旧版本

[Android.Runtime.Register("drawBitmap", "([IIIIIIIZLandroid/graphics/Paint;)V", "", ApiSince=29)]
[System.Obsolete("deprecated")]
public override sealed void DrawBitmap(int[] colors, int offset, int stride, int x, int y, int width, int height, bool hasAlpha, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("drawBitmap", "([IIIIIIIZLandroid/graphics/Paint;)V", "", ApiSince=29)>]
[<System.Obsolete("deprecated")>]
override this.DrawBitmap : int[] * int * int * int * int * int * int * bool * Android.Graphics.Paint -> unit

参数

colors
Int32[]

打包的 ARGB 像素颜色的数组。

offset
Int32

数组中第一个像素颜色的索引。

stride
Int32

相邻行的开头之间的数组条目数。

x
Int32

位图左上角的水平位置。

y
Int32

位图左上角的垂直位置。

width
Int32

从每行读取的像素颜色数。

height
Int32

从颜色数组读取的行数。

hasAlpha
Boolean

如此 如果颜色的 alpha 通道包含有效值。 如果为 false,则忽略 alpha 字节(假定为每个像素0xFF)。

paint
Paint

提供位图呈现属性的可选油漆,或 null 用于默认呈现。

特性

注解

不推荐使用此方法。 在硬件加速画布上,每个调用都需要颜色缓冲区的内部副本。 使用位图可避免复制和控制像素数据的生存期。

Android 参考。android.graphics.RecordingCanvas.drawBitmap

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于

DrawBitmap(Int32[], Int32, Int32, Single, Single, Int32, Int32, Boolean, Paint)

注意

deprecated

将指定的颜色数组视为位图,并绘制它。

[Android.Runtime.Register("drawBitmap", "([IIIFFIIZLandroid/graphics/Paint;)V", "", ApiSince=29)]
[System.Obsolete("deprecated")]
public override sealed void DrawBitmap(int[] colors, int offset, int stride, float x, float y, int width, int height, bool hasAlpha, Android.Graphics.Paint? paint);
[<Android.Runtime.Register("drawBitmap", "([IIIFFIIZLandroid/graphics/Paint;)V", "", ApiSince=29)>]
[<System.Obsolete("deprecated")>]
override this.DrawBitmap : int[] * int * int * single * single * int * int * bool * Android.Graphics.Paint -> unit

参数

colors
Int32[]

打包的 ARGB 像素颜色的数组。

offset
Int32

第一个像素的颜色数组的偏移量

stride
Int32

行之间的数组颜色数(必须为 >宽度或 <= -width)。

x
Single

绘制位图的位置的 X 坐标

y
Single

绘制位图位置的 Y 坐标

width
Int32

位图的宽度

height
Int32

位图的高度

hasAlpha
Boolean

如此 如果颜色的 alpha 通道包含有效值。 如果为 false,则忽略 alpha 字节(假定为每个像素0xFF)。

paint
Paint

提供位图呈现属性的可选油漆,或 null 用于默认呈现。

特性

注解

不推荐使用此方法。 每次调用此方法时,使用硬件加速画布都需要颜色缓冲区内容的内部副本。 使用 Bitmap 可避免此副本,并允许应用程序更显式地控制像素数据的生存期和副本。

Android 参考。android.graphics.RecordingCanvas.drawBitmap

本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。

适用于