Expand description
A collection of coordinate spaces and their corresponding Point, Size and Rect types.
Physical pixels take into account the device pixel ratio and their dimensions tend to correspond to the allocated size of resources in memory, while logical pixels don’t have the device pixel ratio applied which means they are agnostic to the usage of hidpi screens and the like.
The terms “layer” and “stacking context” can be used interchangeably in the context of coordinate systems.
Structs§
- Au
- An App Unit, the fundamental unit of length in Servo. Usually
1/60th of a pixel (see
AU_PER_PX
) - Device
Pixel - Geometry in the coordinate system of the render target (screen or intermediate surface) in physical pixels.
- Framebuffer
Pixel - Geometry in the coordinate system of the framebuffer in physical pixels. It’s Y-flipped comparing to DevicePixel.
- Layout
Pixel - Geometry in a stacking context’s local coordinate space (logical pixels).
- Picture
Pixel - Geometry in the coordinate system of a Picture (intermediate surface) in physical pixels.
- Raster
Pixel - Geometry gets rasterized in a given root coordinate space. This is often the root spatial node (world space), but may be a local space for a variety of reasons (e.g. perspective).
- Texel
Rect - Stores two coordinates in texel space. The coordinates are stored in texel coordinates because the texture atlas may grow. Storing them as texel coords and normalizing the UVs in the vertex shader means nothing needs to be updated on the CPU when the texture size changes.
- Tiles
- Offset in number of tiles.
- World
Pixel - Geometry in the document’s coordinate space (logical pixels).
Traits§
Functions§
- device_
rect_ as_ framebuffer_ rect - device_
size_ as_ framebuffer_ size - layout_
rect_ as_ picture_ rect - layout_
vector_ as_ picture_ vector
Type Aliases§
- Blob
Dirty Rect - Blob
ToDevice Translation - Device
Box2D - Device
Homogeneous Vector - Device
IntLength - Device
IntPoint - Device
IntRect - Device
IntSide Offsets - Device
IntSize - Device
Pixel Scale - Scaling ratio from world pixels to device pixels.
- Device
Point - Device
Rect - Device
Size - Device
Vector2D - Framebuffer
IntPoint - Framebuffer
IntRect - Framebuffer
IntSize - Image
Dirty Rect - Layout
IntPoint - Layout
IntRect - Layout
IntSize - Layout
Point - Layout
Point3D - Layout
Point Au - Layout
Rect - Layout
Rect Au - Layout
Side Offsets - Layout
Side Offsets Au - Layout
Size - Layout
Size Au - Layout
ToDevice Scale - A complete scaling ratio from layout space to device pixel space.
- Layout
ToPicture Transform - Layout
ToRaster Transform - Layout
ToWorld Scale - Scaling ratio from layout to world. Used for cases where we know the layout is in world space, or specifically want to treat it this way.
- Layout
ToWorld Transform - Layout
Transform - Layout
Vector2D - Layout
Vector2D Au - Layout
Vector3D - Picture
Box2D - Picture
IntPoint - Picture
IntRect - Picture
IntSize - Picture
Point - Picture
Point3D - Picture
Rect - Picture
Size - Picture
ToLayout Transform - Picture
ToRaster Transform - Picture
Vector2D - Picture
Vector3D - Raster
IntPoint - Raster
IntRect - Raster
IntSize - Raster
Pixel Scale - Scaling ratio from picture pixels to raster pixels (e.g. if scaling a picture surface up/down).
- Raster
Point - Raster
Point3D - Raster
Rect - Raster
Size - Raster
ToLayout Transform - Raster
ToPicture Transform - Raster
Vector2D - Raster
Vector3D - Tile
Offset - Tile
Range - World
IntRect - World
Point - World
Point3D - World
Rect - World
Size - World
ToLayout Transform - World
Vector2D - World
Vector3D