sk_imageinfo.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. // EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
  8. // DO NOT USE -- FOR INTERNAL TESTING ONLY
  9. #ifndef sk_imageinfo_DEFINED
  10. #define sk_imageinfo_DEFINED
  11. #include "include/c/sk_types.h"
  12. SK_C_PLUS_PLUS_BEGIN_GUARD
  13. typedef enum {
  14. UNKNOWN_SK_COLORTYPE,
  15. RGBA_8888_SK_COLORTYPE,
  16. BGRA_8888_SK_COLORTYPE,
  17. ALPHA_8_SK_COLORTYPE,
  18. GRAY_8_SK_COLORTYPE,
  19. RGBA_F16_SK_COLORTYPE,
  20. RGBA_F32_SK_COLORTYPE,
  21. } sk_colortype_t;
  22. typedef enum {
  23. OPAQUE_SK_ALPHATYPE,
  24. PREMUL_SK_ALPHATYPE,
  25. UNPREMUL_SK_ALPHATYPE,
  26. } sk_alphatype_t;
  27. /**
  28. * Allocate a new imageinfo object. If colorspace is not null, it's owner-count will be
  29. * incremented automatically.
  30. */
  31. SK_API sk_imageinfo_t* sk_imageinfo_new(int width, int height, sk_colortype_t ct, sk_alphatype_t at,
  32. sk_colorspace_t* cs);
  33. /**
  34. * Free the imageinfo object. If it contains a reference to a colorspace, its owner-count will
  35. * be decremented automatically.
  36. */
  37. SK_API void sk_imageinfo_delete(sk_imageinfo_t*);
  38. SK_API int32_t sk_imageinfo_get_width(const sk_imageinfo_t*);
  39. SK_API int32_t sk_imageinfo_get_height(const sk_imageinfo_t*);
  40. SK_API sk_colortype_t sk_imageinfo_get_colortype(const sk_imageinfo_t*);
  41. SK_API sk_alphatype_t sk_imageinfo_get_alphatype(const sk_imageinfo_t*);
  42. /**
  43. * Return the colorspace object reference contained in the imageinfo, or null if there is none.
  44. * Note: this does not modify the owner-count on the colorspace object. If the caller needs to
  45. * use the colorspace beyond the lifetime of the imageinfo, it should manually call
  46. * sk_colorspace_ref() (and then call unref() when it is done).
  47. */
  48. SK_API sk_colorspace_t* sk_imageinfo_get_colorspace(const sk_imageinfo_t*);
  49. SK_C_PLUS_PLUS_END_GUARD
  50. #endif