The Foundations of Resolution Independence: Density-Independent Pixels vs Points
Physical display hardware renders images using microscopic physical pixels (PX). Because mobile displays vary from low-density 130 PPI budget screens to 460+ PPI Super Retina OLED panels, specifying UI dimensions in raw hardware pixels causes identical layouts to render microscopic on high-density devices. To achieve resolution independence, mobile operating systems abstract physical pixels: Google Android defines the Density-Independent Pixel (DP), anchored to a 160 DPI baseline where 1dp = 1px, while Apple iOS defines the Point (PT), anchored to 163 PPI where 1pt = 1px on legacy @1x displays.
// Universal Density Scaling Mathematical Formulas
// Android: px = dp * (dpi / 160)
// iOS: px = pt * scale_factor (where @2x = 2.0, @3x = 3.0)
// SP: px = sp * (dpi / 160) * font_scale_factor
// PPI: sqrt(width_px^2 + height_px^2) / diagonal_inches