Language

RecordingCanvas.DrawBitmap Method

Definition

Overloads

Name Description
DrawBitmap(Bitmap, Matrix, Paint)

Draw the bitmap using the specified matrix.

DrawBitmap(Bitmap, Rect, Rect, Paint)

Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle.

DrawBitmap(Bitmap, Rect, RectF, Paint)

Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle.

DrawBitmap(Bitmap, Single, Single, Paint)

Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix.

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

Legacy version of drawBitmap(int[] colors,...) that took ints for x,y

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

Treat the specified array of colors as a bitmap, and draw it.

DrawBitmap(Bitmap, Matrix, Paint)

Draw the bitmap using the specified matrix.

[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

Parameters

bitmap
Bitmap

The bitmap supplying the pixel data.

matrix
Matrix

The transformation applied to the bitmap coordinates.

paint
Paint

The optional paint supplying bitmap-rendering attributes, or null for default rendering.

Attributes

Remarks

Draw the bitmap using the specified matrix.

Android reference for android.graphics.RecordingCanvas.drawBitmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DrawBitmap(Bitmap, Rect, Rect, Paint)

Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle.

[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

Parameters

bitmap
Bitmap

The bitmap supplying the pixel data.

src
Rect

The bitmap subregion to sample, or null to use the whole bitmap.

dst
Rect

The destination bounds used to place and size the sampled bitmap.

paint
Paint

The optional paint supplying bitmap-rendering attributes, or null for default rendering.

Attributes

Remarks

Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle. If the source rectangle is not null, it specifies the subset of the bitmap to draw. Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated. This function ignores the density associated with the bitmap. This is because the source and destination rectangle coordinate spaces are in their respective densities, so must already have the appropriate scaling factor applied.

Android reference for android.graphics.RecordingCanvas.drawBitmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DrawBitmap(Bitmap, Rect, RectF, Paint)

Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle.

[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

Parameters

bitmap
Bitmap

The bitmap supplying the pixel data.

src
Rect

The bitmap subregion to sample, or null to use the whole bitmap.

dst
RectF

The destination bounds used to place and size the sampled bitmap.

paint
Paint

The optional paint supplying bitmap-rendering attributes, or null for default rendering.

Attributes

Remarks

Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle. If the source rectangle is not null, it specifies the subset of the bitmap to draw. Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated. This function ignores the density associated with the bitmap. This is because the source and destination rectangle coordinate spaces are in their respective densities, so must already have the appropriate scaling factor applied.

Android reference for android.graphics.RecordingCanvas.drawBitmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

DrawBitmap(Bitmap, Single, Single, Paint)

Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix.

[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

Parameters

bitmap
Bitmap

The bitmap supplying the pixel data.

left
Single

The position of the left side of the bitmap being drawn

top
Single

The position of the top side of the bitmap being drawn

paint
Paint

The optional paint supplying bitmap-rendering attributes, or null for default rendering.

Attributes

Remarks

Draw the specified bitmap, with its top/left corner at (x,y), using the specified paint, transformed by the current matrix. Note: if the paint contains a maskfilter that generates a mask which extends beyond the bitmap's original width/height (e.g. BlurMaskFilter), then the bitmap will be drawn as if it were in a Shader with CLAMP mode. Thus the color outside of the original width/height will be the edge color replicated. If the bitmap and canvas have different densities, this function will take care of automatically scaling the bitmap to draw at the same density as the canvas.

Android reference for android.graphics.RecordingCanvas.drawBitmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

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

Caution

deprecated

Legacy version of drawBitmap(int[] colors,...) that took ints for x,y

[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

Parameters

colors
Int32[]

The array of packed ARGB pixel colors.

offset
Int32

The index of the first pixel color in the array.

stride
Int32

The number of array entries between the starts of adjacent rows.

x
Int32

The horizontal position of the bitmap's upper-left corner.

y
Int32

The vertical position of the bitmap's upper-left corner.

width
Int32

The number of pixel colors read from each row.

height
Int32

The number of rows read from the color array.

hasAlpha
Boolean

true to retain alpha in native 32-bit storage; false selects opaque RGB565 storage in the Android 16 implementation.

paint
Paint

The optional paint supplying bitmap-rendering attributes, or null for default rendering.

Attributes

Remarks

This method is deprecated.

Android reference for android.graphics.RecordingCanvas.drawBitmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

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

Caution

deprecated

Treat the specified array of colors as a bitmap, and draw it.

[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

Parameters

colors
Int32[]

The array of packed ARGB pixel colors.

offset
Int32

Offset into the array of colors for the first pixel

stride
Int32

The number of colors in the array between rows (must be >= width or <= -width).

x
Single

The X coordinate for where to draw the bitmap

y
Single

The Y coordinate for where to draw the bitmap

width
Int32

The width of the bitmap

height
Int32

The height of the bitmap

hasAlpha
Boolean

True if the alpha channel of the colors contains valid values. If false, the alpha byte is ignored (assumed to be 0xFF for every pixel).

paint
Paint

The optional paint supplying bitmap-rendering attributes, or null for default rendering.

Attributes

Remarks

This method is deprecated. Usage with a hardware accelerated canvas requires an internal copy of color buffer contents every time this method is called. Using a Bitmap avoids this copy, and allows the application to more explicitly control the lifetime and copies of pixel data.

Android reference for android.graphics.RecordingCanvas.drawBitmap.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to