1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
9// DO NOT USE -- FOR INTERNAL TESTING ONLY
10
11#ifndef sk_imageinfo_DEFINED
12#define sk_imageinfo_DEFINED
13
14#include "include/c/sk_types.h"
15
16SK_C_PLUS_PLUS_BEGIN_GUARD
17
18typedef enum {
19 UNKNOWN_SK_COLORTYPE,
20 RGBA_8888_SK_COLORTYPE,
21 BGRA_8888_SK_COLORTYPE,
22 ALPHA_8_SK_COLORTYPE,
23 GRAY_8_SK_COLORTYPE,
24 RGBA_F16_SK_COLORTYPE,
25 RGBA_F32_SK_COLORTYPE,
26} sk_colortype_t;
27
28typedef enum {
29 OPAQUE_SK_ALPHATYPE,
30 PREMUL_SK_ALPHATYPE,
31 UNPREMUL_SK_ALPHATYPE,
32} sk_alphatype_t;
33
34/**
35 * Allocate a new imageinfo object. If colorspace is not null, it's owner-count will be
36 * incremented automatically.
37 */
38SK_API sk_imageinfo_t* sk_imageinfo_new(int width, int height, sk_colortype_t ct, sk_alphatype_t at,
39 sk_colorspace_t* cs);
40
41/**
42 * Free the imageinfo object. If it contains a reference to a colorspace, its owner-count will
43 * be decremented automatically.
44 */
45SK_API void sk_imageinfo_delete(sk_imageinfo_t*);
46
47SK_API int32_t sk_imageinfo_get_width(const sk_imageinfo_t*);
48SK_API int32_t sk_imageinfo_get_height(const sk_imageinfo_t*);
49SK_API sk_colortype_t sk_imageinfo_get_colortype(const sk_imageinfo_t*);
50SK_API sk_alphatype_t sk_imageinfo_get_alphatype(const sk_imageinfo_t*);
51
52/**
53 * Return the colorspace object reference contained in the imageinfo, or null if there is none.
54 * Note: this does not modify the owner-count on the colorspace object. If the caller needs to
55 * use the colorspace beyond the lifetime of the imageinfo, it should manually call
56 * sk_colorspace_ref() (and then call unref() when it is done).
57 */
58SK_API sk_colorspace_t* sk_imageinfo_get_colorspace(const sk_imageinfo_t*);
59
60SK_C_PLUS_PLUS_END_GUARD
61
62#endif
63