# Choose a paint scope, mask, or filter

[Canonical page](https://nothing.graphics/docs/format/guides/compositing) · [Page source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/docs/guides/compositing.md)

Control which pixels an operation reads and where its result can appear.



Read siblings in drawing order, with later drawables painting over earlier ones. A group collects its children so a single transform, mask or opacity can affect their combined picture. A shape assembles its own fill and strokes with any attached drawables. Use a mask for coverage, a source filter for the drawable’s picture, and a backdrop filter for earlier painting behind it. [Compositing and coverage](https://nothing.graphics/docs/format/spec/spatial#compositing-and-coverage)

| To control…                                     | Put this on the drawable                                                                                                                                                                           |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The silhouette of a window                      | A `mask type="geometry"` with one source shape. The source’s geometry defines coverage, including holes.                                                                                           |
| A soft or brightness-dependent matte            | An `alpha` mask for the source picture’s alpha, or a `luminance` mask for its alpha-weighted brightness. An opaque black source gives full coverage in an alpha mask and zero in a luminance mask. |
| The pixels made by the drawable itself          | A `filter`. Its operations read in order, so a blur after a drop shadow sees the source and the shadow.                                                                                            |
| The picture already painted behind the drawable | A `backdrop-filter` containing one `blur`. A shape supplies its geometry as the effect’s aperture. A group or sequence needs an explicit mask.                                                     |

To keep a window fixed while its picture pans, mask the enclosing group and translate the child sequence. A mask refers to its owner regardless of its position among the owner’s children. Moving a drawable into the masked group changes its membership, so that drawable now passes through the same window. The [moving-card walkthrough](https://github.com/gridaco/nothing/blob/main/ncf/conformance/composition-card.md) shows the exact pixels that change when the progress line joins the masked group. [Mask source rules](https://nothing.graphics/docs/format/spec/graphics#mask-on-a-shape)

## Blur the background and cast a separate shadow [#blur-the-background-and-cast-a-separate-shadow]

In the [frosted panel](https://github.com/gridaco/nothing/blob/main/ncf/conformance/backdrop/panel.nothing), the vertical white stripe is painted first. The panel’s backdrop blur spreads light from that stripe under the panel, including into the formerly black pixel at (25, 14). The source drop shadow extends beyond the panel to (51, 16). The yellow stripe at (28, 14) stays sharp because it paints after the panel.

Set only the backdrop `sigma` from 3 to 0. The stripe edge under the tint becomes sharp and the red shadow at (51, 16) keeps the same value. Edit only the shadow’s `dx` to move it while the backdrop blur stays in place. [Backdrop replacement rule](https://nothing.graphics/docs/format/spec/filters#backdrop-blur) · [Layer effect observations](https://github.com/gridaco/nothing/blob/main/ncf/conformance/README.md#layer-effects)

## Find the backdrop for a blend [#find-the-backdrop-for-a-blend]

A normal shape assembles its own source on transparency. An unfiltered pass-through group can expose the enclosing backdrop to its children, so Multiply can see earlier layers. A nonempty source filter creates an isolated source, even when its `blur` has sigma zero. The [source-filter case](https://github.com/gridaco/nothing/blob/main/ncf/conformance/blending/source-filter.nothing) puts a yellow Multiply mark over a blue plate in both scopes. On frame 0 the passing mark turns black at (20, 4), while the isolated mark is still yellow at (20, 20). Removing the isolated group’s blur operation gives it access to the enclosing plate again. [Drawable blending observations](https://github.com/gridaco/nothing/blob/main/ncf/conformance/README.md#drawable-blending)

## Examples

[Download the complete .nothing source](https://nothing.graphics/format/source-and-backdrop/source.nothing) · [Source on GitHub](https://github.com/gridaco/nothing/blob/main/ncf/conformance/backdrop/panel.nothing)

Rendered with ncf-preview at 64 × 32.

- [Frame 0 · Frosted panel](https://nothing.graphics/format/source-and-backdrop/0.webp). A sharp white stripe diffuses under the tinted panel. A thin red shadow extends to the panel’s right, and a yellow stripe paints sharply above the result.

```xml
<scene width="64" height="32" frame-rate="24" background="#000000FF">
  <shape>
    <rect anchor-u="0" anchor-v="0" offset-x="20" width="4" height="32"/>
    <fill><paint><solid color="#FFFFFFFF"/></paint></fill>
  </shape>
  <shape>
    <rect anchor-u="0" anchor-v="0" offset-x="10" offset-y="6" width="40" height="18" corner-radius="3"/>
    <backdrop-filter><blur sigma="3"/></backdrop-filter>
    <fill><paint><solid color="#3080C030"/></paint></fill>
    <filter><drop-shadow dx="4" dy="2" sigma="0" color="#FF0000FF"/></filter>
  </shape>
  <shape>
    <rect anchor-u="0" anchor-v="0" offset-x="28" width="2" height="32"/>
    <fill><paint><solid color="#FFFF00FF"/></paint></fill>
  </shape>
</scene>
```
