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

API Proposal: Update Encoder, EncoderParameterValueType to match GDI+ #30543

Closed
qmfrederik opened this issue Aug 9, 2019 · 4 comments · Fixed by #32873
Closed

API Proposal: Update Encoder, EncoderParameterValueType to match GDI+ #30543

qmfrederik opened this issue Aug 9, 2019 · 4 comments · Fixed by #32873
Labels
api-approved API was approved in API review, it can be implemented area-System.Drawing
Milestone

Comments

@qmfrederik
Copy link
Contributor

GDI+ has new values for:

  • Encoder: EncoderColorSpace, EncoderImageItems and EncoderSaveAsCMYK
  • EncoderParameterValueType: EncoderParameterValueTypePointer

The proposal is to update the Encoder type and EncoderParameterValueType to expose these new values:

namespace System.Drawing
{
    public sealed partial class Encoder
    {
        public static readonly System.Drawing.Imaging.Encoder ChrominanceTable;
        public static readonly System.Drawing.Imaging.Encoder ColorDepth;
        public static readonly System.Drawing.Imaging.Encoder Compression;
        public static readonly System.Drawing.Imaging.Encoder LuminanceTable;
        public static readonly System.Drawing.Imaging.Encoder Quality;
        public static readonly System.Drawing.Imaging.Encoder RenderMethod;
        public static readonly System.Drawing.Imaging.Encoder SaveFlag;
        public static readonly System.Drawing.Imaging.Encoder ScanMethod;
        public static readonly System.Drawing.Imaging.Encoder Transformation;
        public static readonly System.Drawing.Imaging.Encoder Version;
+       public static readonly System.Drawing.Imaging.Encoder ColorSpace;
+       public static readonly System.Drawing.Imaging.Encoder ImageItems;
+       public static readonly System.Drawing.Imaging.Encoder SaveAsCmyk;
        public Encoder(System.Guid guid) { }
        public System.Guid Guid { get { throw null; } }
    }

    public enum EncoderParameterValueType
    {
        ValueTypeByte = 1,
        ValueTypeAscii = 2,
        ValueTypeShort = 3,
        ValueTypeLong = 4,
        ValueTypeRational = 5,
        ValueTypeLongRange = 6,
        ValueTypeUndefined = 7,
        ValueTypeRationalRange = 8,
+       ValueTypePointer = 9,
    }
}

See https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-constant-image-encoder-constants, https://docs.microsoft.com/en-us/windows/win32/api/gdiplusenums/ne-gdiplusenums-encoderparametervaluetype

@ViktorHofer
Copy link
Member

cc @safern

@safern
Copy link
Member

safern commented Aug 9, 2019

The state that the package is right now this would only be able to be brought to netcoreapp as we harvested the ns2.0/nca2.0/2.1 assets since we did some improvements to use new 3.0 libraries for interop. cc: @JeremyKuhne

@qmfrederik
Copy link
Contributor Author

I think that's acceptable - users wanting to use these values on earlier versions can do so if they want to:

  • The Encoder constructor is public, so anyone can create its own instance of the Encoder class with the correct Guid values
  • You could always do EncoderParameterValueType v = (EncoderParameterValueType)9

@msftgits msftgits transferred this issue from dotnet/corefx Feb 1, 2020
@msftgits msftgits added this to the 5.0 milestone Feb 1, 2020
@terrajobst terrajobst added api-approved API was approved in API review, it can be implemented and removed api-ready-for-review labels Feb 20, 2020
@terrajobst
Copy link
Member

terrajobst commented Feb 20, 2020

Video

  • Looks good as proposed
namespace System.Drawing.Imaging
{
    public sealed partial class Encoder
    {
        // Existing:
        // public static readonly Encoder ChrominanceTable;
        // public static readonly Encoder ColorDepth;
        // public static readonly Encoder Compression;
        // public static readonly Encoder LuminanceTable;
        // public static readonly Encoder Quality;
        // public static readonly Encoder RenderMethod;
        // public static readonly Encoder SaveFlag;
        // public static readonly Encoder ScanMethod;
        // public static readonly Encoder Transformation;
        // public static readonly Encoder Version;
        public static readonly Encoder ColorSpace;
        public static readonly Encoder ImageItems;
        public static readonly Encoder SaveAsCmyk;
    }

    public enum EncoderParameterValueType
    {
        // Existing:
        // ValueTypeByte = 1,
        // ValueTypeAscii = 2,
        // ValueTypeShort = 3,
        // ValueTypeLong = 4,
        // ValueTypeRational = 5,
        // ValueTypeLongRange = 6,
        // ValueTypeUndefined = 7,
        // ValueTypeRationalRange = 8,
        ValueTypePointer = 9,
    }
}

@maryamariyan maryamariyan added the untriaged New issue has not been triaged by the area owner label Feb 23, 2020
@maryamariyan maryamariyan removed the untriaged New issue has not been triaged by the area owner label Mar 3, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api-approved API was approved in API review, it can be implemented area-System.Drawing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants