/*
 * Minimal PHP FFI declarations for the P03B development probe; no production loader.
 * Adapted from the C API headers in mono/skia commit
 * 8f5cc7a4c200ba8ecc5bc6263cf9f8bfe0ba6e6b (SkiaSharp v4.152.0).
 * SkiaSharp tag commit: b40fe16da7ae50d7a2b488beef6c249f012856af.
 * Exact source files are preserved in upstream-4.152.0/.
 * Copyright 2014 Google Inc.; 2015-2016 Xamarin Inc.; 2017-2025 Microsoft.
 * BSD-style license: see licenses/macos/THIRD-PARTY-NOTICES.txt (Skia).
 * Only SK_C_API/export guards and unrelated declarations are omitted. Enum
 * values, struct field order, pointer constness and function signatures match
 * the pinned headers. bool is the native one-byte C _Bool understood by FFI;
 * fixed-width integer and size_t types are built into PHP FFI.
 * Do not load 88.1 or any other native ABI with these declarations.
 */
typedef uint32_t sk_color_t;

typedef struct sk_canvas_t sk_canvas_t;

typedef struct sk_data_t sk_data_t;

typedef struct sk_image_t sk_image_t;

typedef struct sk_paint_t sk_paint_t;

typedef struct sk_path_t sk_path_t;

typedef struct sk_pathbuilder_t sk_pathbuilder_t;

typedef struct sk_surface_t sk_surface_t;

typedef struct sk_surfaceprops_t sk_surfaceprops_t;

typedef struct sk_colorspace_t sk_colorspace_t;

typedef struct sk_imagefilter_t sk_imagefilter_t;

typedef struct sk_rrect_t sk_rrect_t;

typedef struct sk_color4f_t {
    float fR;
    float fG;
    float fB;
    float fA;
} sk_color4f_t;

typedef enum {
    UNKNOWN_SK_COLORTYPE = 0,
    ALPHA_8_SK_COLORTYPE,
    RGB_565_SK_COLORTYPE,
    ARGB_4444_SK_COLORTYPE,
    RGBA_8888_SK_COLORTYPE,
    RGB_888X_SK_COLORTYPE,
    BGRA_8888_SK_COLORTYPE,
    RGBA_1010102_SK_COLORTYPE,
    BGRA_1010102_SK_COLORTYPE,
    RGB_101010X_SK_COLORTYPE,
    BGR_101010X_SK_COLORTYPE,
    BGR_101010X_XR_SK_COLORTYPE,
    BGRA_10101010_XR_SK_COLORTYPE,
    RGBA_10X6_SK_COLORTYPE,
    GRAY_8_SK_COLORTYPE,
    RGBA_F16_NORM_SK_COLORTYPE,
    RGBA_F16_SK_COLORTYPE,
    RGB_F16F16F16X_SK_COLORTYPE,
    RGBA_F32_SK_COLORTYPE,

    // READONLY
    R8G8_UNORM_SK_COLORTYPE,
    A16_FLOAT_SK_COLORTYPE,
    R16_FLOAT_SK_COLORTYPE,
    R16G16_FLOAT_SK_COLORTYPE,
    A16_UNORM_SK_COLORTYPE,
    R16_UNORM_SK_COLORTYPE,
    R16G16_UNORM_SK_COLORTYPE,
    R16G16B16A16_UNORM_SK_COLORTYPE,
    SRGBA_8888_SK_COLORTYPE,
    R8_UNORM_SK_COLORTYPE,
} sk_colortype_t;

typedef enum {
    UNKNOWN_SK_ALPHATYPE,
    OPAQUE_SK_ALPHATYPE,
    PREMUL_SK_ALPHATYPE,
    UNPREMUL_SK_ALPHATYPE,
} sk_alphatype_t;

typedef enum {
    UNKNOWN_SK_PIXELGEOMETRY,
    RGB_H_SK_PIXELGEOMETRY,
    BGR_H_SK_PIXELGEOMETRY,
    RGB_V_SK_PIXELGEOMETRY,
    BGR_V_SK_PIXELGEOMETRY,
} sk_pixelgeometry_t;

typedef struct {
    float   x;
    float   y;
} sk_point_t;

typedef struct {
    int32_t left;
    int32_t top;
    int32_t right;
    int32_t bottom;
} sk_irect_t;

typedef struct {
    float   left;
    float   top;
    float   right;
    float   bottom;
} sk_rect_t;

typedef struct {
    float scaleX,  skewX, transX;
    float  skewY, scaleY, transY;
    float persp0, persp1, persp2;
} sk_matrix_t;

typedef struct {
    // name: m<row><col>
    float m00, m01, m02, m03; // row 0
    float m10, m11, m12, m13; // row 1
    float m20, m21, m22, m23; // row 2
    float m30, m31, m32, m33; // row 3
} sk_matrix44_t;

typedef enum {
    CLEAR_SK_BLENDMODE,
    SRC_SK_BLENDMODE,
    DST_SK_BLENDMODE,
    SRCOVER_SK_BLENDMODE,
    DSTOVER_SK_BLENDMODE,
    SRCIN_SK_BLENDMODE,
    DSTIN_SK_BLENDMODE,
    SRCOUT_SK_BLENDMODE,
    DSTOUT_SK_BLENDMODE,
    SRCATOP_SK_BLENDMODE,
    DSTATOP_SK_BLENDMODE,
    XOR_SK_BLENDMODE,
    PLUS_SK_BLENDMODE,
    MODULATE_SK_BLENDMODE,
    SCREEN_SK_BLENDMODE,
    OVERLAY_SK_BLENDMODE,
    DARKEN_SK_BLENDMODE,
    LIGHTEN_SK_BLENDMODE,
    COLORDODGE_SK_BLENDMODE,
    COLORBURN_SK_BLENDMODE,
    HARDLIGHT_SK_BLENDMODE,
    SOFTLIGHT_SK_BLENDMODE,
    DIFFERENCE_SK_BLENDMODE,
    EXCLUSION_SK_BLENDMODE,
    MULTIPLY_SK_BLENDMODE,
    HUE_SK_BLENDMODE,
    SATURATION_SK_BLENDMODE,
    COLOR_SK_BLENDMODE,
    LUMINOSITY_SK_BLENDMODE,
} sk_blendmode_t;

typedef enum {
    WINDING_SK_PATH_FILLTYPE,
    EVENODD_SK_PATH_FILLTYPE,
    INVERSE_WINDING_SK_PATH_FILLTYPE,
    INVERSE_EVENODD_SK_PATH_FILLTYPE,
} sk_path_filltype_t;

typedef enum {
    DIFFERENCE_SK_CLIPOP,
    INTERSECT_SK_CLIPOP,
} sk_clipop_t;

typedef enum {
    BUTT_SK_STROKE_CAP,
    ROUND_SK_STROKE_CAP,
    SQUARE_SK_STROKE_CAP
} sk_stroke_cap_t;

typedef enum {
    MITER_SK_STROKE_JOIN,
    ROUND_SK_STROKE_JOIN,
    BEVEL_SK_STROKE_JOIN
} sk_stroke_join_t;

typedef enum {
    CLAMP_SK_SHADER_TILEMODE,
    REPEAT_SK_SHADER_TILEMODE,
    MIRROR_SK_SHADER_TILEMODE,
    DECAL_SK_SHADER_TILEMODE,
} sk_shader_tilemode_t;

typedef enum {
    CW_SK_PATH_DIRECTION,
    CCW_SK_PATH_DIRECTION,
} sk_path_direction_t;

typedef enum {
    FILL_SK_PAINT_STYLE,
    STROKE_SK_PAINT_STYLE,
    STROKE_AND_FILL_SK_PAINT_STYLE,
} sk_paint_style_t;

typedef enum {
    ALLOW_SK_IMAGE_CACHING_HINT,
    DISALLOW_SK_IMAGE_CACHING_HINT,
} sk_image_caching_hint_t;

typedef struct {
    sk_colorspace_t* colorspace;
    int32_t          width;
    int32_t          height;
    sk_colortype_t   colorType;
    sk_alphatype_t   alphaType;
} sk_imageinfo_t;

typedef enum {
    NEAREST_SK_FILTER_MODE,
    LINEAR_SK_FILTER_MODE,
} sk_filter_mode_t;

typedef enum {
    NONE_SK_MIPMAP_MODE,
    NEAREST_SK_MIPMAP_MODE,
    LINEAR_SK_MIPMAP_MODE,
} sk_mipmap_mode_t;

typedef struct {
    float fB;
    float fC;
} sk_cubic_resampler_t;

typedef struct {
    int fMaxAniso;
    bool fUseCubic;
    sk_cubic_resampler_t fCubic;
    sk_filter_mode_t fFilter;
    sk_mipmap_mode_t fMipmap;
} sk_sampling_options_t;

typedef struct sk_pixmap_t sk_pixmap_t;

typedef struct sk_wstream_t sk_wstream_t;

typedef struct sk_wstream_dynamicmemorystream_t sk_wstream_dynamicmemorystream_t;

typedef struct sk_maskfilter_t sk_maskfilter_t;

typedef struct sk_colorfilter_t sk_colorfilter_t;

typedef enum {
    NORMAL_SK_BLUR_STYLE,   //!< fuzzy inside and outside
    SOLID_SK_BLUR_STYLE,    //!< solid inside, fuzzy outside
    OUTER_SK_BLUR_STYLE,    //!< nothing inside, fuzzy outside
    INNER_SK_BLUR_STYLE,    //!< fuzzy inside, nothing outside
} sk_blurstyle_t;

typedef enum {
    ZERO_SK_PNGENCODER_FILTER_FLAGS  = 0x00,
    NONE_SK_PNGENCODER_FILTER_FLAGS  = 0x08,
    SUB_SK_PNGENCODER_FILTER_FLAGS   = 0x10,
    UP_SK_PNGENCODER_FILTER_FLAGS    = 0x20,
    AVG_SK_PNGENCODER_FILTER_FLAGS   = 0x40,
    PAETH_SK_PNGENCODER_FILTER_FLAGS = 0x80,
    ALL_SK_PNGENCODER_FILTER_FLAGS   = NONE_SK_PNGENCODER_FILTER_FLAGS |
                                       SUB_SK_PNGENCODER_FILTER_FLAGS |
                                       UP_SK_PNGENCODER_FILTER_FLAGS |
                                       AVG_SK_PNGENCODER_FILTER_FLAGS |
                                       PAETH_SK_PNGENCODER_FILTER_FLAGS,
} sk_pngencoder_filterflags_t;

typedef struct {
    sk_pngencoder_filterflags_t fFilterFlags;
    int fZLibLevel;
    void* fComments;
    const void* fGainmap;
    const void* fGainmapInfo;
} sk_pngencoder_options_t;

/* sk_general.h */
int sk_version_get_milestone(void);
int sk_version_get_increment(void);
const char* sk_version_get_string(void);
sk_colortype_t sk_colortype_get_default_8888(void);

/* sk_surface.h */
sk_surface_t* sk_surface_new_raster(const sk_imageinfo_t*, size_t rowBytes, const sk_surfaceprops_t*);
void sk_surface_unref(sk_surface_t*);
sk_canvas_t* sk_surface_get_canvas(sk_surface_t*);
sk_image_t* sk_surface_new_image_snapshot(sk_surface_t*);
sk_image_t* sk_surface_new_image_snapshot_with_crop(sk_surface_t* surface, const sk_irect_t* bounds);
void sk_surface_draw(sk_surface_t* surface, sk_canvas_t* canvas, float x, float y, const sk_paint_t* paint);
void sk_surface_draw_with_sampling(sk_surface_t* surface, sk_canvas_t* canvas, float x, float y, const sk_sampling_options_t* sampling, const sk_paint_t* paint);
bool sk_surface_read_pixels(sk_surface_t* surface, sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY);
sk_surfaceprops_t* sk_surfaceprops_new(uint32_t flags, sk_pixelgeometry_t geometry);
void sk_surfaceprops_delete(sk_surfaceprops_t* props);

/* sk_canvas.h */
void sk_canvas_clear(sk_canvas_t* ccanvas, sk_color_t color);
void sk_canvas_clear_color4f(sk_canvas_t* ccanvas, sk_color4f_t color);
void sk_canvas_draw_color(sk_canvas_t* ccanvas, sk_color_t color, sk_blendmode_t cmode);
void sk_canvas_draw_color4f(sk_canvas_t* ccanvas, sk_color4f_t color, sk_blendmode_t cmode);
int sk_canvas_save(sk_canvas_t* ccanvas);
int sk_canvas_save_layer(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint);
void sk_canvas_restore(sk_canvas_t* ccanvas);
void sk_canvas_restore_to_count(sk_canvas_t* ccanvas, int saveCount);
int sk_canvas_get_save_count(sk_canvas_t* ccanvas);
void sk_canvas_translate(sk_canvas_t* ccanvas, float dx, float dy);
void sk_canvas_scale(sk_canvas_t* ccanvas, float sx, float sy);
void sk_canvas_rotate_degrees(sk_canvas_t* ccanvas, float degrees);
void sk_canvas_rotate_radians(sk_canvas_t* ccanvas, float radians);
void sk_canvas_skew(sk_canvas_t* ccanvas, float sx, float sy);
void sk_canvas_reset_matrix(sk_canvas_t* ccanvas);
void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
void sk_canvas_get_matrix(sk_canvas_t* ccanvas, sk_matrix44_t* cmatrix);
void sk_canvas_clip_rect_with_operation(sk_canvas_t* ccanvas, const sk_rect_t* crect, sk_clipop_t op, bool doAA);
void sk_canvas_clip_path_with_operation(sk_canvas_t* ccanvas, const sk_path_t* cpath, sk_clipop_t op, bool doAA);
void sk_canvas_clip_rrect_with_operation(sk_canvas_t* ccanvas, const sk_rrect_t* crect, sk_clipop_t op, bool doAA);
void sk_canvas_draw_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint);
void sk_canvas_draw_round_rect(sk_canvas_t* ccanvas, const sk_rect_t* crect, float rx, float ry, const sk_paint_t* cpaint);
void sk_canvas_draw_rrect(sk_canvas_t* ccanvas, const sk_rrect_t* crect, const sk_paint_t* cpaint);
void sk_canvas_draw_oval(sk_canvas_t* ccanvas, const sk_rect_t* crect, const sk_paint_t* cpaint);
void sk_canvas_draw_circle(sk_canvas_t* ccanvas, float cx, float cy, float rad, const sk_paint_t* cpaint);
void sk_canvas_draw_line(sk_canvas_t* ccanvas, float x0, float y0, float x1, float y1, sk_paint_t* cpaint);
void sk_canvas_draw_path(sk_canvas_t* ccanvas, const sk_path_t* cpath, const sk_paint_t* cpaint);
void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
void sk_canvas_draw_image_rect(sk_canvas_t* ccanvas, const sk_image_t* cimage, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);

/* sk_paint.h */
sk_paint_t* sk_paint_new(void);
sk_paint_t* sk_paint_clone(sk_paint_t*);
void sk_paint_delete(sk_paint_t*);
void sk_paint_set_antialias(sk_paint_t*, bool);
void sk_paint_set_color(sk_paint_t*, sk_color_t);
void sk_paint_set_color4f(sk_paint_t* paint, sk_color4f_t* color, sk_colorspace_t* colorspace);
void sk_paint_set_style(sk_paint_t*, sk_paint_style_t);
void sk_paint_set_stroke_width(sk_paint_t*, float width);
void sk_paint_set_stroke_miter(sk_paint_t*, float miter);
void sk_paint_set_stroke_cap(sk_paint_t*, sk_stroke_cap_t);
void sk_paint_set_stroke_join(sk_paint_t*, sk_stroke_join_t);
void sk_paint_set_blendmode(sk_paint_t*, sk_blendmode_t);
void sk_paint_set_dither(sk_paint_t*, bool);
void sk_paint_set_imagefilter(sk_paint_t*, sk_imagefilter_t*);

/* sk_image.h */
sk_image_t* sk_image_new_raster_copy(const sk_imageinfo_t* cinfo, const void* pixels, size_t rowBytes);
sk_image_t* sk_image_new_from_encoded(const sk_data_t* cdata);
void sk_image_unref(const sk_image_t* cimage);
int sk_image_get_width(const sk_image_t* cimage);
int sk_image_get_height(const sk_image_t* cimage);
bool sk_image_read_pixels(const sk_image_t* image, const sk_imageinfo_t* dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, int srcY, sk_image_caching_hint_t cachingHint);

/* sk_path.h */
sk_path_t* sk_path_new(void);
void sk_path_delete(sk_path_t*);
sk_path_t* sk_path_clone(const sk_path_t* cpath);
void sk_path_get_bounds(const sk_path_t*, sk_rect_t*);
void sk_path_set_filltype(sk_path_t*, sk_path_filltype_t);
bool sk_path_parse_svg_string (sk_path_t* cpath, const char* str);

/* sk_pathbuilder.h */
sk_pathbuilder_t* sk_pathbuilder_new(void);
sk_pathbuilder_t* sk_pathbuilder_new_from_path(const sk_path_t* path);
void sk_pathbuilder_delete(sk_pathbuilder_t* builder);
void sk_pathbuilder_move_to(sk_pathbuilder_t* builder, float x, float y);
void sk_pathbuilder_line_to(sk_pathbuilder_t* builder, float x, float y);
void sk_pathbuilder_quad_to(sk_pathbuilder_t* builder, float x0, float y0, float x1, float y1);
void sk_pathbuilder_cubic_to(sk_pathbuilder_t* builder, float x0, float y0, float x1, float y1, float x2, float y2);
void sk_pathbuilder_close(sk_pathbuilder_t* builder);
void sk_pathbuilder_add_rect(sk_pathbuilder_t* builder, const sk_rect_t* rect, sk_path_direction_t dir);
void sk_pathbuilder_add_rrect(sk_pathbuilder_t* builder, const sk_rrect_t* rect, sk_path_direction_t dir);
void sk_pathbuilder_add_rounded_rect(sk_pathbuilder_t* builder, const sk_rect_t* rect, float rx, float ry, sk_path_direction_t dir);
void sk_pathbuilder_add_oval(sk_pathbuilder_t* builder, const sk_rect_t* rect, sk_path_direction_t dir);
void sk_pathbuilder_add_circle(sk_pathbuilder_t* builder, float x, float y, float radius, sk_path_direction_t dir);
void sk_pathbuilder_add_arc(sk_pathbuilder_t* builder, const sk_rect_t* rect, float startAngle, float sweepAngle);
void sk_pathbuilder_set_filltype(sk_pathbuilder_t* builder, sk_path_filltype_t filltype);
void sk_pathbuilder_reset(sk_pathbuilder_t* builder);
sk_path_t* sk_pathbuilder_snapshot_path(sk_pathbuilder_t* builder);
sk_path_t* sk_pathbuilder_detach_path(sk_pathbuilder_t* builder);

/* sk_colorspace.h */
sk_colorspace_t* sk_colorspace_new_srgb(void);
void sk_colorspace_unref(sk_colorspace_t* colorspace);

/* sk_data.h */
sk_data_t* sk_data_new_with_copy(const void* src, size_t length);
void sk_data_unref(const sk_data_t*);
size_t sk_data_get_size(const sk_data_t*);
const void* sk_data_get_data(const sk_data_t*);

/* sk_imagefilter.h */
sk_imagefilter_t* sk_imagefilter_new_drop_shadow(float dx, float dy, float sigmaX, float sigmaY, sk_color_t color, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
sk_imagefilter_t* sk_imagefilter_new_drop_shadow_only(float dx, float dy, float sigmaX, float sigmaY, sk_color_t color, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
sk_imagefilter_t* sk_imagefilter_new_blur(float sigmaX, float sigmaY, sk_shader_tilemode_t tileMode, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
void sk_imagefilter_unref(sk_imagefilter_t* cfilter);

/* sk_rrect.h */
sk_rrect_t* sk_rrect_new(void);
void sk_rrect_delete(const sk_rrect_t* rrect);
void sk_rrect_set_rect_xy(sk_rrect_t* rrect, const sk_rect_t* rect, float xRad, float yRad);

/* sk_surface.h — PNG roundtrip / primitive shadow subset */
bool sk_surface_peek_pixels(sk_surface_t* surface, sk_pixmap_t* pixmap);

/* sk_pixmap.h — PNG roundtrip / primitive shadow subset */
sk_pixmap_t* sk_pixmap_new(void);
void sk_pixmap_destructor(sk_pixmap_t* cpixmap);
sk_pixmap_t* sk_pixmap_new_with_params(const sk_imageinfo_t* cinfo, const void* addr, size_t rowBytes);
void sk_pixmap_get_info(const sk_pixmap_t* cpixmap, sk_imageinfo_t* cinfo);
size_t sk_pixmap_get_row_bytes(const sk_pixmap_t* cpixmap);
void* sk_pixmap_get_writable_addr(const sk_pixmap_t* cpixmap);
bool sk_pngencoder_encode(sk_wstream_t* dst, const sk_pixmap_t* src, const sk_pngencoder_options_t* options);

/* sk_stream.h — PNG roundtrip / primitive shadow subset */
sk_wstream_dynamicmemorystream_t* sk_dynamicmemorywstream_new(void);
sk_data_t* sk_dynamicmemorywstream_detach_as_data(sk_wstream_dynamicmemorystream_t* cstream);
void sk_dynamicmemorywstream_destroy(sk_wstream_dynamicmemorystream_t* cstream);

/* sk_maskfilter.h — PNG roundtrip / primitive shadow subset */
sk_maskfilter_t* sk_maskfilter_new_blur(sk_blurstyle_t, float sigma);
sk_maskfilter_t* sk_maskfilter_new_blur_with_flags(sk_blurstyle_t, float sigma, bool respectCTM);
void sk_maskfilter_unref(sk_maskfilter_t*);

/* sk_colorfilter.h — PNG roundtrip / primitive shadow subset */
sk_colorfilter_t* sk_colorfilter_new_mode(sk_color_t c, sk_blendmode_t mode);
void sk_colorfilter_unref(sk_colorfilter_t* filter);

/* sk_paint.h — PNG roundtrip / primitive shadow subset */
void sk_paint_set_maskfilter(sk_paint_t*, sk_maskfilter_t*);
void sk_paint_set_colorfilter(sk_paint_t*, sk_colorfilter_t*);

/*
 * P03C development-only supplement to ../native/skia-4.152.0.ffi.h.
 * Exact C ABI from mono/skia 8f5cc7a4c200ba8ecc5bc6263cf9f8bfe0ba6e6b,
 * SkiaSharp v4.152.0, b40fe16da7ae50d7a2b488beef6c249f012856af.
 * Copyright 2014 Google Inc.; 2015 Xamarin Inc.; 2017 Microsoft Corporation.
 * BSD-style license: ../native/licenses/macos/THIRD-PARTY-NOTICES.txt (Skia).
 * Base types/declarations are reused verbatim, never copied or replaced.
 * Source guards/export macros and unrelated declarations are omitted.
 */
typedef struct sk_document_t sk_document_t;
typedef struct sk_string_t sk_string_t;
typedef struct sk_path_effect_t sk_path_effect_t;

/* ../native/upstream-4.152.0/sk_types.h */
typedef struct {
    int16_t  fTimeZoneMinutes;
    uint16_t fYear;
    uint8_t  fMonth;
    uint8_t  fDayOfWeek;
    uint8_t  fDay;
    uint8_t  fHour;
    uint8_t  fMinute;
    uint8_t  fSecond;
} sk_document_pdf_datetime_t;

typedef struct {
    sk_string_t*                fTitle;
    sk_string_t*                fAuthor;
    sk_string_t*                fSubject;
    sk_string_t*                fKeywords;
    sk_string_t*                fCreator;
    sk_string_t*                fProducer;
    sk_document_pdf_datetime_t* fCreation;
    sk_document_pdf_datetime_t* fModified;
    float                       fRasterDPI;
    bool                        fPDFA;
    int                         fEncodingQuality;
} sk_document_pdf_metadata_t;

/* upstream-4.152.0/sk_document.h */
void sk_document_unref(sk_document_t* document);
sk_document_t* sk_document_create_pdf_from_stream_with_metadata(sk_wstream_t* stream, const sk_document_pdf_metadata_t* metadata);
sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content);
void sk_document_end_page(sk_document_t* document);
void sk_document_close(sk_document_t* document);
void sk_document_abort(sk_document_t* document);

/* upstream-4.152.0/sk_svg.h */
sk_canvas_t* sk_svgcanvas_create_with_stream(const sk_rect_t* bounds, sk_wstream_t* stream);

/* ../native/upstream-4.152.0/sk_canvas.h, sk_paint.h */
void sk_canvas_destroy(sk_canvas_t* ccanvas);
void sk_paint_set_path_effect(sk_paint_t* cpaint, sk_path_effect_t* effect);

/* upstream-4.152.0/sk_patheffect.h */
void sk_path_effect_unref(sk_path_effect_t* t);
sk_path_effect_t* sk_path_effect_create_dash(const float intervals[], int count, float phase);

/*
 * P03F development-only SVG supplement. Exact public C ABI from mono/skia
 * 8f5cc7a4c200ba8ecc5bc6263cf9f8bfe0ba6e6b, SkiaSharp v4.152.0,
 * b40fe16da7ae50d7a2b488beef6c249f012856af.
 * Copyright 2014 Google Inc.; 2015 Xamarin Inc.; 2017 Microsoft Corporation.
 * BSD license: ../native/licenses/macos/THIRD-PARTY-NOTICES.txt.
 * Export guards and unrelated declarations omitted; base declarations reused.
 */
typedef struct sk_shader_t sk_shader_t;

/* upstream-4.152.0/sk_shader.h */
void sk_shader_unref(sk_shader_t* shader);
sk_shader_t* sk_shader_new_color4f(const sk_color4f_t* color, const sk_colorspace_t* colorspace);
sk_shader_t* sk_shader_new_linear_gradient_color4f(const sk_point_t points[2], const sk_color4f_t* colors, const sk_colorspace_t* colorspace, const float colorPos[], int colorCount, sk_shader_tilemode_t tileMode, const sk_matrix_t* localMatrix);

/* ../native/upstream-4.152.0/sk_paint.h */
void sk_paint_set_shader(sk_paint_t*, sk_shader_t*);

/* ../native/upstream-4.152.0/sk_path.h */
void sk_path_compute_tight_bounds(const sk_path_t*, sk_rect_t*);
void sk_path_transform(sk_path_t* cpath, const sk_matrix_t* cmatrix);

/* upstream-4.152.0/sk_matrix.h */
bool sk_matrix_try_invert(sk_matrix_t* matrix, sk_matrix_t* result);
void sk_matrix_concat(sk_matrix_t* result, sk_matrix_t* first, sk_matrix_t* second);
void sk_matrix_map_points(sk_matrix_t* matrix, sk_point_t* dst, sk_point_t* src, int count);

/*
 * P03F development-only supplement to native/skia-4.152.0.ffi.h.
 * ABI: mono/skia 8f5cc7a4c200ba8ecc5bc6263cf9f8bfe0ba6e6b, C headers
 * preserved under upstream-skia-4.152.0/. Do not use with another ABI.
 * Original copyright Google/Xamarin/Microsoft; BSD license preserved in
 * ../native/licenses/macos/THIRD-PARTY-NOTICES.txt. No production loader.
 */
sk_imagefilter_t* sk_imagefilter_new_empty(void);
sk_imagefilter_t* sk_imagefilter_new_blend(sk_blendmode_t mode, const sk_imagefilter_t* background, const sk_imagefilter_t* foreground, const sk_rect_t* cropRect);
sk_imagefilter_t* sk_imagefilter_new_color_filter(sk_colorfilter_t* cf, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
sk_imagefilter_t* sk_imagefilter_new_crop(const sk_rect_t* rect, sk_shader_tilemode_t tileMode, const sk_imagefilter_t* input);
sk_imagefilter_t* sk_imagefilter_new_merge(const sk_imagefilter_t* cfilters[], int count, const sk_rect_t* cropRect);
sk_imagefilter_t* sk_imagefilter_new_offset(float dx, float dy, const sk_imagefilter_t* input, const sk_rect_t* cropRect);
sk_colorfilter_t* sk_colorfilter_new_color_matrix(const float array[20]);
sk_colorfilter_t* sk_colorfilter_new_linear_to_srgb_gamma(void);
sk_colorfilter_t* sk_colorfilter_new_srgb_to_linear_gamma(void);
sk_colorfilter_t* sk_colorfilter_new_luma_color(void);
sk_colorspace_t* sk_colorspace_new_srgb_linear(void);

/* P03G public C-ABI supplement. Raw pinned declarations: sk_path.h. */
sk_path_filltype_t sk_path_get_filltype(sk_path_t* cpath);
bool sk_path_is_rect(sk_path_t* cpath, sk_rect_t* rect, bool* isClosed, sk_path_direction_t* direction);
bool sk_path_is_rrect(sk_path_t* cpath, sk_rrect_t* bounds);
bool sk_path_is_oval(sk_path_t* cpath, sk_rect_t* bounds);

sk_shader_t* sk_image_make_raw_shader(const sk_image_t*,sk_shader_tilemode_t,sk_shader_tilemode_t,const sk_sampling_options_t*,const sk_matrix_t*);