-
-
Notifications
You must be signed in to change notification settings - Fork 853
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
Change the constructor of PixelTypeInfo and ImageMetadata from internal to public so that a user can implement IImageInfo #1929
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1929 +/- ##
=======================================
Coverage 88% 88%
=======================================
Files 968 966 -2
Lines 51564 51324 -240
Branches 6428 6397 -31
=======================================
- Hits 45403 45192 -211
+ Misses 5091 5074 -17
+ Partials 1070 1058 -12
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -16,7 +16,7 @@ public class PixelTypeInfo | |||
/// </summary> | |||
/// <param name="bitsPerPixel">Color depth, in number of bits per pixel.</param> | |||
/// <param name="alpha">Tthe pixel alpha transparency behavior.</param> | |||
internal PixelTypeInfo(int bitsPerPixel, PixelAlphaRepresentation? alpha = null) | |||
public PixelTypeInfo(int bitsPerPixel, PixelAlphaRepresentation? alpha = null) |
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.
@antonfirsov I'm wondering whether we should avoid the nullable parameter here and either provide an overload or break things for V2.
I'm not overly concerned about the implications of making this public because I'd like to do a thorough review for V3 to make sure we capture everything we should.
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.
I think this should be refactored into 2 constructors for now. In long term, I would explore init-only setters for such API-s.
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.
As for the V3 API concern: I think minor breaking changes are fine in advanced API-s.
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.
Yeah, that keeps with our pattern for avoiding nullable parameters when possible. @jz5 Could you please update the PixelTypeInfo
constructor to use separate overloads with and without the PixelAlphaRepresentation
(not nullable) parameter. Thanks!
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.
I've updated it. How about this?
…nd without the PixelAlphaRepresentation (not nullable) parameter.
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.
LGTM, thanks!
Prerequisites
Description
Case a user implements
IImageInfo
and supports user-specific image formats:IImageInfo
hasPixelTypeInfo
andImageMetadata
properties. ButImageMetadata
cannot be instanced because it has an internal constructor.PixelTypeInfo
cannot be instanced because it has an internal constructor.So change the constructor of
PixelTypeInfo
andImageMetadata
from internal to publicRelated discussion: #1914