MaplySnapshotDelegate

Objective-C

@protocol MaplySnapshotDelegate

Swift

protocol MaplySnapshotDelegate

Snapshot Delegate

Snapshots can be run as callbacks after the rendering.  If you keep your area
small enough you can even do it every frame.  This is the protocol for
snapshot delegates.
  • Return true if you want a snapshot for this frame

    Declaration

    Objective-C

    - (_Bool)needSnapshot:(NSTimeInterval)now
                    viewC:(MaplyBaseViewController *_Nonnull)viewC;

    Swift

    func needSnapshot(_ now: TimeInterval, viewC: MaplyBaseViewController) -> Bool
  • If you want the whole thing return CGRectZero, otherwise return the rectangle you want based on the number of pixels. So multiply by the scale first.

    Declaration

    Objective-C

    - (CGRect)snapshotRect;

    Swift

    func snapshotRect() -> CGRect
  • Here’s your snapshot data. Do what you will, but do it quickly. You can hold onto the NSData.

    Declaration

    Objective-C

    - (void)snapshot:(NSData *_Nonnull)snapshotData;

    Swift

    func snapshot(_ snapshotData: Data)
  • If you want a specific render target, return it. Otherwise nil for the screen.

    Declaration

    Objective-C

    - (MaplyRenderTarget *_Nullable)renderTarget;

    Swift

    func renderTarget() -> MaplyRenderTarget?
  • If a render target calculates the min/max values after rendering, this snapshot callback will be called as well

    Declaration

    Objective-C

    - (void)snapshotMinMax:(NSData *_Nonnull)snapshotData;

    Swift

    optional func snapshotMinMax(_ snapshotData: Data)