@@ -188,6 +188,15 @@ class PhysicalShapeEngineLayer extends _EngineLayerWrapper {
188188 PhysicalShapeEngineLayer ._(EngineLayer nativeLayer) : super ._(nativeLayer);
189189}
190190
191+ /// An opaque handle to a picture engine layer.
192+ ///
193+ /// Instances of this class are created by [SceneBuilder.addPicture] .
194+ ///
195+ /// {@macro dart.ui.sceneBuilder.oldLayerCompatibility}
196+ class PictureEngineLayer extends _EngineLayerWrapper {
197+ PictureEngineLayer ._(EngineLayer nativeLayer) : super ._(nativeLayer);
198+ }
199+
191200/// Builds a [Scene] containing the given visuals.
192201///
193202/// A [Scene] can then be rendered using [FlutterView.render] .
@@ -699,18 +708,27 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
699708 /// Adds a [Picture] to the scene.
700709 ///
701710 /// The picture is rasterized at the given offset.
702- void addPicture (
711+ PictureEngineLayer addPicture (
703712 Offset offset,
704713 Picture picture, {
705714 bool isComplexHint = false ,
706715 bool willChangeHint = false ,
716+ PictureEngineLayer ? oldLayer,
707717 }) {
718+ assert (_debugCheckCanBeUsedAsOldLayer (oldLayer, 'addPicture' ));
719+ final EngineLayer engineLayer = EngineLayer ._();
708720 final int hints = (isComplexHint ? 1 : 0 ) | (willChangeHint ? 2 : 0 );
709- _addPicture (offset.dx, offset.dy, picture, hints);
721+ _addPicture (engineLayer, offset.dx, offset.dy, picture, hints, oldLayer? ._nativeLayer);
722+ return PictureEngineLayer ._(engineLayer);
710723 }
711724
712- void _addPicture (double dx, double dy, Picture picture, int hints)
713- native 'SceneBuilder_addPicture' ;
725+ void _addPicture (
726+ EngineLayer outEngineLayer,
727+ double dx,
728+ double dy,
729+ Picture picture,
730+ int hints,
731+ EngineLayer ? oldLayer) native 'SceneBuilder_addPicture' ;
714732
715733 /// Adds a backend texture to the scene.
716734 ///
0 commit comments