Mike Reed | 66c505f | 2018-09-28 11:27:57 -0400 | [diff] [blame] | 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 "sk_types.h" |
| 15 | |
| 16 | SK_C_PLUS_PLUS_BEGIN_GUARD |
| 17 | |
| 18 | typedef 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 | |
| 28 | typedef 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 | */ |
| 38 | 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 | */ |
| 45 | void sk_imageinfo_delete(sk_imageinfo_t*); |
| 46 | |
| 47 | int32_t sk_imageinfo_get_width(sk_imageinfo_t*); |
| 48 | int32_t sk_imageinfo_get_height(sk_imageinfo_t*); |
| 49 | sk_colortype_t sk_imageinfo_get_colortype(sk_imageinfo_t*); |
| 50 | sk_alphatype_t sk_imageinfo_get_alphatype(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 | */ |
| 58 | sk_colorspace_t* sk_imageinfo_get_colorspace(sk_imageinfo_t*); |
| 59 | |
| 60 | SK_C_PLUS_PLUS_END_GUARD |
| 61 | |
| 62 | #endif |