Skip to content

Add sk_runtimeeffect_make_image_filter C API functions#202

Open
mattleibow wants to merge 5 commits into
skiasharpfrom
dev/runtime-shader-image-filter
Open

Add sk_runtimeeffect_make_image_filter C API functions#202
mattleibow wants to merge 5 commits into
skiasharpfrom
dev/runtime-shader-image-filter

Conversation

@mattleibow

@mattleibow mattleibow commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

Add two C API functions for creating image filters from runtime shader effects:

  • sk_runtimeeffect_make_image_filter — single-child variant with maxSampleRadius, childShaderName (auto-detect if empty), optional input filter, and builder children for static child slots
  • sk_runtimeeffect_make_image_filter_with_children — multi-child variant with parallel childShaderNames/inputs arrays, maxSampleRadius, and builder children

Both reconstruct an SkRuntimeEffectBuilder from decomposed C API parameters and call SkImageFilters::RuntimeShader. Multi-child path uses skia_private::STArray<4> for stack-backed allocations.

Fixes mono/SkiaSharp#3776

@mattleibow mattleibow force-pushed the dev/runtime-shader-image-filter branch 2 times, most recently from e15df7a to 7a3037d Compare May 6, 2026 02:18
@mattleibow mattleibow changed the title Add sk_imagefilter_new_runtime_shader C API functions Add sk_runtimeeffect_make_image_filter C API functions May 6, 2026
mattleibow and others added 5 commits May 13, 2026 03:34
Add two new C API functions for creating image filters from runtime shaders:
- sk_imagefilter_new_runtime_shader: single-child variant
- sk_imagefilter_new_runtime_shader_with_children: multi-child with maxSampleRadius

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rename and relocate from sk_imagefilter_new_runtime_shader* to
sk_runtimeeffect_make_image_filter* to match the existing pattern of
sk_runtimeeffect_make_shader/color_filter/blender.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove children/childCount from sk_runtimeeffect_make_image_filter*
since these are not used in practice for image filters. Replace
std::vector with STArray for stack-backed small allocations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Children parameter is passed through to the builder for future use
with static shader/blender/colorfilter children alongside image
filter inputs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pass sampleRadius through to C++ RuntimeShader single-child path
instead of defaulting to 0.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mattleibow mattleibow force-pushed the dev/runtime-shader-image-filter branch from d1c7a67 to b0ad677 Compare May 13, 2026 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[api] Add SkSL image filter support (SKRuntimeEffect.ToImageFilter)

1 participant