depth

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package depth renders Material-style cast shadows under rectangular regions by composing linear gradients.

A shadow is a soft black fringe around a "shadow rectangle" — the caller's bounds shifted downward by half the elevation extent — to approximate light from above. The geometry mirrors pulse/glow.Halo but with two differences:

  • The colour is a fixed Material-style key-shadow black; intensity is a function of elevation, not a caller knob.
  • The shadow rectangle's interior is filled with the inner alpha so the strip extending below bounds remains visible once the caller paints their foreground rectangle on top.

Both extent (gradient falloff distance) and offset (downward shift of the shadow rectangle) are derived from tokens.ElevationLevel via tokens.Elevation: extent equals the level's dp value; offset is half the extent.

The shadow is painted before the foreground; the caller draws their rectangle on top of Shadow's output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Shadow

func Shadow(gtx layout.Context, bounds image.Rectangle, level tokens.ElevationLevel)

Shadow paints a Material-style cast shadow under bounds onto gtx.Ops at the given elevation level. The shadow is biased downward to approximate light from above.

At tokens.Level0 (and any level whose dp value rounds to zero pixels at the current metric) the function is a no-op.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL