Bitmap Bitmap Class

Definition

[Android.Runtime.Register("android/graphics/Bitmap", ApiSince=1, DoNotGenerateAcw=true)]
public sealed class Bitmap : Java.Lang.Object, Android.OS.IParcelable, IDisposable
type Bitmap = class
    inherit Object
    interface IParcelable
    interface IJavaObject
    interface IDisposable
Inheritance
Attributes
Implements

Remarks

Android platform documentation

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.

Fields

DensityNone DensityNone

Indicates that the bitmap was created for an unknown pixel density.

Properties

AllocationByteCount AllocationByteCount

Returns the size of the allocated memory used to store this bitmap's pixels.

ByteCount ByteCount

Returns the minimum number of bytes that can be used to store this bitmap's pixels.

Class Class

Returns the unique instance of Class that represents this object's class.

(Inherited from Object)
ColorSpace ColorSpace
Creator Creator
Density Density
GenerationId GenerationId

Returns the generation ID of this bitmap.

Handle Handle

The handle to the underlying Android instance.

(Inherited from Object)
HasAlpha HasAlpha

Returns true if the bitmap's config supports per-pixel alpha, and if the pixels may contain non-opaque alpha values.

HasMipMap HasMipMap

Indicates whether the renderer responsible for drawing this bitmap should attempt to use mipmaps when this bitmap is drawn scaled down.

Height Height

Returns the bitmap's height

IJavaObjectEx.IsProxy IJavaObjectEx.IsProxy Inherited from Object
IJavaObjectEx.KeyHandle IJavaObjectEx.KeyHandle Inherited from Object
IJavaObjectEx.NeedsActivation IJavaObjectEx.NeedsActivation Inherited from Object
IJavaPeerable.JniManagedPeerState IJavaPeerable.JniManagedPeerState Inherited from Object
IsMutable IsMutable

Returns true if the bitmap is marked as mutable (i.e. can be drawn into)

IsPremultiplied IsPremultiplied
IsRecycled IsRecycled

Returns true if this bitmap has been recycled.

JniIdentityHashCode JniIdentityHashCode Inherited from Object
JniPeerMembers JniPeerMembers
PeerReference PeerReference Inherited from Object
Premultiplied Premultiplied

Indicates whether pixels stored in this bitmaps are stored pre-multiplied.

RowBytes RowBytes

Return the number of bytes between rows in the bitmap's pixels.

ThresholdClass ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
Width Width

Returns the bitmap's width

Methods

Clone() Clone()

Creates and returns a copy of this Object.

(Inherited from Object)
Compress(Bitmap+CompressFormat, Int32, Stream) Compress(Bitmap+CompressFormat, Int32, Stream)

Write a compressed version of the bitmap to the specified outputstream.

CompressAsync(Bitmap+CompressFormat, Int32, Stream) CompressAsync(Bitmap+CompressFormat, Int32, Stream)
Copy(Bitmap+Config, Boolean) Copy(Bitmap+Config, Boolean)

Tries to make a new bitmap based on the dimensions of this bitmap, setting the new bitmap's config to the one specified, and then copying this bitmap's pixels into the new bitmap.

CopyPixelsFromBuffer(Buffer) CopyPixelsFromBuffer(Buffer)
CopyPixelsFromBufferAsync(Buffer) CopyPixelsFromBufferAsync(Buffer)
CopyPixelsToBuffer(Buffer) CopyPixelsToBuffer(Buffer)
CopyPixelsToBufferAsync(Buffer) CopyPixelsToBufferAsync(Buffer)
CreateBitmap(Bitmap) CreateBitmap(Bitmap)

Returns an immutable bitmap from the source bitmap.

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

Returns an immutable bitmap from the specified subset of the source bitmap.

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

Returns an immutable bitmap from subset of the source bitmap, transformed by the optional matrix.

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

Returns a mutable bitmap with the specified width and height.

CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config, Boolean) CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config, Boolean)
CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config, Boolean, ColorSpace) CreateBitmap(DisplayMetrics, Int32, Int32, Bitmap+Config, Boolean, ColorSpace)
CreateBitmap(DisplayMetrics, Int32[], Int32, Int32, Bitmap+Config) 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.

CreateBitmap(DisplayMetrics, Int32[], Int32, Int32, Int32, Int32, Bitmap+Config) 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.

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

Returns a mutable bitmap with the specified width and height.

CreateBitmap(Int32, Int32, Bitmap+Config, Boolean) CreateBitmap(Int32, Int32, Bitmap+Config, Boolean)
CreateBitmap(Int32, Int32, Bitmap+Config, Boolean, ColorSpace) CreateBitmap(Int32, Int32, Bitmap+Config, Boolean, ColorSpace)
CreateBitmap(Int32[], Int32, Int32, Bitmap+Config) 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.

CreateBitmap(Int32[], Int32, Int32, Int32, Int32, Bitmap+Config) 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.

CreateScaledBitmap(Bitmap, Int32, Int32, Boolean) CreateScaledBitmap(Bitmap, Int32, Int32, Boolean)

Creates a new bitmap, scaled from an existing bitmap, when possible.

DescribeContents() DescribeContents()

No special parcel contents.

Dispose() Dispose() Inherited from Object
Dispose(Boolean) Dispose(Boolean) Inherited from Object
Equals(Object) Equals(Object)

Compares this instance with the specified object and indicates if they are equal.

(Inherited from Object)
EraseColor(Int32) EraseColor(Int32)

T:Android.Graphics._Color

ExtractAlpha() ExtractAlpha()

Returns a new bitmap that captures the alpha values of the original.

ExtractAlpha(Paint, Int32[]) ExtractAlpha(Paint, Int32[])

Returns a new bitmap that captures the alpha values of the original.

GetBitmapInfo() GetBitmapInfo()
GetConfig() GetConfig()

If the bitmap's internal config is in one of the public formats, return that config, otherwise return null.

GetHashCode() GetHashCode()

Returns an integer hash code for this object.

(Inherited from Object)
GetNinePatchChunk() GetNinePatchChunk()

Returns an optional array of private data, used by the UI system for some bitmaps.

GetPixel(Int32, Int32) GetPixel(Int32, Int32)

T:Android.Graphics._Color

GetPixels(Int32[], Int32, Int32, Int32, Int32, Int32, Int32) GetPixels(Int32[], Int32, Int32, Int32, Int32, Int32, Int32)

Returns in pixels[] a copy of the data in the bitmap.

GetScaledHeight(Canvas) GetScaledHeight(Canvas)

Convenience for calling GetScaledHeight(Int32) with the target density of the given Canvas.

GetScaledHeight(DisplayMetrics) GetScaledHeight(DisplayMetrics)

Convenience for calling GetScaledHeight(Int32) with the target density of the given DisplayMetrics.

GetScaledHeight(Int32) GetScaledHeight(Int32)

Convenience method that returns the height of this bitmap divided by the density scale factor.

GetScaledWidth(Canvas) GetScaledWidth(Canvas)

Convenience for calling GetScaledWidth(Int32) with the target density of the given Canvas.

GetScaledWidth(DisplayMetrics) GetScaledWidth(DisplayMetrics)

Convenience for calling GetScaledWidth(Int32) with the target density of the given DisplayMetrics.

GetScaledWidth(Int32) GetScaledWidth(Int32)

Convenience method that returns the width of this bitmap divided by the density scale factor.

JavaFinalize() JavaFinalize()

Invoked when the garbage collector has detected that this instance is no longer reachable.

(Inherited from Object)
LockPixels() LockPixels()
Notify() Notify()

Causes a thread which is waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
NotifyAll() NotifyAll()

Causes all threads which are waiting on this object's monitor (by means of calling one of the wait() methods) to be woken up.

(Inherited from Object)
PrepareToDraw() PrepareToDraw()

Rebuilds any caches associated with the bitmap that are used for drawing it.

Reconfigure(Int32, Int32, Bitmap+Config) Reconfigure(Int32, Int32, Bitmap+Config)
Recycle() Recycle()

Free the native object associated with this bitmap, and clear the reference to the pixel data.

SameAs(Bitmap) SameAs(Bitmap)

Given another bitmap, return true if it has the same dimensions, config, and pixel data as this bitmap.

SetConfig(Bitmap+Config) SetConfig(Bitmap+Config)
SetHandle(IntPtr, JniHandleOwnership) SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPixel(Int32, Int32, Color) SetPixel(Int32, Int32, Color)
SetPixels(Int32[], Int32, Int32, Int32, Int32, Int32, Int32) SetPixels(Int32[], Int32, Int32, Int32, Int32, Int32, Int32)
SetPremultiplied(Boolean) SetPremultiplied(Boolean)
ToArray<T>() ToArray<T>() Inherited from Object
ToString() ToString()

Returns a string containing a concise, human-readable description of this object.

(Inherited from Object)
UnlockPixels() UnlockPixels()
UnregisterFromRuntime() UnregisterFromRuntime() Inherited from Object
Wait() Wait()

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

(Inherited from Object)
Wait(Int64) Wait(Int64)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
Wait(Int64, Int32) Wait(Int64, Int32)

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the specified timeout expires.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags) WriteToParcel(Parcel, ParcelableWriteFlags)

Write the bitmap and its pixels to the parcel.

Explicit Interface Implementations

IJavaObjectEx.ToLocalJniHandle() IJavaObjectEx.ToLocalJniHandle() Inherited from Object
IJavaPeerable.Disposed() IJavaPeerable.Disposed() Inherited from Object
IJavaPeerable.DisposeUnlessReferenced() IJavaPeerable.DisposeUnlessReferenced() Inherited from Object
IJavaPeerable.Finalized() IJavaPeerable.Finalized() Inherited from Object
IJavaPeerable.SetJniIdentityHashCode(Int32) IJavaPeerable.SetJniIdentityHashCode(Int32) Inherited from Object
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) Inherited from Object
IJavaPeerable.SetPeerReference(JniObjectReference) IJavaPeerable.SetPeerReference(JniObjectReference) Inherited from Object

Extension Methods

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject) JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable) GetJniTypeName(IJavaPeerable)

Applies to