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

Added SKCanvas.DrawPoints with Count Override #2987

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DJGosnell
Copy link

@DJGosnell DJGosnell commented Sep 3, 2024

Description of Change

Sometimes it's useful to pass an array of points to SKCanvas.DrawPoints but not to draw all of them. The API currently doesn't accept Spans at this point, so it is a stop-gap until that decision has been made.

No tests added currently as there is not currently a test in the tests/Tests/SkiaSharp/SKCanvasTest.cs file for drawing points.

Bugs Fixed

API Changes

Add public void SKCanvasDrawPoints (SKPointMode mode, SKPoint[] points, int count, SKPaint paint) overload.

Behavioral Changes

None.

Required skia PR

None.

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

Copy link
Contributor

Hey there @DJGosnell! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@DJGosnell DJGosnell changed the title Added SKCanvas.DrawPoints with a count override to allow for partial … Added SKCanvas.DrawPoints with Count Override Sep 3, 2024
@DJGosnell
Copy link
Author

@dotnet-policy-service agree

Copy link
Contributor

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. Maybe also throw an out of range exception if the count is negative or greater than the length of the array. Maybe also have a start index? This way it can be used in a sort of batch draw?

It may also be nice if you just added an ReadOnlySpan overload here too and then it will make the whole PR all nice. If you do that, then you can make both array overloads just use the span overload with a subset span of the whole array.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Passing DrawPoints a Partial Array
2 participants