2 * Copyright 2014 Google Inc.
3 * Copyright 2015 Xamarin Inc.
4 * Copyright 2017 Microsoft Corporation. All rights reserved.
6 * Use of this source code is governed by a BSD-style license that can be
7 * found in the LICENSE file.
10 #ifndef sk_pixmap_DEFINED
11 #define sk_pixmap_DEFINED
15 SK_C_PLUS_PLUS_BEGIN_GUARD
17 SK_C_API void sk_pixmap_destructor(sk_pixmap_t* cpixmap);
18 SK_C_API sk_pixmap_t* sk_pixmap_new(void);
19 SK_C_API sk_pixmap_t* sk_pixmap_new_with_params(const sk_imageinfo_t* cinfo, const void* addr, size_t rowBytes, sk_colortable_t* ctable);
20 SK_C_API void sk_pixmap_reset(sk_pixmap_t* cpixmap);
21 SK_C_API void sk_pixmap_reset_with_params(sk_pixmap_t* cpixmap, const sk_imageinfo_t* cinfo, const void* addr, size_t rowBytes, sk_colortable_t* ctable);
22 SK_C_API void sk_pixmap_get_info(sk_pixmap_t* cpixmap, sk_imageinfo_t* cinfo);
23 SK_C_API size_t sk_pixmap_get_row_bytes(sk_pixmap_t* cpixmap);
24 SK_C_API const void* sk_pixmap_get_pixels(sk_pixmap_t* cpixmap);
25 SK_C_API sk_colortable_t* sk_pixmap_get_colortable(sk_pixmap_t* cpixmap);
26 SK_C_API bool sk_pixmap_encode_image(sk_wstream_t* dst, const sk_pixmap_t* src, sk_encoded_image_format_t encoder, int quality);
27 SK_C_API bool sk_pixmap_read_pixels(const sk_pixmap_t* cpixmap, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY);
29 SK_C_API bool sk_bitmapscaler_resize(const sk_pixmap_t* dst, const sk_pixmap_t* src, sk_bitmapscaler_resizemethod_t method);
31 SK_C_API sk_color_t sk_color_unpremultiply(const sk_pmcolor_t pmcolor);
32 SK_C_API sk_pmcolor_t sk_color_premultiply(const sk_color_t color);
33 SK_C_API void sk_color_unpremultiply_array(const sk_pmcolor_t* pmcolors, int size, sk_color_t* colors);
34 SK_C_API void sk_color_premultiply_array(const sk_color_t* colors, int size, sk_pmcolor_t* pmcolors);
35 SK_C_API void sk_color_get_bit_shift(int* a, int* r, int* g, int* b);
37 SK_C_API void sk_swizzle_swap_rb(uint32_t* dest, const uint32_t* src, int count);
39 SK_C_API bool sk_webpencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, sk_webpencoder_options_t options);
40 SK_C_API bool sk_jpegencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, sk_jpegencoder_options_t options);
41 SK_C_API bool sk_pngencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, sk_pngencoder_options_t options);
43 SK_C_PLUS_PLUS_END_GUARD