-
-
Notifications
You must be signed in to change notification settings - Fork 888
Expose final internals to allow decoupling Drawing. #1046
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
Conversation
|
Ok. I'm managed workarounds for everything but the |
|
I've temporarily enabled internals to test the build cross platform. To test and develop locally comment out the following line in the <InternalsVisibleTo Include="SixLabors.ImageSharp.Drawing" /> |
Codecov Report
@@ Coverage Diff @@
## master #1046 +/- ##
==========================================
+ Coverage 89.86% 89.89% +0.03%
==========================================
Files 1104 1107 +3
Lines 48948 49156 +208
Branches 3452 3447 -5
==========================================
+ Hits 43987 44191 +204
- Misses 4250 4253 +3
- Partials 711 712 +1
Continue to review full report at Codecov.
|
|
@antonfirsov Is there any reason you can think of why we shouldn't expose the first two extension methods here?
EDIT |
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.
Mostly good, however the API surface of GraphicsOptions and TextGraphicsOptions has several issues. The current API review/cleanup process is our last chance to address them:
GraphicsOptions.DefaultandTextGraphicsOptions.Defaultare exposing an arbitrary shared mutable state. It was not the case when those werestruct-s, and I think we should avoid this, and replace the singletons with default constructor calls.- The classes need a deep copy logic, just like
Configuration - The classes are showing the symptoms of the Telescoping Constructor anti-pattern. These constructors are unnecessary, since the properties are settable.
Additionally, we should remove <InternalsVisibleTo Include="SixLabors.ImageSharp.Drawing" /> from ImageSharp.csproj to ensure this is indeed the final step to close #1002.
|
Thanks for the fast review @antonfirsov I'm keen to move forward with this.
Agree with all of the above. That won't take me long.
Yeah, good point, will do. |
|
@antonfirsov I have updated everything except the csproj |
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.
The shared default instances are still there.
except the csproj InternalsVisibleTo declaration as the shared infrastructor classes used in Drawing rely on that call
I still think we shall get rid of those build errors in this step, or a separate PR before actually moving the whole thing out. The Drawing project shall include the shared infrastructure independently.
tests/ImageSharp.Tests/Drawing/Text/TextGraphicsOptionsTests.cs
Outdated
Show resolved
Hide resolved
Feel free to try. I got an ambiguity errors when I tried. |
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.
Ok, changed my mind 😄
It would be easier to fix those errors as part of the migration process.
Prerequisites
Description
Fixes accessibility for any remaining blockers that are stopping us decoupling ImageSharp.Drawing
TODO:
'ImageFrame.Configuration' is inaccessible due to its protection level.'float' does not contain a definition for 'Clamp' and no accessible extension method 'Clamp' accepting a first argument of type 'float'.'Image<TPixel>' does not contain a definition for 'GetMemoryAllocator' and no accessible extension method 'GetMemoryAllocator' accepting a first argument of type 'Image<TPixel>' could be found'MemoryAllocator' does not contain a definition for 'Allocate2D' and no accessible extension method 'Allocate2D' accepting a first argument of type 'MemoryAllocator' could be found.'GraphicsOptions.IsOpaqueColorWithoutBlending(Color)' is inaccessible due to its protection levelI consider this issue the highest priority for now and would really appreciate any assistance that can be given determining the best fix for each outstanding issue.