SurfaceGeometrySpec


Describes the virtual three-dimensional shape that a lit surface is treated as having.

A spec is resolution independent. It is resolved into concrete geometry once the surface's size, layout direction and density are known, so a single spec can be shared between surfaces of different sizes.

Lighting is currently implemented only for rectangles, and for rounded rectangles whose corners each have a circular radius (x == y). Any other shape, including CutCornerShape, GenericShape, and rounded rectangles with elliptical corner radii, throws an IllegalArgumentException when the spec is resolved.

Summary

Public companion functions

SurfaceGeometrySpec
concave(shape: Shape, thickness: Dp, bevelWidth: Dp)

A surface that dishes away from the viewer, like a bowl.

Cmn
SurfaceGeometrySpec
convex(shape: Shape, thickness: Dp, bevelWidth: Dp)

A surface that bulges towards the viewer, like a dome.

Cmn
SurfaceGeometrySpec
flat(shape: Shape, thickness: Dp)

A surface whose interior is flat and faces the viewer directly.

Cmn

Protected constructors

Cmn

Public companion functions

concave

fun concave(shape: Shape, thickness: Dp, bevelWidth: Dp): SurfaceGeometrySpec

A surface that dishes away from the viewer, like a bowl.

The interior is flat and the outline is wrapped in a curved band whose width is determined by bevelWidth. The normals tilt inwards, towards the center of the surface. The curved surface falls into shadow on the side facing a light and illuminates on the opposite side, giving the surface a depressed shade.

Parameters
shape: Shape

outline of the lit surface. See the class documentation for the shapes that are supported.

thickness: Dp

height of the surface towards the viewer. The attenuation of the light is calculated based on the resultant distance lightElevation - surfaceThickness. The thickness is considered uniform over the surface.

bevelWidth: Dp

width of the curved band along the outline. Clamped to half of the surface's smaller dimension when resolved.

convex

fun convex(shape: Shape, thickness: Dp, bevelWidth: Dp): SurfaceGeometrySpec

A surface that bulges towards the viewer, like a dome.

The interior is flat and the outline is wrapped in a curved band whose width is determined by bevelWidth. The normals tilt outwards, away from the center of the surface. The curved surface catches a highlight on the side facing a light and falls into shadow on the opposite side, giving the surface a rounded, physical edge.

Parameters
shape: Shape

outline of the lit surface. See the class documentation for the shapes that are supported.

thickness: Dp

height of the surface towards the viewer. The attenuation of the light is calculated based on the resultant distance lightElevation - surfaceThickness. The thickness is considered uniform over the surface.

bevelWidth: Dp

width of the curved band along the outline. Clamped to half of the surface's smaller dimension when resolved.

flat

fun flat(shape: Shape, thickness: Dp): SurfaceGeometrySpec

A surface whose interior is flat and faces the viewer directly.

Every interior pixel shares the same normal, so the interior takes a single even shade This reads as a sheet of material rather than as a solid object, and SurfaceMaterial.fresnel adds an even brightening instead of a rim.

Parameters
shape: Shape

outline of the lit surface. See the class documentation for the shapes that are supported.

thickness: Dp

height of the surface towards the viewer. The attenuation of the light is calculated based on the resultant distance lightElevation - surfaceThickness.

Protected constructors

SurfaceGeometrySpec

protected SurfaceGeometrySpec()