Share via


Canvas.Density Property

Definition

Returns the target density of the canvas. -or- Specifies the density for this Canvas' backing bitmap.

public virtual int Density { [Android.Runtime.Register("getDensity", "()I", "GetGetDensityHandler")] get; [Android.Runtime.Register("setDensity", "(I)V", "GetSetDensity_IHandler")] set; }
[<get: Android.Runtime.Register("getDensity", "()I", "GetGetDensityHandler")>]
[<set: Android.Runtime.Register("setDensity", "(I)V", "GetSetDensity_IHandler")>]
member this.Density : int with get, set

Property Value

Returns the current target density of the canvas, which is used to determine the scaling factor when drawing a bitmap into it.

Attributes

Remarks

Property getter documentation:

Returns the target density of the canvas. The default density is derived from the density of its backing bitmap, or Bitmap#DENSITY_NONE if there is not one.

Java documentation for android.graphics.Canvas.getDensity().

Property setter documentation:

Specifies the density for this Canvas' backing bitmap. This modifies the target density of the canvas itself, as well as the density of its backing bitmap via Bitmap#setDensity(int) Bitmap.setDensity(int).

Java documentation for android.graphics.Canvas.setDensity(int).

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

See also