-
Notifications
You must be signed in to change notification settings - Fork 538
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
Implement SkCanvas::SaveLayerRec #2962
base: main
Are you sure you want to change the base?
Conversation
Not sure my magic with CI is working with the auto detection of the skia branch (probably because I am not doing it right for forks) so maybe just update the submodule here and we can merge in one go later once the skia PR is merged. |
@@ -1066,4 +1076,13 @@ public void Restore () | |||
} | |||
} | |||
} | |||
|
|||
[Flags] | |||
public enum SKSaveLayerFlags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public enum SKSaveLayerFlags | |
public enum SKCanvasSaveLayerFlags |
@@ -68,6 +68,16 @@ public int SaveLayer (SKPaint paint) | |||
return SkiaApi.sk_canvas_save_layer (Handle, null, paint == null ? IntPtr.Zero : paint.Handle); | |||
} | |||
|
|||
public int SaveLayer (SKRect bounds, SKPaint paint, SKImageFilter backdrop, SKSaveLayerFlags saveLayerFlags = SKSaveLayerFlags.None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth creating a rec struct now instead of adding overloads? The next skia update will have a filters list and a color space, so reducing the new things to a new property may be nicer.
public struct SKCanvasSaveLayerRec
{
public SKRect? Bounds { get; set; }
public SKPaint? Paint { get; set; }
public SKImageFilter? Backdrop { get; set; }
public SKCanvasSaveLayerFlags { get; set; }
}
Then in the save layer we can "unpack" this struct and pass it as the single C function. This way we don't need to create yet another overload to the save layer world just to add colorspace.
Description of Change
Implement SkCanvas::SaveLayerRec
Bugs Fixed
API Changes
Added:
int SKCanvas.SaveLayer(SKRect bounds, SKPaint paint, SKImageFilter backdrop, SKSaveLayerFlags saveLayerFlags = SKSaveLayerFlags.None)
int SKCanvas.SaveLayer(SKRect bounds, SKPaint paint, SKSaveLayerFlags saveLayerFlags)
Behavioral Changes
None.
Required skia PR
mono/skia#130
PR Checklist