1cb93a386Sopenharmony_ci/*
2cb93a386Sopenharmony_ci * Copyright 2018 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_imageinfo_DEFINED
12cb93a386Sopenharmony_ci#define sk_imageinfo_DEFINED
13cb93a386Sopenharmony_ci
14cb93a386Sopenharmony_ci#include "include/c/sk_types.h"
15cb93a386Sopenharmony_ci
16cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_BEGIN_GUARD
17cb93a386Sopenharmony_ci
18cb93a386Sopenharmony_citypedef enum {
19cb93a386Sopenharmony_ci    UNKNOWN_SK_COLORTYPE,
20cb93a386Sopenharmony_ci    RGBA_8888_SK_COLORTYPE,
21cb93a386Sopenharmony_ci    BGRA_8888_SK_COLORTYPE,
22cb93a386Sopenharmony_ci    ALPHA_8_SK_COLORTYPE,
23cb93a386Sopenharmony_ci    GRAY_8_SK_COLORTYPE,
24cb93a386Sopenharmony_ci    RGBA_F16_SK_COLORTYPE,
25cb93a386Sopenharmony_ci    RGBA_F32_SK_COLORTYPE,
26cb93a386Sopenharmony_ci} sk_colortype_t;
27cb93a386Sopenharmony_ci
28cb93a386Sopenharmony_citypedef enum {
29cb93a386Sopenharmony_ci    OPAQUE_SK_ALPHATYPE,
30cb93a386Sopenharmony_ci    PREMUL_SK_ALPHATYPE,
31cb93a386Sopenharmony_ci    UNPREMUL_SK_ALPHATYPE,
32cb93a386Sopenharmony_ci} sk_alphatype_t;
33cb93a386Sopenharmony_ci
34cb93a386Sopenharmony_ci/**
35cb93a386Sopenharmony_ci *  Allocate a new imageinfo object. If colorspace is not null, it's owner-count will be
36cb93a386Sopenharmony_ci *  incremented automatically.
37cb93a386Sopenharmony_ci */
38cb93a386Sopenharmony_ciSK_API sk_imageinfo_t* sk_imageinfo_new(int width, int height, sk_colortype_t ct, sk_alphatype_t at,
39cb93a386Sopenharmony_ci                                 sk_colorspace_t* cs);
40cb93a386Sopenharmony_ci
41cb93a386Sopenharmony_ci/**
42cb93a386Sopenharmony_ci *  Free the imageinfo object. If it contains a reference to a colorspace, its owner-count will
43cb93a386Sopenharmony_ci *  be decremented automatically.
44cb93a386Sopenharmony_ci */
45cb93a386Sopenharmony_ciSK_API void sk_imageinfo_delete(sk_imageinfo_t*);
46cb93a386Sopenharmony_ci
47cb93a386Sopenharmony_ciSK_API int32_t          sk_imageinfo_get_width(const sk_imageinfo_t*);
48cb93a386Sopenharmony_ciSK_API int32_t          sk_imageinfo_get_height(const sk_imageinfo_t*);
49cb93a386Sopenharmony_ciSK_API sk_colortype_t   sk_imageinfo_get_colortype(const sk_imageinfo_t*);
50cb93a386Sopenharmony_ciSK_API sk_alphatype_t   sk_imageinfo_get_alphatype(const sk_imageinfo_t*);
51cb93a386Sopenharmony_ci
52cb93a386Sopenharmony_ci/**
53cb93a386Sopenharmony_ci *  Return the colorspace object reference contained in the imageinfo, or null if there is none.
54cb93a386Sopenharmony_ci *  Note: this does not modify the owner-count on the colorspace object. If the caller needs to
55cb93a386Sopenharmony_ci *  use the colorspace beyond the lifetime of the imageinfo, it should manually call
56cb93a386Sopenharmony_ci *  sk_colorspace_ref() (and then call unref() when it is done).
57cb93a386Sopenharmony_ci */
58cb93a386Sopenharmony_ciSK_API sk_colorspace_t* sk_imageinfo_get_colorspace(const sk_imageinfo_t*);
59cb93a386Sopenharmony_ci
60cb93a386Sopenharmony_ciSK_C_PLUS_PLUS_END_GUARD
61cb93a386Sopenharmony_ci
62cb93a386Sopenharmony_ci#endif
63