Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose SKBlender #2830

Merged
merged 3 commits into from
Apr 15, 2024
Merged

Expose SKBlender #2830

merged 3 commits into from
Apr 15, 2024

Conversation

mattleibow
Copy link
Contributor

@mattleibow mattleibow commented Apr 12, 2024

Description of Change

SKBlender represents a custom blend function in the Skia pipeline.

When a blender is present in a paint, the BlendMode property is ignored. A blender combines a source color (the result of our paint) and destination color (from the canvas) into a final color.

Bugs Fixed

None.

API Changes

// NEW TYPES

public unsafe class SKBlender : SKObject, ISKReferenceCounted
{
    public static SKBlender CreateBlendMode (SKBlendMode mode);
    public static SKBlender CreateArithmetic (float k1, float k2, float k3, float k4, bool enforcePMColor);
}

public class SKRuntimeBlenderBuilder : SKRuntimeEffectBuilder
{
    public SKRuntimeBlenderBuilder (SKRuntimeEffect effect);
    public SKBlender Build ();
}

// NEW MEMBERS

class SKImageFilter
{
    public static SKImageFilter CreateBlendMode (SKBlender blender, SKImageFilter? background);
    public static SKImageFilter CreateBlendMode (SKBlender blender, SKImageFilter? background, SKImageFilter? foreground);
    public static SKImageFilter CreateBlendMode (SKBlender blender, SKImageFilter? background, SKImageFilter? foreground, SKRect cropRect);
}

class SKPaint
{
    public SKBlender Blender { get; set; }
}

class SKRuntimeEffect
{
    public SKBlender ToBlender ();
    public SKBlender ToBlender (SKRuntimeEffectUniforms uniforms);
    public SKBlender ToBlender (SKRuntimeEffectUniforms uniforms, SKRuntimeEffectChildren children);
}

struct SKRuntimeEffectChild
{
    public SKRuntimeEffectChild (SKBlender blender);
    public SKBlender Blender { get; }
    public static implicit operator SKRuntimeEffectChild (SKBlender blender);
}

class SKShader
{
    public static SKShader CreateBlend (SKBlendMode mode, SKShader shaderA, SKShader shaderB);
    public static SKShader CreateBlend (SKBlender blender, SKShader shaderA, SKShader shaderB);
}

Behavioral Changes

None.

Required skia PR

mono/skia#123

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Merged related skia PRs
  • Changes adhere to coding standard
  • Updated documentation

@mattleibow mattleibow force-pushed the dev/blender branch 4 times, most recently from 0339d50 to 28b417d Compare April 14, 2024 17:56
@mattleibow mattleibow marked this pull request as ready for review April 14, 2024 21:36
@mattleibow mattleibow mentioned this pull request Apr 14, 2024
3 tasks
@mattleibow
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@mattleibow mattleibow merged commit aa4f2ff into main Apr 15, 2024
1 check passed
@mattleibow mattleibow deleted the dev/blender branch April 15, 2024 21:50
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.

1 participant