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

.NET Core should have a System.Drawing.Primitives Contract with core Types from System.Drawing. #14431

Closed
Petermarcu opened this issue Apr 9, 2015 · 8 comments
Assignees
Milestone

Comments

@Petermarcu
Copy link
Member

Based on analysis, these types are commonly used even outside Image processing scenarios. We should factor them out to allow for greater code reuse and portability on .NET Core.

• Color
• KnownColor
• Point
• PointF
• Rectangle
• RectangleF
• Size
• SizeF

@Kukkimonsuta
Copy link

I don't think KnownColor should be included since it is system dependant and most values have no meaning under console only environments.

@mellinoe
Copy link
Contributor

I would also agree that KnownColor, and also all of the static "named" colors on the Color struct should probably be eliminated. We can always have some sort of helper library that has a "Colors" class with a bunch of pre-defined colors in it.

@Priya91
Copy link
Contributor

Priya91 commented Apr 15, 2015

From our internal discussion:
We decided to go with WPF types over System.Drawing ones, however, these WPF types use doubles for their coordinate system, the extra precision over floats is never necessary and floats can be used for SIMD. For now, we will implement these types with float, and add integer versions later, if they are needed. The proposal is to create the following new types under System.Numerics

  • Color
  • Rectangle
  • Size
  • Point

Api Review to follow shortly internally.

@mikedn
Copy link
Contributor

mikedn commented Apr 16, 2015

however, these WPF types use doubles for their coordinate system, the extra precision over floats is never necessary and floats can be used for SIMD

Not to say I'm against using floats but I'm not quite sure what this has to do SIMD. Is it because a double based Rectangle would require 2 SSE registers instead of one?

Api Review to follow shortly internally

Why not create a speclet on GitHub first so the community can provide feedback?

@patricksadowski
Copy link

+1 for a speclet. I have some thoughts about color (RGB, HSV, HSL) and namespace (why System.Numerics and not System.Drawing.Primitives?)

@Marfusios
Copy link

Same as patricksadowski , Color type under System.Numerics it's a little weird

@Priya91
Copy link
Contributor

Priya91 commented Apr 16, 2015

Not to say I'm against using floats but I'm not quite sure what this has to do SIMD. Is it because a double based Rectangle would require 2 SSE registers instead of one?

By SIMD, the .NET implementation of Vector and other SIMD related types in System.Numerics.Vectors is based on floats, hence using the same primitive type for these types as well. For example a color with rgb can be represented as a Vector3.

Same as patricksadowski , Color type under System.Numerics it's a little weird

A color is RGB, or RGBA which can be represented as Vector3, Vector4. The Color type here will not have any named colors, but vector functions like Lerp, Multiply. It is to be treated as a numeric.
But that said, there was a concern raised that existing graphic applications that use System.Numerics and other .NET namespaces (especially Windows.UI) that have these types defined, will now have to resolve conflict of which namespace this type is from. System.Numerics may not be the right way, and we may have to use a new namespace or rename conflicting type Color to ColorV. I will add this concern in the API review.

@Priya91
Copy link
Contributor

Priya91 commented Apr 28, 2015

Closing this issue, and tracking with dotnet/corefx#1563.

@Priya91 Priya91 closed this as completed Apr 28, 2015
@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 1.0.0-rtm milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants