Skip to content

2.2.0

Latest

Choose a tag to compare

@chrisbanes chrisbanes released this 02 Dec 10:44
· 7 commits to main since this release

Added

  • GlassDefaults.continuousShape exposes the default continuous 16 dp shape for clips, borders and
    indications (#1743).
  • Glass fallback rendering blurs captured content on Android 12 and 12L hardware and uses an
    automatic scrim on unblurred paths. Set fallbackColor to replace or disable that scrim. Clear
    uses its light response in both system appearances
    (#1731,
    #1754).
  • Continuous Glass corner shapes interpolate their corners and smoothing with Compose's
    Interpolatable.lerp (#1752).
  • Glass supports continuous, iOS-style corners with the new ContinuousRoundedCornerShape, passed
    to GlassStyle's shape. Masking, refraction, lighting, and the rim all follow the smoothed
    corners, and the same shape works with Modifier.clip and Modifier.border. Opposite corners
    that overlap, as in a leaf, keep their smoothing, alone and in a hazeGlassContainer
    (#1734,
    #1749).
  • Glass styles can draw a thin light band inside a surface's top and bottom edges with
    rimHighlight(intensity, width, sides), where sides sets how strongly the left and right edges
    are lit. It follows merged container shapes
    (#1742).
  • Glass interaction responses accept a scale up to 1.2f, so a pressed surface can grow instead of
    shrinking. A grown member of a hazeGlassContainer merges with nearby neighbours while pressed
    (#1735).
  • Glass styles can draw a thin line just outside a surface's shape with edgeOutline(color, width),
    separating the Glass from its backdrop. The outline follows merged container shapes and leaves
    the rim visible up to the outermost pixel inside a straight node-bound edge. Limited renderers
    draw an equivalent stroke (#1741,
    #1798). Merged surfaces keep their outlines
    during spring overshoot (#1809,
    #1813 by
    Matt Van Horn).
  • edgeOutline accepts topAndBottomStrength, which weakens the outline on the top and bottom
    edges and blends through corners; limited renderers draw a uniform outline at the mean strength
    (#1755).

Changed

  • Below HazePerformanceMode.Quality, a wide Glass blur on Android reads a reduced copy of its
    source, scaled with the quality fraction, and mixes it with the sharp source in fewer render
    passes. Nine Glass surfaces used about 21% less CPU frame time at P90 on a Pixel 6, and lazy
    grids of Glass about 24% less. Quality keeps the platform blur; thin, high-contrast detail
    behind Glass can blur slightly differently in Balanced and Performance
    (#1901,
    #1903).
  • On Android, a Glass change that affects only its optics, such as a press response or a tint
    animation, replaces the surface's final effect instead of re-recording its layers, so they are no
    longer re-rendered every frame. Nine pressed Glass surfaces used 33–40% less CPU frame time at P90
    on a Pixel 8a (#1918).
  • Glass uses continuous 16 dp corners when no shape is authored. Regular and Clear draw a thin dark
    outline, strongest on the left and right and absent from Clear's top and bottom, and a top and
    bottom rim highlight, stronger on Clear; dark Regular has less backdrop contrast and a fainter
    rim. Clear brightens its left and right edges much less. Values were tuned side by side with
    iOS 27 Liquid Glass. Custom styles inherit Regular's edges, which can be disabled with
    later edgeOutline and rimHighlight writes. Authored shapes and
    Clear's appearance-independent ordinary response are preserved
    (#1736,
    #1743).
  • Glass with circular corners does less shader work across the flat interior of a surface, most
    noticeably in merged containers. The rendered result is unchanged
    (#1766).
  • Glass containers do less shader work for members that are too far from a pixel to shape it.
    The rendered result is unchanged (#1766).
  • Each member of a merged hazeGlassContainer surface keeps its own lightPosition, placed on
    that member as when it stands alone, and highlights blend across the bridge like member colours.
    Members with different light positions now merge. A groupKey group still takes its first
    member's light, and the fallback renderer draws a highlight for each member
    (#1474).
  • On Android, HazePerformanceMode.Performance and other modes below Balanced refract and light
    continuous Glass corners as circular corners of the same radius. The silhouette and edge softness
    stay exact; Balanced and Quality are unchanged
    (#1766).
  • Haze sources that feed effects in another window, or same-window effects on Android 12
    (API 31), queue at most one refresh coroutine for a burst of snapshot applies instead of one per
    apply. Effects refresh in the same frame as before
    (#1843).
  • Core haze no longer declares a dependency on androidx.collection, which nothing in it uses.
    Consumers still receive it through Compose
    (#1845).
  • Android 12 and 12L Blur with custom shader brushes no longer rebuilds its mask, tint and noise
    shaders, or its layer paints, for each progressive band and colour-filter pass when it redraws
    with an unchanged style (#1857).
  • Unmasked Blur scrim colour filters now receive the effect alpha as input instead of being faded
    afterwards. A colour filter that replaces alpha, such as ColorFilter.tint(color, BlendMode.Src),
    therefore no longer fades with the effect's alpha. The default tint and other alpha-preserving
    filters are unchanged (#1828).
  • The bundled Android baseline profile covers more of the current Haze runtime
    (#1967).

Deprecated

  • GlassDefaults.shape retains its circular value and released getter type. Use
    GlassDefaults.continuousShape for the new default, or RoundedCornerShape(16.dp) to keep the
    former corners (#1743).

Fixed

  • Blur rejects non-finite radii before they reach platform rendering. On Skiko, a single-axis
    blur leaves the zero-radius axis unblurred
    (#1838,
    #1863 by
    Adarsh Sahu).
  • On Android 12 and 12L, transparent SolidColor brush tints using BlendMode.Src preserve
    earlier colour effects on the custom shader path
    (#1812).
  • A Glass surface that returns to native composition after an over-budget fallback no longer uses
    its material scale from before the fallback for one frame. A material scaled by an interaction
    during the fallback is no longer clipped at the layer edge, and still joins overlapping surfaces,
    on the recovery frame (#1942).
  • Blur's scrim fallback and Android's RenderScript blur now draw
    HazeColorEffect.tint(SolidColor(color)) exactly like HazeColorEffect.tint(color). The scrim
    fallback strengthens the tint with the blur radius, and RenderScript tints the whole blurred area
    instead of only the node's bounds (#1921).
  • HazeEffectNode no longer drops or churns source preDrawListeners when DirtyFields.Areas
    re-evaluates to an unchanged area set or hits the unplaced position-strategy early return
    (#1929,
    #1939 by
    Adarsh Sahu).
  • In a Glass container, a set of compatible members split by an intervening surface now merges
    up to four members in each drawn run. Later members are no longer left unmerged, and a cap
    overflow that didn't happen is no longer logged
    (#1915).
  • A groupKey member whose style differs from its group's only in a value such as contrast no
    longer widens the group's container optical size
    (#1915).
  • A hazeEffect nested inside two hazeSources that use the same state, where the outer source has
    the lower zIndex, no longer throws on its first draw with HazeSourceSelection.Behind, under
    HazeInput.Sources or while Backdrop falls back to sources. Behind now excludes every same-state
    ancestor hazeSource, not only the nearest one.
    As a result, a relocated effect surface whose owner draws outside the enclosing outer source no
    longer samples that source (#1905).
  • RenderScript Blur on Android 6 to 11 (API 23 to 30) no longer leaks each blur context it
    releases, with its output bitmap, buffers and input surface, after a resize, an invalidation, a
    memory trim or a detach (#1904).
  • RenderScript Blur on Android 6 to 11 (API 23 to 30, blurEnabled(true)) now keeps the clear end
    of a progressive blur over HazeInput.Content, instead of erasing the content there
    (#1922).
  • Android Blur no longer crashes when a linear progressive blur uses an easing that overshoots,
    such as EaseInBack or an elastic easing, on Android 12 and 12L or after a runtime shader
    failure. Each blur layer's intensity stays within 0f..1f
    (#1906).
  • With HazeFeatureFlags.isPlatformBackdropEnabled, a relocated Backdrop effect no longer prepares
    its platform effect again on every frame while its owner is over the native composition budget,
    and an effect that declines a frame no longer reports a native capture that forces an isolated
    layer (#1913).
  • Android Blur's layered linear progressive blur on Android 12 and 12L, or after a runtime shader
    failure, now fades noise and colour filters with the gradient's intensity, matching Android 13+
    (#1910).
  • Glass progressive blur with a SolidColor brush, as in
    HazeProgressive.Brush(SolidColor(...)), blurs uniformly instead of reading an unset or stale
    mask (#1907).
  • Square Glass surfaces on the fallback renderer no longer draw their highlight, interaction light
    or edge outside their bounds (#1908).
  • Glass surfaces with fractional sample padding no longer replay their source up to nine times
    each frame to fill sub-pixel slivers at the sample's edges.
  • A Glass container surface that only moves, as when its members scroll, no longer re-runs its
    style update each frame.
  • The Glass sample bottom tabs no longer throw for an empty tab list, and the Glass sample slider
    finishes an active drag when it is resized or disabled
    (#1848).
  • Android Blur no longer keeps a previous draw's shader, colour filter or path effect on reused
    internal paints, and reused paints keep Compose's default antialiasing
    (#1844).
  • Configured effect surfaces keep drawing a HazeInput.Sources cluster as one, instead of
    splitting it, while a member is zero-size or unplaced
    (#1851).
  • The Android ExoPlayer sample prepares and releases the player that is current, and detaches it from
    its view when the sample is left or the player is replaced
    (#1847).
  • Android Blur falls back instead of crashing when a runtime shader cannot be built: the combined
    noise and tint pass uses the separate noise and tint effects, and progressive and custom-brush
    effects draw through the routes Android 12 uses until the effect is detached. A failed custom-brush
    draw no longer leaves a canvas layer open (#1836).
  • The web sample shows its unsupported-browser message instead of throwing when the browser cannot
    compile Wasm (#1849).
  • The macOS sample keeps its application delegate alive, so closing the last window quits the app
    (#1850).
  • Glass containers no longer recluster their members each time a HazeInput.Content member's own
    content redraws (#1846).
  • Blur and Glass effects keep finite layer bounds, and apply their retention policy, while every
    selected source is still unpositioned (#1833).
  • Pressing a merged Glass container member with a near-zero scale no longer crashes while drawing
    its merged surface (#1840).
  • RenderScript Blur releases its shared RenderScript context on memory trim until the next blurred
    draw, recovers from native failures without crashing or presenting a failed frame, and skips
    native work at zero blur radius (#1835).
  • Android Blur noise no longer grows coarser at reduced capture scales. RenderScript and the API
    31–32 custom-brush path draw the same grain as full resolution; the RenderEffect path draws one
    noise texel per capture pixel (#1832).
  • RenderScript Blur publishes each blurred frame from the main thread, so the renderer never reads
    its pixels while a later frame is being written
    (#1830).
  • RenderScript Blur (API 23–30, blurEnabled(true)) no longer darkens a semi-transparent
    background when the capture size is not a multiple of 4, and draws tints, colour filters and noise
    over the effect's actual layer bounds when that layer is clipped or offset
    (#1912).
  • Effects keep following a source's size and input-sharing outsets after a static
    CompositionLocal change refreshes their configuration
    (#1829).
  • Masked and partially transparent Blur scrim tints apply their blend mode against the content
    behind them, instead of against transparent pixels
    (#1828).
  • Blur scrim fallback tints using BlendMode.Modulate, SrcIn or DstIn no longer vanish under a
    mask, progressive effect or alpha below 1. Clear, SrcOut and DstAtop now ignore the mask
    and alpha there (#1909).
  • Merged Glass clusters that fall back from HazeInput.Backdrop to their source fallback no longer keep
    redrawing while idle (#1827).
  • Progressive blur avoids long first-render pauses on Windows Direct3D, including when opening a
    new window (#1260).
  • Progressive blur preserves edge opacity by keeping accepted samples inside the captured content
    (#1727).
  • Progressive blur keeps its crop within the captured content when downscaling, including expanded
    bounds and fractional offsets (#1728).
  • Progressive blur no longer lets the page show through the edges of its content in the Default and
    Performance modes, where the mask leaves those edges unblurred
    (#1772).
  • Blur masks and brush tints keep their authored positions when captured content is scaled or
    resized (#1730).
  • Glass no longer lets the layer beneath show through the straight edges of its surfaces, such as
    a bar docked to a window edge. Unmerged surfaces now cover the outermost pixels of those edges
    whatever their corners, with or without an edge outline or expanded layer bounds, except with
    HazeInput.Backdrop. Square surfaces do so at full and reduced input scale; rounded and
    continuous ones in the Default and Quality modes. A surface that refracts outwards, such as a
    strongly concave one, still shows the layer beneath where its refraction reads past the content
    it captured. These surfaces also draw fine detail more sharply, because their content is no
    longer resampled at a sub-pixel offset
    (#1775,
    #1785).
  • A HazeSourceSelection.where predicate whose state changes on a background thread while its
    effect is being removed no longer throws "This node does not have an owner"
    (#1837).
  • Android Blur switches between its RenderEffect and fallback paths when an attached effect's canvas
    changes between hardware and software acceleration, without needing a style change
    (#1834).
  • A relocated effect with HazeSourceRetention.ClearWhenUnavailable, such as an unmerged
    hazeGlassContainer member, no longer prepares its effect and then clears it on every redraw while
    none of its sources are available (#1924).
  • RenderScript Blur (Android 6 to 11, API 23 to 30, with blurEnabled(true)) no longer presents
    mis-scaled content for a frame or more when the blur radius steps up from 0 and the capture scale
    changes, such as a radius above 25 px or a performance-mode change
    (#1923).
  • An invisible Glass rim highlight, with zero intensity or zero width, no longer keeps otherwise
    identical hazeGlassContainer members from merging
    (#1916).
  • Standalone square Glass surfaces with no edge softness now clip to their node when Increase
    Contrast or Show Borders softens their edge (#1916).
  • Merged hazeGlassContainer clusters with HazeInput.Sources and
    HazeSourceRetention.ClearWhenUnavailable no longer prepare their effect while no source is
    available (#1950,
    #1954 by
    Adarsh Sahu).