@@ -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,29 @@ 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+ ///
712+ /// {@macro dart.ui.sceneBuilder.oldLayer}
713+ PictureEngineLayer addPicture (
703714 Offset offset,
704715 Picture picture, {
705716 bool isComplexHint = false ,
706717 bool willChangeHint = false ,
718+ PictureEngineLayer ? oldLayer,
707719 }) {
720+ assert (_debugCheckCanBeUsedAsOldLayer (oldLayer, 'addPicture' ));
721+ final EngineLayer engineLayer = EngineLayer ._();
708722 final int hints = (isComplexHint ? 1 : 0 ) | (willChangeHint ? 2 : 0 );
709- _addPicture (offset.dx, offset.dy, picture, hints);
723+ _addPicture (engineLayer, offset.dx, offset.dy, picture, hints, oldLayer? ._nativeLayer);
724+ return PictureEngineLayer ._(engineLayer);
710725 }
711726
712- void _addPicture (double dx, double dy, Picture picture, int hints)
713- native 'SceneBuilder_addPicture' ;
727+ void _addPicture (
728+ EngineLayer outEngineLayer,
729+ double dx,
730+ double dy,
731+ Picture picture,
732+ int hints,
733+ EngineLayer ? oldLayer) native 'SceneBuilder_addPicture' ;
714734
715735 /// Adds a backend texture to the scene.
716736 ///
0 commit comments