81 references to EncoderParameterValueType
System.Drawing (1)
System.Drawing.cs (1)
83[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Imaging.EncoderParameterValueType))]
System.Drawing.Common (41)
System\Drawing\Imaging\EncoderParameter.cs (40)
13private readonly EncoderParameterValueType _parameterValueType; 36public EncoderParameterValueType Type => _parameterValueType; 41public EncoderParameterValueType ValueType => _parameterValueType; 67_parameterValueType = EncoderParameterValueType.ValueTypeByte; 80? EncoderParameterValueType.ValueTypeUndefined 81: EncoderParameterValueType.ValueTypeByte; 94_parameterValueType = EncoderParameterValueType.ValueTypeShort; 106_parameterValueType = EncoderParameterValueType.ValueTypeLong; 118_parameterValueType = EncoderParameterValueType.ValueTypeRational; 131_parameterValueType = EncoderParameterValueType.ValueTypeLongRange; 149_parameterValueType = EncoderParameterValueType.ValueTypeRationalRange; 164_parameterValueType = EncoderParameterValueType.ValueTypeAscii; 174_parameterValueType = EncoderParameterValueType.ValueTypeByte; 187_parameterValueType = undefined ? EncoderParameterValueType.ValueTypeUndefined : EncoderParameterValueType.ValueTypeByte; 200_parameterValueType = EncoderParameterValueType.ValueTypeShort; 212_parameterValueType = EncoderParameterValueType.ValueTypeLong; 235_parameterValueType = EncoderParameterValueType.ValueTypeRational; 255_parameterValueType = EncoderParameterValueType.ValueTypeLongRange; 282_parameterValueType = EncoderParameterValueType.ValueTypeRationalRange; 300int size = (EncoderParameterValueType)Type switch 302EncoderParameterValueType.ValueTypeByte or EncoderParameterValueType.ValueTypeAscii => 1, 303EncoderParameterValueType.ValueTypeShort => 2, 304EncoderParameterValueType.ValueTypeLong => 4, 305EncoderParameterValueType.ValueTypeRational or EncoderParameterValueType.ValueTypeLongRange => 2 * 4, 306EncoderParameterValueType.ValueTypeUndefined => 1, 307EncoderParameterValueType.ValueTypeRationalRange => 2 * 2 * 4, 317_parameterValueType = (EncoderParameterValueType)Type; 323public EncoderParameter(Encoder encoder, int numberValues, EncoderParameterValueType type, IntPtr value) 327EncoderParameterValueType.ValueTypeByte or EncoderParameterValueType.ValueTypeAscii => 1, 328EncoderParameterValueType.ValueTypeShort => 2, 329EncoderParameterValueType.ValueTypeLong => 4, 330EncoderParameterValueType.ValueTypeRational or EncoderParameterValueType.ValueTypeLongRange => 2 * 4, 331EncoderParameterValueType.ValueTypeUndefined => 1, 332EncoderParameterValueType.ValueTypeRationalRange => 2 * 2 * 4, 333EncoderParameterValueType.ValueTypePointer => IntPtr.Size,
System\Drawing\Imaging\EncoderParameters.cs (1)
49(EncoderParameterValueType)nativeParameters[i].Type,
System.Drawing.Common.Tests (39)
System\Drawing\Imaging\EncoderParameterTests.cs (39)
10private void CheckEncoderParameter(EncoderParameter encoderParameter, Encoder expectedEncoder, EncoderParameterValueType expectedType, int expectedNumberOfValues) 43CheckEncoderParameter(ep, encoder, EncoderParameterValueType.ValueTypeByte, 1); 47[InlineData(false, EncoderParameterValueType.ValueTypeByte)] 48[InlineData(true, EncoderParameterValueType.ValueTypeUndefined)] 49public void Ctor_Encoder_ByteValue_Bool(bool undefined, EncoderParameterValueType expected) 62CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeShort, 1); 72CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLong, 1); 82CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRational, 1); 91CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRationalRange, 1); 100CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLongRange, 1); 109CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeAscii, value.Length); 118CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeByte, value.Length); 122[InlineData(new byte[] { 1, 2 }, false, EncoderParameterValueType.ValueTypeByte)] 123[InlineData(new byte[] { 1, 2 }, true, EncoderParameterValueType.ValueTypeUndefined)] 124public void Ctor_Encoder_ByteArray_Bool(byte[] value, bool undefined, EncoderParameterValueType expected) 136CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeShort, value.Length); 145CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLong, value.Length); 153CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRational, numerator.Length); 161CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeLongRange, rangeBegin.Length); 169CheckEncoderParameter(ep, s_anyEncoder, EncoderParameterValueType.ValueTypeRationalRange, numerator1.Length); 176yield return new object[] { 0, EncoderParameterValueType.ValueTypeAscii, IntPtr.Zero }; 177yield return new object[] { 0, EncoderParameterValueType.ValueTypeByte, IntPtr.Zero }; 178yield return new object[] { 0, EncoderParameterValueType.ValueTypeLong, IntPtr.Zero }; 179yield return new object[] { 0, EncoderParameterValueType.ValueTypeLongRange, IntPtr.Zero }; 180yield return new object[] { 0, EncoderParameterValueType.ValueTypeRational, IntPtr.Zero }; 181yield return new object[] { 0, EncoderParameterValueType.ValueTypeRationalRange, IntPtr.Zero }; 182yield return new object[] { 0, EncoderParameterValueType.ValueTypeShort, IntPtr.Zero }; 183yield return new object[] { 0, EncoderParameterValueType.ValueTypeUndefined, IntPtr.Zero }; 184yield return new object[] { 0, EncoderParameterValueType.ValueTypeUndefined, IntPtr.Zero }; 190public void Ctor_Encoder_NumberOfValues_Type_Value(int numberOfValues, EncoderParameterValueType type, IntPtr value) 210Assert.Throws<InvalidOperationException>(() => new EncoderParameter(s_anyEncoder, 1, (EncoderParameterValueType)999, IntPtr.Zero)); 303[InlineData(EncoderParameterValueType.ValueTypeShort, (int.MaxValue / 2) + 1, typeof(OverflowException))] 304[InlineData(EncoderParameterValueType.ValueTypeLong, (int.MaxValue / 4) + 1, typeof(OverflowException))] 305[InlineData(EncoderParameterValueType.ValueTypeRational, (int.MaxValue / 8) + 1, typeof(OverflowException))] 306[InlineData(EncoderParameterValueType.ValueTypeLongRange, (int.MaxValue / 8) + 1, typeof(OverflowException))] 307[InlineData(EncoderParameterValueType.ValueTypeRationalRange, (int.MaxValue / 16) + 1, typeof(OverflowException))] 308public void Ctor_Encoder_TooBigNumberOfValues_Type_Value_AccessViolationException(EncoderParameterValueType type, int numberOfValues, Type expected) 321EncoderParameterValueType anyType = EncoderParameterValueType.ValueTypeAscii;