'<(skia_include_path)/c/sk_canvas.h',
'<(skia_include_path)/c/sk_codec.h',
'<(skia_include_path)/c/sk_colorfilter.h',
+ '<(skia_include_path)/c/sk_colortable.h',
'<(skia_include_path)/c/sk_data.h',
'<(skia_include_path)/c/sk_document.h',
'<(skia_include_path)/c/sk_image.h',
'<(skia_src_path)/c/sk_canvas.cpp',
'<(skia_src_path)/c/sk_codec.cpp',
'<(skia_src_path)/c/sk_colorfilter.cpp',
+ '<(skia_src_path)/c/sk_colortable.cpp',
'<(skia_src_path)/c/sk_data.cpp',
'<(skia_src_path)/c/sk_document.cpp',
'<(skia_src_path)/c/sk_enums.cpp',
SK_API void sk_bitmap_erase(sk_bitmap_t* cbitmap, sk_color_t color);
SK_API void sk_bitmap_erase_rect(sk_bitmap_t* cbitmap, sk_color_t color, sk_irect_t* rect);
SK_API sk_color_t sk_bitmap_get_pixel_color(sk_bitmap_t* cbitmap, int x, int y);
+SK_API sk_color_t sk_bitmap_get_index8_color(sk_bitmap_t* cbitmap, int x, int y);
SK_API void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color);
SK_API bool sk_bitmap_copy(sk_bitmap_t* cbitmap, sk_bitmap_t* dst, sk_colortype_t ct);
SK_API bool sk_bitmap_can_copy_to(sk_bitmap_t* cbitmap, sk_colortype_t ct);
SK_API void sk_bitmap_get_pixel_colors(sk_bitmap_t* cbitmap, sk_color_t* colors);
SK_API void sk_bitmap_set_pixel_colors(sk_bitmap_t* cbitmap, const sk_color_t* colors);
SK_API bool sk_bitmap_try_alloc_pixels(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, size_t rowBytes);
+SK_API bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_pixelref_factory_t* factory, sk_colortable_t* ctable);
+SK_API sk_colortable_t* sk_bitmap_get_colortable(sk_bitmap_t* cbitmap);
SK_C_PLUS_PLUS_END_GUARD
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL EXPERIMENTAL
+// DO NOT USE -- FOR INTERNAL TESTING ONLY
+
+#ifndef sk_colortable_DEFINED
+#define sk_colortable_DEFINED
+
+#include "sk_types.h"
+
+SK_C_PLUS_PLUS_BEGIN_GUARD
+
+SK_API void sk_colortable_unref(sk_colortable_t* ctable);
+SK_API sk_colortable_t* sk_colortable_new(const sk_color_t* colors, int count);
+SK_API int sk_colortable_count(const sk_colortable_t* ctable);
+SK_API void sk_colortable_read_colors(const sk_colortable_t* ctable, sk_color_t** colors);
+
+SK_C_PLUS_PLUS_END_GUARD
+
+#endif
LARGE_SK_PATH_ARC_SIZE,
} sk_path_arc_size_t;
+typedef struct sk_colortable_t sk_colortable_t;
+
+typedef struct sk_pixelref_factory_t sk_pixelref_factory_t;
+
SK_C_PLUS_PLUS_END_GUARD
#endif
return AsBitmap(cbitmap)->getColor(x, y);
}
+sk_color_t sk_bitmap_get_index8_color(sk_bitmap_t* cbitmap, int x, int y)
+{
+ return AsBitmap(cbitmap)->getIndex8Color(x, y);
+}
+
void sk_bitmap_set_pixel_color(sk_bitmap_t* cbitmap, int x, int y, sk_color_t color)
{
SkBitmap* bmp = AsBitmap(cbitmap);
return bmp->tryAllocPixels(info, rowBytes);
}
+
+bool sk_bitmap_try_alloc_pixels_with_color_table(sk_bitmap_t* cbitmap, const sk_imageinfo_t* requestedInfo, sk_pixelref_factory_t* factory, sk_colortable_t* ctable)
+{
+ SkBitmap* bmp = AsBitmap(cbitmap);
+
+ SkImageInfo info;
+ from_c(*requestedInfo, &info);
+
+ return bmp->tryAllocPixels(info, AsPixelRefFactory(factory), AsColorTable(ctable));
+}
+
+sk_colortable_t* sk_bitmap_get_colortable(sk_bitmap_t* cbitmap)
+{
+ return ToColorTable(AsBitmap(cbitmap)->getColorTable());
+}
--- /dev/null
+/*
+ * Copyright 2016 Xamarin Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkColorTable.h"
+
+#include "sk_colortable.h"
+
+#include "sk_types_priv.h"
+
+void sk_colortable_unref(sk_colortable_t* ctable) {
+ SkSafeUnref(AsColorTable(ctable));
+}
+
+sk_colortable_t* sk_colortable_new(const sk_color_t* colors, int count) {
+ return ToColorTable(new SkColorTable(colors, count));
+}
+
+int sk_colortable_count(const sk_colortable_t* ctable) {
+ return AsColorTable(ctable)->count();
+}
+
+void sk_colortable_read_colors(const sk_colortable_t* ctable, sk_color_t** colors) {
+ *colors = (SkColor*) AsColorTable(ctable)->readColors();
+}
return reinterpret_cast<const sk_path_effect_t*>(p);
}
+static inline const SkColorTable* AsColorTable(const sk_colortable_t* p) {
+ return reinterpret_cast<const SkColorTable*>(p);
+}
+
+static inline SkColorTable* AsColorTable(sk_colortable_t* p) {
+ return reinterpret_cast<SkColorTable*>(p);
+}
+
+static inline sk_colortable_t* ToColorTable(SkColorTable* p) {
+ return reinterpret_cast<sk_colortable_t*>(p);
+}
+
+static inline const sk_colortable_t* ToColorTable(const SkColorTable* p) {
+ return reinterpret_cast<const sk_colortable_t*>(p);
+}
+
+static inline const SkPixelRefFactory* AsPixelRefFactory(const sk_pixelref_factory_t* p) {
+ return reinterpret_cast<const SkPixelRefFactory*>(p);
+}
+
+static inline SkPixelRefFactory* AsPixelRefFactory(sk_pixelref_factory_t* p) {
+ return reinterpret_cast<SkPixelRefFactory*>(p);
+}
+
+static inline sk_pixelref_factory_t* ToColorTable(SkPixelRefFactory* p) {
+ return reinterpret_cast<sk_pixelref_factory_t*>(p);
+}
+
+static inline const sk_pixelref_factory_t* ToColorTable(const SkPixelRefFactory* p) {
+ return reinterpret_cast<const sk_pixelref_factory_t*>(p);
+}
+
static inline void from_c(const sk_matrix_t* cmatrix, SkMatrix* matrix) {
matrix->setAll(
cmatrix->mat[0], cmatrix->mat[1], cmatrix->mat[2],