Class PictureRecorder

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class PictureRecorder
    extends Managed
    • Constructor Detail

      • PictureRecorder

        public PictureRecorder()
      • PictureRecorder

        @Internal
        public PictureRecorder​(long ptr)
    • Method Detail

      • beginRecording

        public Canvas beginRecording​(io.github.humbleui.types.Rect bounds)
        Returns the canvas that records the drawing commands.
        Parameters:
        bounds - the cull rect used when recording this picture. Any drawing the falls outside of this rect is undefined, and may be drawn or it may not.
        Returns:
        the canvas.
      • getRecordingCanvas

        @Nullable
        public @Nullable Canvas getRecordingCanvas()
        Returns:
        the recording canvas if one is active, or null if recording is not active.
      • finishRecordingAsPicture

        public Picture finishRecordingAsPicture()

        Signal that the caller is done recording. This invalidates the canvas returned by beginRecording(Rect)/getRecordingCanvas().

        The returned picture is immutable. If during recording drawables were added to the canvas, these will have been "drawn" into a recording canvas, so that this resulting picture will reflect their current state, but will not contain a live reference to the drawables themselves.

      • finishRecordingAsPicture

        public Picture finishRecordingAsPicture​(@NotNull
                                                @NotNull io.github.humbleui.types.Rect cull)
        Signal that the caller is done recording, and update the cull rect to use for bounding box hierarchy (BBH) generation. The behavior is the same as calling finishRecordingAsPicture(), except that this method updates the cull rect initially passed into beginRecording(Rect).
        Parameters:
        cull - the new culling rectangle to use as the overall bound for BBH generation and subsequent culling operations.
        Returns:
        the picture containing the recorded content.
      • _nMake

        @Internal
        public static long _nMake()

        Signal that the caller is done recording. This invalidates the canvas returned by beginRecording(Rect)/getRecordingCanvas().

        Unlike finishRecordingAsPicture(), which returns an immutable picture, the returned drawable may contain live references to other drawables (if they were added to the recording canvas) and therefore this drawable will reflect the current state of those nested drawables anytime it is drawn or a new picture is snapped from it (by calling Drawable.makePictureSnapshot()).

      • _nGetFinalizer

        @Internal
        public static long _nGetFinalizer()
      • _nBeginRecording

        @Internal
        public static long _nBeginRecording​(long ptr,
                                            float left,
                                            float top,
                                            float right,
                                            float bottom)
      • _nGetRecordingCanvas

        @Internal
        public static long _nGetRecordingCanvas​(long ptr)
      • _nFinishRecordingAsPicture

        @Internal
        public static long _nFinishRecordingAsPicture​(long ptr)
      • _nFinishRecordingAsPictureWithCull

        @Internal
        public static long _nFinishRecordingAsPictureWithCull​(long ptr,
                                                              float left,
                                                              float top,
                                                              float right,
                                                              float bottom)
      • _nFinishRecordingAsDrawable

        @Internal
        public static long _nFinishRecordingAsDrawable​(long ptr)