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)
13
private readonly
EncoderParameterValueType
_parameterValueType;
36
public
EncoderParameterValueType
Type => _parameterValueType;
41
public
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;
300
int size = (
EncoderParameterValueType
)Type switch
302
EncoderParameterValueType
.ValueTypeByte or
EncoderParameterValueType
.ValueTypeAscii => 1,
303
EncoderParameterValueType
.ValueTypeShort => 2,
304
EncoderParameterValueType
.ValueTypeLong => 4,
305
EncoderParameterValueType
.ValueTypeRational or
EncoderParameterValueType
.ValueTypeLongRange => 2 * 4,
306
EncoderParameterValueType
.ValueTypeUndefined => 1,
307
EncoderParameterValueType
.ValueTypeRationalRange => 2 * 2 * 4,
317
_parameterValueType = (
EncoderParameterValueType
)Type;
323
public EncoderParameter(Encoder encoder, int numberValues,
EncoderParameterValueType
type, IntPtr value)
327
EncoderParameterValueType
.ValueTypeByte or
EncoderParameterValueType
.ValueTypeAscii => 1,
328
EncoderParameterValueType
.ValueTypeShort => 2,
329
EncoderParameterValueType
.ValueTypeLong => 4,
330
EncoderParameterValueType
.ValueTypeRational or
EncoderParameterValueType
.ValueTypeLongRange => 2 * 4,
331
EncoderParameterValueType
.ValueTypeUndefined => 1,
332
EncoderParameterValueType
.ValueTypeRationalRange => 2 * 2 * 4,
333
EncoderParameterValueType
.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)
10
private void CheckEncoderParameter(EncoderParameter encoderParameter, Encoder expectedEncoder,
EncoderParameterValueType
expectedType, int expectedNumberOfValues)
43
CheckEncoderParameter(ep, encoder,
EncoderParameterValueType
.ValueTypeByte, 1);
47
[InlineData(false,
EncoderParameterValueType
.ValueTypeByte)]
48
[InlineData(true,
EncoderParameterValueType
.ValueTypeUndefined)]
49
public void Ctor_Encoder_ByteValue_Bool(bool undefined,
EncoderParameterValueType
expected)
62
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeShort, 1);
72
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeLong, 1);
82
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeRational, 1);
91
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeRationalRange, 1);
100
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeLongRange, 1);
109
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeAscii, value.Length);
118
CheckEncoderParameter(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)]
124
public void Ctor_Encoder_ByteArray_Bool(byte[] value, bool undefined,
EncoderParameterValueType
expected)
136
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeShort, value.Length);
145
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeLong, value.Length);
153
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeRational, numerator.Length);
161
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeLongRange, rangeBegin.Length);
169
CheckEncoderParameter(ep, s_anyEncoder,
EncoderParameterValueType
.ValueTypeRationalRange, numerator1.Length);
176
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeAscii, IntPtr.Zero };
177
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeByte, IntPtr.Zero };
178
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeLong, IntPtr.Zero };
179
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeLongRange, IntPtr.Zero };
180
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeRational, IntPtr.Zero };
181
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeRationalRange, IntPtr.Zero };
182
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeShort, IntPtr.Zero };
183
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeUndefined, IntPtr.Zero };
184
yield return new object[] { 0,
EncoderParameterValueType
.ValueTypeUndefined, IntPtr.Zero };
190
public void Ctor_Encoder_NumberOfValues_Type_Value(int numberOfValues,
EncoderParameterValueType
type, IntPtr value)
210
Assert.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))]
308
public void Ctor_Encoder_TooBigNumberOfValues_Type_Value_AccessViolationException(
EncoderParameterValueType
type, int numberOfValues, Type expected)
321
EncoderParameterValueType
anyType =
EncoderParameterValueType
.ValueTypeAscii;