Density
-
Cmn
interface Density : FontScaling
AwaitPointerEventScope |
Receiver scope for awaiting pointer events in a call to |
CacheDrawScope |
Handle to a drawing environment that enables caching of content based on the resolved size. |
DrawScope |
Creates a scoped drawing environment with the provided |
GraphicsLayerScope |
A scope which can be used to define the effects to apply for the content, such as scaling ( |
InjectionScope |
The receiver scope of all input injection lambdas offered in |
IntrinsicMeasureScope |
The receiver scope of a layout's intrinsic measurements lambdas. |
Placeable.PlacementScope |
Receiver scope that permits explicit placement of a |
PointerInputScope |
Receiver scope for |
PressGestureScope |
Receiver scope for |
RulerScope |
A scope used in |
ShadowScope |
Scope that can be used to define properties to render either a drop shadow or inner shadow. |
SubspaceMeasureScope |
The receiver scope of a layout's measure lambda. |
TextAutoSizeLayoutScope |
An entity that allows performing text layout for auto sizing text. |
ApproachIntrinsicMeasureScope |
The receiver scope of a layout's intrinsic approach measurements lambdas. |
ApproachMeasureScope |
|
CanvasDrawScope |
Implementation of |
ContentDrawScope |
Receiver scope for drawing content into a layout, where the content can be drawn between other canvas operations. |
DragAndDropSourceScope |
This interface is deprecated. Replaced by a callback for obtain a transfer data,start detection is performed by Compose itself |
DropShadowScope |
Scope that provides the capability to configure the properties of a drop shadow in order to support efficient transformations without recomposition |
InnerShadowScope |
Scope that provides the capability to configure the properties of an inner shadow in order to support efficient transformations without recomposition |
KeyInjectionScope |
The receiver scope of the key input injection lambda from |
LazyLayoutMeasureScope |
The receiver scope of a |
MeasureScope |
The receiver scope of a layout's measure lambda. |
MouseInjectionScope |
The receiver scope of the mouse input injection lambda from |
MultiModalInjectionScope |
The receiver scope of the multi-modal input injection lambda from |
RotaryInjectionScope |
The receiver scope of rotary input injection lambda from |
SubcomposeMeasureScope |
The receiver scope of a |
TouchInjectionScope |
The receiver scope of the touch input injection lambda from |
A density of the screen. Used for the conversions between pixels, Dp, Int and TextUnit.
import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.unit.dp val sizeInPx = with(LocalDensity.current) { 16.dp.toPx() }
Summary
Public functions |
||
|---|---|---|
open Int |
Cmn
|
|
open Int |
Convert Sp to |
Cmn
|
open Dp |
Cmn
|
|
open Dp |
Convert a |
Cmn
|
open DpSize |
Cmn
|
|
open Float |
Convert |
Cmn
|
open Float |
Convert Sp to pixels. |
Cmn
|
open Rect |
Cmn
|
|
open Size |
Cmn
|
|
open TextUnit |
Convert an |
Cmn
|
open TextUnit |
Convert a |
Cmn
|
Inherited functions |
|---|
Public functions
toPx
open fun TextUnit.toPx(): Float
Convert Sp to pixels. Pixels are used to paint to Canvas.
| Throws | |
|---|---|
kotlin.IllegalStateException |
if TextUnit other than SP unit is specified. |