android createbitmap参数详解,Bitmap.CreateBitmap Method (Android.Graphics) | Microsoft Docs

颛孙沈义
2023-12-01

Bitmap.CreateBitmap Method

Definition

Assembly:Mono.Android.dll

In this article

Overloads

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

Returns an immutable bitmap from subset of the source bitmap,

transformed by the optional matrix.

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

Returns an immutable bitmap from the specified subset of the source

bitmap.

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

Returns a mutable bitmap with the specified width and height.

Returns a mutable bitmap with the specified width and height.

Returns an immutable bitmap from the source bitmap.

CreateBitmap(DisplayMetrics, Int32[], Int32, Int32, Int32, Int32, Bitmap+Config)

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

[Android.Runtime.Register("createBitmap", "(Landroid/util/DisplayMetrics;[IIIIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;", "", ApiSince=17)]

public static Android.Graphics.Bitmap CreateBitmap (Android.Util.DisplayMetrics display, int[] colors, int offset, int stride, int width, int height, Android.Graphics.Bitmap.Config config);

static member CreateBitmap : Android.Util.DisplayMetrics * int[] * int * int * int * int * Android.Graphics.Bitmap.Config -> Android.Graphics.Bitmap

Parameters

Display metrics for the display this bitmap will be

drawn on.

colors

T:Android.Graphics._Color

offset

Number of values to skip before the first color in the

array of colors.

stride

Number of colors in the array between rows (must be >=

width or <= -width).

width

The width of the bitmap

height

The height of the bitmap

The bitmap config to create. If the config does not

support per-pixel alpha (e.g. RGB_565), then the alpha

bytes in the colors[] will be ignored (assumed to be FF)

Returns

Exceptions

if the width or height are <= 0, or if

the color array's length is less than the number of pixels.

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Bitmap, Int32, Int32, Int32, Int32, Matrix, Boolean)

Returns an immutable bitmap from subset of the source bitmap,

transformed by the optional matrix.

[Android.Runtime.Register("createBitmap", "(Landroid/graphics/Bitmap;IIIILandroid/graphics/Matrix;Z)Landroid/graphics/Bitmap;", "")]

public static Android.Graphics.Bitmap CreateBitmap (Android.Graphics.Bitmap source, int x, int y, int width, int height, Android.Graphics.Matrix m, bool filter);

static member CreateBitmap : Android.Graphics.Bitmap * int * int * int * int * Android.Graphics.Matrix * bool -> Android.Graphics.Bitmap

Parameters

source

The bitmap we are subsetting

The x coordinate of the first pixel in source

The y coordinate of the first pixel in source

width

The number of pixels in each row

height

The number of rows

Optional matrix to be applied to the pixels

true if the source should be filtered.

Only applies if the matrix contains more than just

translation.

Returns

Exceptions

if the x, y, width, height values are

outside of the dimensions of the source bitmap, or width is <= 0,

or height is <= 0

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Int32[], Int32, Int32, Int32, Int32, Bitmap+Config)

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

[Android.Runtime.Register("createBitmap", "([IIIIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;", "")]

public static Android.Graphics.Bitmap CreateBitmap (int[] colors, int offset, int stride, int width, int height, Android.Graphics.Bitmap.Config config);

static member CreateBitmap : int[] * int * int * int * int * Android.Graphics.Bitmap.Config -> Android.Graphics.Bitmap

Parameters

colors

T:Android.Graphics._Color

offset

Number of values to skip before the first color in the

array of colors.

stride

Number of colors in the array between rows (must be >=

width or <= -width).

width

The width of the bitmap

height

The height of the bitmap

The bitmap config to create. If the config does not

support per-pixel alpha (e.g. RGB_565), then the alpha

bytes in the colors[] will be ignored (assumed to be FF)

Returns

Exceptions

if the width or height are <= 0, or if

the color array's length is less than the number of pixels.

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config, Boolean, ColorSpace)

[Android.Runtime.Register("createBitmap", "(Landroid/util/DisplayMetrics;IILandroid/graphics/Bitmap$Config;ZLandroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;", "", ApiSince=26)]

public static Android.Graphics.Bitmap CreateBitmap (Android.Util.DisplayMetrics display, int width, int height, Android.Graphics.Bitmap.Config config, bool hasAlpha, Android.Graphics.ColorSpace colorSpace);

static member CreateBitmap : Android.Util.DisplayMetrics * int * int * Android.Graphics.Bitmap.Config * bool * Android.Graphics.ColorSpace -> Android.Graphics.Bitmap

Parameters

width

height

hasAlpha

colorSpace

Returns

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Int32, Int32, Bitmap+Config, Boolean, ColorSpace)

[Android.Runtime.Register("createBitmap", "(IILandroid/graphics/Bitmap$Config;ZLandroid/graphics/ColorSpace;)Landroid/graphics/Bitmap;", "", ApiSince=26)]

public static Android.Graphics.Bitmap CreateBitmap (int width, int height, Android.Graphics.Bitmap.Config config, bool hasAlpha, Android.Graphics.ColorSpace colorSpace);

static member CreateBitmap : int * int * Android.Graphics.Bitmap.Config * bool * Android.Graphics.ColorSpace -> Android.Graphics.Bitmap

Parameters

width

height

hasAlpha

colorSpace

Returns

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(DisplayMetrics, Int32[], Int32, Int32, Bitmap+Config)

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

[Android.Runtime.Register("createBitmap", "(Landroid/util/DisplayMetrics;[IIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;", "", ApiSince=17)]

public static Android.Graphics.Bitmap CreateBitmap (Android.Util.DisplayMetrics display, int[] colors, int width, int height, Android.Graphics.Bitmap.Config config);

static member CreateBitmap : Android.Util.DisplayMetrics * int[] * int * int * Android.Graphics.Bitmap.Config -> Android.Graphics.Bitmap

Parameters

Display metrics for the display this bitmap will be

drawn on.

colors

T:Android.Graphics._Color

width

The width of the bitmap

height

The height of the bitmap

The bitmap config to create. If the config does not

support per-pixel alpha (e.g. RGB_565), then the alpha

bytes in the colors[] will be ignored (assumed to be FF)

Returns

Exceptions

if the width or height are <= 0, or if

the color array's length is less than the number of pixels.

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Bitmap, Int32, Int32, Int32, Int32)

Returns an immutable bitmap from the specified subset of the source

bitmap.

[Android.Runtime.Register("createBitmap", "(Landroid/graphics/Bitmap;IIII)Landroid/graphics/Bitmap;", "")]

public static Android.Graphics.Bitmap CreateBitmap (Android.Graphics.Bitmap source, int x, int y, int width, int height);

static member CreateBitmap : Android.Graphics.Bitmap * int * int * int * int -> Android.Graphics.Bitmap

Parameters

source

The bitmap we are subsetting

The x coordinate of the first pixel in source

The y coordinate of the first pixel in source

width

The number of pixels in each row

height

The number of rows

Returns

Exceptions

if the x, y, width, height values are

outside of the dimensions of the source bitmap, or width is <= 0,

or height is <= 0

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Int32[], Int32, Int32, Bitmap+Config)

Returns a immutable bitmap with the specified width and height, with each

pixel value set to the corresponding value in the colors array.

[Android.Runtime.Register("createBitmap", "([IIILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;", "")]

public static Android.Graphics.Bitmap CreateBitmap (int[] colors, int width, int height, Android.Graphics.Bitmap.Config config);

static member CreateBitmap : int[] * int * int * Android.Graphics.Bitmap.Config -> Android.Graphics.Bitmap

Parameters

colors

T:Android.Graphics._Color

width

The width of the bitmap

height

The height of the bitmap

The bitmap config to create. If the config does not

support per-pixel alpha (e.g. RGB_565), then the alpha

bytes in the colors[] will be ignored (assumed to be FF)

Returns

Exceptions

if the width or height are <= 0, or if

the color array's length is less than the number of pixels.

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Int32, Int32, Bitmap+Config, Boolean)

[Android.Runtime.Register("createBitmap", "(IILandroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;", "", ApiSince=26)]

public static Android.Graphics.Bitmap CreateBitmap (int width, int height, Android.Graphics.Bitmap.Config config, bool hasAlpha);

static member CreateBitmap : int * int * Android.Graphics.Bitmap.Config * bool -> Android.Graphics.Bitmap

Parameters

width

height

hasAlpha

Returns

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config)

Returns a mutable bitmap with the specified width and height.

[Android.Runtime.Register("createBitmap", "(Landroid/util/DisplayMetrics;IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;", "", ApiSince=17)]

public static Android.Graphics.Bitmap CreateBitmap (Android.Util.DisplayMetrics display, int width, int height, Android.Graphics.Bitmap.Config config);

static member CreateBitmap : Android.Util.DisplayMetrics * int * int * Android.Graphics.Bitmap.Config -> Android.Graphics.Bitmap

Parameters

Display metrics for the display this bitmap will be

drawn on.

width

The width of the bitmap

height

The height of the bitmap

The bitmap config to create.

Returns

Exceptions

if the width or height are <= 0

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Int32, Int32, Bitmap+Config)

Returns a mutable bitmap with the specified width and height.

[Android.Runtime.Register("createBitmap", "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;", "")]

public static Android.Graphics.Bitmap CreateBitmap (int width, int height, Android.Graphics.Bitmap.Config config);

static member CreateBitmap : int * int * Android.Graphics.Bitmap.Config -> Android.Graphics.Bitmap

Parameters

width

The width of the bitmap

height

The height of the bitmap

The bitmap config to create.

Returns

Exceptions

if the width or height are <= 0

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(Bitmap)

Returns an immutable bitmap from the source bitmap.

[Android.Runtime.Register("createBitmap", "(Landroid/graphics/Bitmap;)Landroid/graphics/Bitmap;", "")]

public static Android.Graphics.Bitmap CreateBitmap (Android.Graphics.Bitmap src);

static member CreateBitmap : Android.Graphics.Bitmap -> Android.Graphics.Bitmap

Parameters

Returns

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config, Boolean)

[Android.Runtime.Register("createBitmap", "(Landroid/util/DisplayMetrics;IILandroid/graphics/Bitmap$Config;Z)Landroid/graphics/Bitmap;", "", ApiSince=26)]

public static Android.Graphics.Bitmap CreateBitmap (Android.Util.DisplayMetrics display, int width, int height, Android.Graphics.Bitmap.Config config, bool hasAlpha);

static member CreateBitmap : Android.Util.DisplayMetrics * int * int * Android.Graphics.Bitmap.Config * bool -> Android.Graphics.Bitmap

Parameters

width

height

hasAlpha

Returns

Remarks

Portions of this page are modifications based on work created and shared by the

Applies to

 类似资料: