func (c *LayerTree) ReplaySnapshot(snapshotId string, fromStep int, toStep int, scale float64) (string, error) {
	var v LayerTreeReplaySnapshotParams
	v.SnapshotId = snapshotId
	v.FromStep = fromStep
	v.ToStep = toStep
	v.Scale = scale
	return c.ReplaySnapshotWithParams(&v)
}
ReplaySnapshot - Replays the layer snapshot and returns the resulting bitmap.
snapshotId - The id of the layer snapshot.
fromStep - The first step to replay from (replay from the very start if not specified).
toStep - The last step to replay to (replay till the end if not specified).
scale - The scale to apply while replaying (defaults to 1).
Returns -  dataURL - A data: URL for resulting image.
package gcdapi
import (
	"encoding/json"
	"github.com/wirepair/gcd/gcdmessage"
)
type LayerTreeScrollRect struct {
	Rect *DOMRect `json:"rect"`  
	Type string   `json:"type"`  
}
type LayerTreeStickyPositionConstraint struct {
	StickyBoxRect                       *DOMRect `json:"stickyBoxRect"`                                  
	ContainingBlockRect                 *DOMRect `json:"containingBlockRect"`                            
	NearestLayerShiftingStickyBox       string   `json:"nearestLayerShiftingStickyBox,omitempty"`        
	NearestLayerShiftingContainingBlock string   `json:"nearestLayerShiftingContainingBlock,omitempty"`  
}
type LayerTreePictureTile struct {
	X       float64 `json:"x"`        
	Y       float64 `json:"y"`        
	Picture string  `json:"picture"`  
}
type LayerTreeLayer struct {
	LayerId                  string                             `json:"layerId"`                             
	ParentLayerId            string                             `json:"parentLayerId,omitempty"`             
	BackendNodeId            int                                `json:"backendNodeId,omitempty"`             
	OffsetX                  float64                            `json:"offsetX"`                             
	OffsetY                  float64                            `json:"offsetY"`                             
	Width                    float64                            `json:"width"`                               
	Height                   float64                            `json:"height"`                              
	Transform                []float64                          `json:"transform,omitempty"`                 
	AnchorX                  float64                            `json:"anchorX,omitempty"`                   
	AnchorY                  float64                            `json:"anchorY,omitempty"`                   
	AnchorZ                  float64                            `json:"anchorZ,omitempty"`                   
	PaintCount               int                                `json:"paintCount"`                          
	DrawsContent             bool                               `json:"drawsContent"`                        
	Invisible                bool                               `json:"invisible,omitempty"`                 
	ScrollRects              []*LayerTreeScrollRect             `json:"scrollRects,omitempty"`               
	StickyPositionConstraint *LayerTreeStickyPositionConstraint `json:"stickyPositionConstraint,omitempty"`  
}
type LayerTreeLayerPaintedEvent struct {
	Method string `json:"method"`
	Params struct {
		LayerId string   `json:"layerId"`  
		Clip    *DOMRect `json:"clip"`     
	} `json:"Params,omitempty"`
}
type LayerTreeLayerTreeDidChangeEvent struct {
	Method string `json:"method"`
	Params struct {
		Layers []*LayerTreeLayer `json:"layers,omitempty"`  
	} `json:"Params,omitempty"`
}
type LayerTree struct {
	target gcdmessage.ChromeTargeter
}
func NewLayerTree(target gcdmessage.ChromeTargeter) *LayerTree {
	c := &LayerTree{target: target}
	return c
}
type LayerTreeCompositingReasonsParams struct {
	LayerId string `json:"layerId"`
}
func (c *LayerTree) CompositingReasonsWithParams(v *LayerTreeCompositingReasonsParams) ([]string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.compositingReasons", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			CompositingReasons []string
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.CompositingReasons, nil
}
func (c *LayerTree) CompositingReasons(layerId string) ([]string, error) {
	var v LayerTreeCompositingReasonsParams
	v.LayerId = layerId
	return c.CompositingReasonsWithParams(&v)
}
func (c *LayerTree) Disable() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.disable"})
}
func (c *LayerTree) Enable() (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.enable"})
}
type LayerTreeLoadSnapshotParams struct {
	Tiles []*LayerTreePictureTile `json:"tiles"`
}
func (c *LayerTree) LoadSnapshotWithParams(v *LayerTreeLoadSnapshotParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.loadSnapshot", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			SnapshotId string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.SnapshotId, nil
}
func (c *LayerTree) LoadSnapshot(tiles []*LayerTreePictureTile) (string, error) {
	var v LayerTreeLoadSnapshotParams
	v.Tiles = tiles
	return c.LoadSnapshotWithParams(&v)
}
type LayerTreeMakeSnapshotParams struct {
	LayerId string `json:"layerId"`
}
func (c *LayerTree) MakeSnapshotWithParams(v *LayerTreeMakeSnapshotParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.makeSnapshot", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			SnapshotId string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.SnapshotId, nil
}
func (c *LayerTree) MakeSnapshot(layerId string) (string, error) {
	var v LayerTreeMakeSnapshotParams
	v.LayerId = layerId
	return c.MakeSnapshotWithParams(&v)
}
type LayerTreeProfileSnapshotParams struct {
	SnapshotId string `json:"snapshotId"`
	MinRepeatCount int `json:"minRepeatCount,omitempty"`
	MinDuration float64 `json:"minDuration,omitempty"`
	ClipRect *DOMRect `json:"clipRect,omitempty"`
}
func (c *LayerTree) ProfileSnapshotWithParams(v *LayerTreeProfileSnapshotParams) ([]float64, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.profileSnapshot", Params: v})
	if err != nil {
		return nil, err
	}
	var chromeData struct {
		Result struct {
			Timings []float64
		}
	}
	if resp == nil {
		return nil, &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return nil, &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return nil, err
	}
	return chromeData.Result.Timings, nil
}
func (c *LayerTree) ProfileSnapshot(snapshotId string, minRepeatCount int, minDuration float64, clipRect *DOMRect) ([]float64, error) {
	var v LayerTreeProfileSnapshotParams
	v.SnapshotId = snapshotId
	v.MinRepeatCount = minRepeatCount
	v.MinDuration = minDuration
	v.ClipRect = clipRect
	return c.ProfileSnapshotWithParams(&v)
}
type LayerTreeReleaseSnapshotParams struct {
	SnapshotId string `json:"snapshotId"`
}
func (c *LayerTree) ReleaseSnapshotWithParams(v *LayerTreeReleaseSnapshotParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.releaseSnapshot", Params: v})
}
func (c *LayerTree) ReleaseSnapshot(snapshotId string) (*gcdmessage.ChromeResponse, error) {
	var v LayerTreeReleaseSnapshotParams
	v.SnapshotId = snapshotId
	return c.ReleaseSnapshotWithParams(&v)
}
type LayerTreeReplaySnapshotParams struct {
	SnapshotId string `json:"snapshotId"`
	FromStep int `json:"fromStep,omitempty"`
	ToStep int `json:"toStep,omitempty"`
	Scale float64 `json:"scale,omitempty"`
}
func (c *LayerTree) ReplaySnapshotWithParams(v *LayerTreeReplaySnapshotParams) (string, error) {
	resp, err := gcdmessage.SendCustomReturn(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "LayerTree.replaySnapshot", Params: v})
	if err != nil {
		return "", err
	}
	var chromeData struct {
		Result struct {
			DataURL string
		}
	}
	if resp == nil {
		return "", &gcdmessage.ChromeEmptyResponseErr{}
	}
	cerr := &gcdmessage.ChromeErrorResponse{}
	json.Unmarshal(resp.Data, cerr)
	if cerr != nil && cerr.Error != nil {
		return "", &gcdmessage.ChromeRequestErr{Resp: cerr}
	}
	if err := json.Unmarshal(resp.Data, &chromeData); err != nil {
		return "", err
	}
	return chromeData.Result.DataURL, nil
}