1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2014 Google Inc.
3cb93a386Sopenharmony_ci *
4cb93a386Sopenharmony_ci * Use of this source code is governed by a BSD-style license that can be
5cb93a386Sopenharmony_ci * found in the LICENSE file.
6cb93a386Sopenharmony_ci */
7cb93a386Sopenharmony_ci
8cb93a386Sopenharmony_ci// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
9cb93a386Sopenharmony_ci// DO NOT USE -- FOR INTERNAL TESTING ONLY
10cb93a386Sopenharmony_ci
11cb93a386Sopenharmony_ci#ifndef sk_picture_DEFINED
12cb93a386Sopenharmony_ci#define sk_picture_DEFINED
13cb93a386Sopenharmony_ci
14cb93a386Sopenharmony_ci#include "include/c/sk_types.h"
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_BEGIN_GUARD
17cb93a386Sopenharmony_ci
18cb93a386Sopenharmony_ci/**
19cb93a386Sopenharmony_ci    Create a new sk_picture_recorder_t.  Its resources should be
20cb93a386Sopenharmony_ci    released with a call to sk_picture_recorder_delete().
21cb93a386Sopenharmony_ci*/
22cb93a386Sopenharmony_ciSK_API sk_picture_recorder_t* sk_picture_recorder_new(void);
23cb93a386Sopenharmony_ci/**
24cb93a386Sopenharmony_ci    Release the memory and other resources used by this
25cb93a386Sopenharmony_ci    sk_picture_recorder_t.
26cb93a386Sopenharmony_ci*/
27cb93a386Sopenharmony_ciSK_API void sk_picture_recorder_delete(sk_picture_recorder_t*);
28cb93a386Sopenharmony_ci
29cb93a386Sopenharmony_ci/**
30cb93a386Sopenharmony_ci   Returns the canvas that records the drawing commands
31cb93a386Sopenharmony_ci
32cb93a386Sopenharmony_ci   @param sk_rect_t* the cull rect used when recording this
33cb93a386Sopenharmony_ci                     picture. Any drawing the falls outside of this
34cb93a386Sopenharmony_ci                     rect is undefined, and may be drawn or it may not.
35cb93a386Sopenharmony_ci*/
36cb93a386Sopenharmony_ciSK_API sk_canvas_t* sk_picture_recorder_begin_recording(sk_picture_recorder_t*, const sk_rect_t*);
37cb93a386Sopenharmony_ci/**
38cb93a386Sopenharmony_ci    Signal that the caller is done recording. This invalidates the
39cb93a386Sopenharmony_ci    canvas returned by begin_recording. Ownership of the sk_picture_t
40cb93a386Sopenharmony_ci    is passed to the caller, who must call sk_picture_unref() when
41cb93a386Sopenharmony_ci    they are done using it.  The returned picture is immutable.
42cb93a386Sopenharmony_ci*/
43cb93a386Sopenharmony_ciSK_API sk_picture_t* sk_picture_recorder_end_recording(sk_picture_recorder_t*);
44cb93a386Sopenharmony_ci
45cb93a386Sopenharmony_ci/**
46cb93a386Sopenharmony_ci    Increment the reference count on the given sk_picture_t. Must be
47cb93a386Sopenharmony_ci    balanced by a call to sk_picture_unref().
48cb93a386Sopenharmony_ci*/
49cb93a386Sopenharmony_ciSK_API void sk_picture_ref(sk_picture_t*);
50cb93a386Sopenharmony_ci/**
51cb93a386Sopenharmony_ci    Decrement the reference count. If the reference count is 1 before
52cb93a386Sopenharmony_ci    the decrement, then release both the memory holding the
53cb93a386Sopenharmony_ci    sk_picture_t and any resouces it may be managing.  New
54cb93a386Sopenharmony_ci    sk_picture_t are created with a reference count of 1.
55cb93a386Sopenharmony_ci*/
56cb93a386Sopenharmony_ciSK_API void sk_picture_unref(sk_picture_t*);
57cb93a386Sopenharmony_ci
58cb93a386Sopenharmony_ci/**
59cb93a386Sopenharmony_ci    Returns a non-zero value unique among all pictures.
60cb93a386Sopenharmony_ci */
61cb93a386Sopenharmony_ciSK_API uint32_t sk_picture_get_unique_id(sk_picture_t*);
62cb93a386Sopenharmony_ci
63cb93a386Sopenharmony_ci/**
64cb93a386Sopenharmony_ci    Return the cull rect specified when this picture was recorded.
65cb93a386Sopenharmony_ci*/
66cb93a386Sopenharmony_ciSK_API sk_rect_t sk_picture_get_bounds(sk_picture_t*);
67cb93a386Sopenharmony_ci
68cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_END_GUARD
69cb93a386Sopenharmony_ci
70cb93a386Sopenharmony_ci#endif
71