20 instantiations of ImageFormat
System.Drawing.Common.Tests (20)
System\Drawing\Imaging\ImageFormatTests.cs (20)
8private static ImageFormat BmpImageFormat { get; } = new(new Guid("b96b3cab-0728-11d3-9d7b-0000f81ef32e")); 9private static ImageFormat EmfImageFormat { get; } = new(new Guid("b96b3cac-0728-11d3-9d7b-0000f81ef32e")); 10private static ImageFormat ExifImageFormat { get; } = new(new Guid("b96b3cb2-0728-11d3-9d7b-0000f81ef32e")); 11private static ImageFormat GifImageFormat { get; } = new(new Guid("b96b3cb0-0728-11d3-9d7b-0000f81ef32e")); 12private static ImageFormat TiffImageFormat { get; } = new(new Guid("b96b3cb1-0728-11d3-9d7b-0000f81ef32e")); 13private static ImageFormat PngImageFormat { get; } = new(new Guid("b96b3caf-0728-11d3-9d7b-0000f81ef32e")); 14private static ImageFormat MemoryBmpImageFormat { get; } = new(new Guid("b96b3caa-0728-11d3-9d7b-0000f81ef32e")); 15private static ImageFormat IconImageFormat { get; } = new(new Guid("b96b3cb5-0728-11d3-9d7b-0000f81ef32e")); 16private static ImageFormat JpegImageFormat { get; } = new(new Guid("b96b3cae-0728-11d3-9d7b-0000f81ef32e")); 17private static ImageFormat WmfImageFormat { get; } = new(new Guid("b96b3cad-0728-11d3-9d7b-0000f81ef32e")); 18private static ImageFormat HeifImageFormat { get; } = new(new Guid("{b96b3cb6-0728-11d3-9d7b-0000f81ef32e}")); 19private static ImageFormat WebpImageFormat { get; } = new(new Guid("{b96b3cb7-0728-11d3-9d7b-0000f81ef32e}")); 20private static ImageFormat CustomImageFormat { get; } = new(new Guid("48749428-316f-496a-ab30-c819a92b3137")); 85yield return new object[] { new ImageFormat(new Guid("48749428-316f-496a-ab30-c819a92b3137")), new ImageFormat(new Guid("48749428-316f-496a-ab30-c819a92b3137")), true }; 86yield return new object[] { new ImageFormat(new Guid("48749428-316f-496a-ab30-c819a92b3137")), new ImageFormat(new Guid("b96b3cad-0728-11d3-9d7b-0000f81ef32e")), false }; 87yield return new object[] { new ImageFormat(new Guid("48749428-316f-496a-ab30-c819a92b3137")), null, false }; 88yield return new object[] { new ImageFormat(new Guid("48749428-316f-496a-ab30-c819a92b3137")), new(), false }; 125Assert.Equal(guid.GetHashCode(), new ImageFormat(guid).GetHashCode());
188 references to ImageFormat
PresentationFramework-SystemDrawing (1)
SystemDrawingExtension.cs (1)
130metafile.Save(imageStream, ImageFormat.Png);
System.Drawing (1)
System.Drawing.cs (1)
90[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Drawing.Imaging.ImageFormat))]
System.Drawing.Common (14)
Special\NotSupported.cs (14)
764public System.Drawing.Imaging.ImageFormat RawFormat { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 797public void Save(System.IO.Stream stream, System.Drawing.Imaging.ImageFormat format) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 800public void Save(string filename, System.Drawing.Imaging.ImageFormat format) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } 2508public static System.Drawing.Imaging.ImageFormat Bmp { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2509public static System.Drawing.Imaging.ImageFormat Emf { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2510public static System.Drawing.Imaging.ImageFormat Exif { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2511public static System.Drawing.Imaging.ImageFormat Gif { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2513public static System.Drawing.Imaging.ImageFormat Icon { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2514public static System.Drawing.Imaging.ImageFormat Jpeg { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2515public static System.Drawing.Imaging.ImageFormat MemoryBmp { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2516public static System.Drawing.Imaging.ImageFormat Png { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2517public static System.Drawing.Imaging.ImageFormat Tiff { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 2518public static System.Drawing.Imaging.ImageFormat Wmf { get { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); } } 3043public bool IsDirectPrintingSupported(System.Drawing.Imaging.ImageFormat imageFormat) { throw new System.PlatformNotSupportedException(System.SR.SystemDrawingCommon_PlatformNotSupported); }
System.Drawing.Common.Tests (149)
mono\System.Drawing.Imaging\BmpCodecTests.cs (1)
440bmp.Save(sOutFile, ImageFormat.Bmp);
mono\System.Drawing.Imaging\GifCodecTests.cs (1)
194bmp.Save(sOutFile, ImageFormat.Gif);
mono\System.Drawing.Imaging\IconCodecTests.cs (10)
43Assert.True(image.RawFormat.Equals(ImageFormat.Icon)); 49Assert.True(bmp.RawFormat.Equals(ImageFormat.MemoryBmp)); 72Assert.True(bmp.RawFormat.Equals(ImageFormat.Icon)); 221Assert.True(bmp.RawFormat.Equals(ImageFormat.Icon)); 426Assert.True(bmp.RawFormat.Equals(ImageFormat.Icon)); 648Assert.True(bmp.RawFormat.Equals(ImageFormat.Icon)); 906Assert.True(bmp.RawFormat.Equals(ImageFormat.Icon)); 1839Assert.True(bmp.RawFormat.Equals(ImageFormat.Icon)); 1880bmp.Save(sOutFile, ImageFormat.Icon); 1884Assert.Equal(ImageFormat.Png, bmpLoad.RawFormat);
mono\System.Drawing.Imaging\JpegCodecTests.cs (1)
359bmp.Save(sOutFile, ImageFormat.Jpeg);
mono\System.Drawing.Imaging\PngCodecTests.cs (1)
580bmp.Save(sOutFile, ImageFormat.Png);
mono\System.Drawing.Imaging\TiffCodecTests.cs (1)
251bmp.Save(sOutFile, ImageFormat.Tiff);
mono\System.Drawing\BitmapTests.cs (8)
774Assert.Equal(ImageFormat.MemoryBmp, bmp.RawFormat); 788Assert.Equal(ImageFormat.Png, other.RawFormat); 1182Assert.Equal(b.RawFormat, ImageFormat.MemoryBmp); 1270Assert.Equal(bitmap.RawFormat, ImageFormat.Bmp); 1281Assert.Equal(image.RawFormat, ImageFormat.MemoryBmp); 1296Assert.Equal(bitmap.RawFormat, ImageFormat.Bmp); 1308Assert.Equal(image.RawFormat, ImageFormat.MemoryBmp); 1317Assert.Equal(image2.RawFormat, ImageFormat.MemoryBmp);
System\Drawing\BitmapTests.cs (24)
36yield return new object[] { "16x16_one_entry_4bit.ico", 16, 16, PixelFormat.Format32bppArgb, ImageFormat.Icon }; 37yield return new object[] { "bitmap_173x183_indexed_8bit.bmp", 173, 183, PixelFormat.Format8bppIndexed, ImageFormat.Bmp }; 38yield return new object[] { "16x16_nonindexed_24bit.png", 16, 16, PixelFormat.Format24bppRgb, ImageFormat.Png }; 43public void Ctor_FilePath(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) 54public void Ctor_FilePath_UseIcm(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) 91Assert.Equal(ImageFormat.Bmp, bitmap.RawFormat); 118public void Ctor_Stream(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) 130public void Ctor_Stream_UseIcm(string filename, int width, int height, PixelFormat pixelFormat, ImageFormat rawFormat) 168Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 192Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 211Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 291Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 308Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 325Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 336Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 607Assert.Equal(ImageFormat.MemoryBmp, result.RawFormat); 620Assert.Equal(ImageFormat.MemoryBmp, result.RawFormat); 629Assert.Equal(ImageFormat.MemoryBmp, result.RawFormat); 704Assert.Equal(ImageFormat.MemoryBmp, result.RawFormat); 742bitmapFromWmf.Save(output, ImageFormat.Png); 1569bitmap.Save(path, ImageFormat.Png); 1577Assert.Equal(ImageFormat.Png, bitmap.RawFormat); 1591bitmap.Save(restrictiveStream, ImageFormat.Png); 1600Assert.Equal(ImageFormat.Png, bitmap.RawFormat);
System\Drawing\IconTests.cs (3)
530Assert.Equal(ImageFormat.MemoryBmp, bitmap.RawFormat); 568Assert.Equal(ImageFormat.Png, bitmap.RawFormat); 619bitmap.Save(stream, ImageFormat.Png);
System\Drawing\ImageAnimator.ManualTests.cs (1)
60animation.Save(Path.Combine(testOutputFolder, $"{++frameIndexes[imageName]}_{timestamp}.jpg"), ImageFormat.Jpeg);
System\Drawing\ImageFormatConverterTests.cs (32)
12private readonly ImageFormat _imageFmt; 19_imageFmt = ImageFormat.Bmp; 31Assert.False(_imgFmtConv.CanConvertFrom(null, typeof(ImageFormat)), "ImageFormat"); 38Assert.False(_imgFmtConvFrmTD.CanConvertFrom(null, typeof(ImageFormat)), "TD ImageFormat"); 49Assert.False(_imgFmtConv.CanConvertTo(null, typeof(ImageFormat)), "ImageFormat"); 56Assert.False(_imgFmtConvFrmTD.CanConvertTo(null, typeof(ImageFormat)), "TD ImageFormat"); 65Assert.Equal(_imageFmt, (ImageFormat)_imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.ToString())); 66Assert.Equal(_imageFmt, (ImageFormat)_imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.ToString())); 72Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp)); 73Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.Guid)); 77Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp)); 78Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, ImageFormat.Bmp.Guid)); 83private ImageFormat ConvertFromName(string imgFormatName) 85return (ImageFormat)_imgFmtConvFrmTD.ConvertFrom(null, CultureInfo.InvariantCulture, imgFormatName); 91Assert.Equal(ImageFormat.Bmp, ConvertFromName("Bmp")); 92Assert.Equal(ImageFormat.Emf, ConvertFromName("Emf")); 93Assert.Equal(ImageFormat.Exif, ConvertFromName("Exif")); 94Assert.Equal(ImageFormat.Gif, ConvertFromName("Gif")); 95Assert.Equal(ImageFormat.Tiff, ConvertFromName("Tiff")); 96Assert.Equal(ImageFormat.Png, ConvertFromName("Png")); 97Assert.Equal(ImageFormat.MemoryBmp, ConvertFromName("MemoryBmp")); 98Assert.Equal(ImageFormat.Icon, ConvertFromName("Icon")); 99Assert.Equal(ImageFormat.Jpeg, ConvertFromName("Jpeg")); 100Assert.Equal(ImageFormat.Wmf, ConvertFromName("Wmf")); 102Assert.Equal(ImageFormat.Heif, ConvertFromName("Heif")); 103Assert.Equal(ImageFormat.Webp, ConvertFromName("Webp")); 111ImageFormat imageformat = ConvertFromName($"[ImageFormat: {testGuid}]"); 146Assert.Throws<NotSupportedException>(() => _imgFmtConv.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(ImageFormat))); 151Assert.Throws<NotSupportedException>(() => _imgFmtConvFrmTD.ConvertTo(null, CultureInfo.InvariantCulture, _imageFmt, typeof(ImageFormat))); 181foreach (ImageFormat iformat in values)
System\Drawing\ImageTests.cs (3)
611ImageFormat.Tiff, 626ImageFormat.Jpeg, 641public void GetEncoderParameterList_ReturnsExpected(ImageFormat format, Guid[] expectedParameters)
System\Drawing\Imaging\ImageCodecInfoTests.cs (11)
72private void CheckDecoderAndEncoder(string clsid, ImageFormat format, string CodecName, string DllName, 90private static void CheckImageCodecInfo(ImageFormat format, string CodecName, string DllName, string FilenameExtension, ImageCodecFlags Flags, string FormatDescription, string MimeType, int signatureLength, string mask, string pattern, string pattern2, ImageCodecInfo codecInfo) 122WMF_CSID, ImageFormat.Wmf, 130EMF_CSID, ImageFormat.Emf, 139ICO_CSID, ImageFormat.Icon, 147TIF_CSID, ImageFormat.Tiff, 155PNG_CSID, ImageFormat.Png, 163JPG_JPEG_JPE_JFIF_CSID, ImageFormat.Jpeg, 171GIF_CSID, ImageFormat.Gif, 179BMP_DIB_RLE_CSID, ImageFormat.Bmp, 226public void CheckDecoderAndEncoder_ReturnsExpected(string clsid, ImageFormat format, string codecName, string dllName,
System\Drawing\Imaging\ImageFormatTests.cs (40)
8private static ImageFormat BmpImageFormat { get; } = new(new Guid("b96b3cab-0728-11d3-9d7b-0000f81ef32e")); 9private static ImageFormat EmfImageFormat { get; } = new(new Guid("b96b3cac-0728-11d3-9d7b-0000f81ef32e")); 10private static ImageFormat ExifImageFormat { get; } = new(new Guid("b96b3cb2-0728-11d3-9d7b-0000f81ef32e")); 11private static ImageFormat GifImageFormat { get; } = new(new Guid("b96b3cb0-0728-11d3-9d7b-0000f81ef32e")); 12private static ImageFormat TiffImageFormat { get; } = new(new Guid("b96b3cb1-0728-11d3-9d7b-0000f81ef32e")); 13private static ImageFormat PngImageFormat { get; } = new(new Guid("b96b3caf-0728-11d3-9d7b-0000f81ef32e")); 14private static ImageFormat MemoryBmpImageFormat { get; } = new(new Guid("b96b3caa-0728-11d3-9d7b-0000f81ef32e")); 15private static ImageFormat IconImageFormat { get; } = new(new Guid("b96b3cb5-0728-11d3-9d7b-0000f81ef32e")); 16private static ImageFormat JpegImageFormat { get; } = new(new Guid("b96b3cae-0728-11d3-9d7b-0000f81ef32e")); 17private static ImageFormat WmfImageFormat { get; } = new(new Guid("b96b3cad-0728-11d3-9d7b-0000f81ef32e")); 18private static ImageFormat HeifImageFormat { get; } = new(new Guid("{b96b3cb6-0728-11d3-9d7b-0000f81ef32e}")); 19private static ImageFormat WebpImageFormat { get; } = new(new Guid("{b96b3cb7-0728-11d3-9d7b-0000f81ef32e}")); 20private static ImageFormat CustomImageFormat { get; } = new(new Guid("48749428-316f-496a-ab30-c819a92b3137")); 26yield return new object[] { BmpImageFormat.Guid, ImageFormat.Bmp }; 27yield return new object[] { EmfImageFormat.Guid, ImageFormat.Emf }; 28yield return new object[] { ExifImageFormat.Guid, ImageFormat.Exif }; 29yield return new object[] { GifImageFormat.Guid, ImageFormat.Gif }; 30yield return new object[] { TiffImageFormat.Guid, ImageFormat.Tiff }; 31yield return new object[] { PngImageFormat.Guid, ImageFormat.Png }; 32yield return new object[] { MemoryBmpImageFormat.Guid, ImageFormat.MemoryBmp }; 33yield return new object[] { IconImageFormat.Guid, ImageFormat.Icon }; 34yield return new object[] { JpegImageFormat.Guid, ImageFormat.Jpeg }; 35yield return new object[] { WmfImageFormat.Guid, ImageFormat.Wmf }; 38yield return new object[] { HeifImageFormat.Guid, ImageFormat.Heif }; 39yield return new object[] { WebpImageFormat.Guid, ImageFormat.Webp }; 50yield return new object[] { "Bmp", ImageFormat.Bmp }; 51yield return new object[] { "Emf", ImageFormat.Emf }; 52yield return new object[] { "Exif", ImageFormat.Exif }; 53yield return new object[] { "Gif", ImageFormat.Gif }; 54yield return new object[] { "Tiff", ImageFormat.Tiff }; 55yield return new object[] { "Png", ImageFormat.Png }; 56yield return new object[] { "MemoryBMP", ImageFormat.MemoryBmp }; 57yield return new object[] { "Icon", ImageFormat.Icon }; 58yield return new object[] { "Jpeg", ImageFormat.Jpeg }; 59yield return new object[] { "Wmf", ImageFormat.Wmf }; 62yield return new object[] { "Heif", ImageFormat.Heif }; 63yield return new object[] { "Webp", ImageFormat.Webp }; 94public void Guid_ReturnsExpected(Guid expectedGuid, ImageFormat imageFormat) 101public void ToString_ReturnsExpected(string expected, ImageFormat imageFormat) 116public void Equals_Object_ReturnsExpected(ImageFormat imageFormat, object obj, bool result)
System\Drawing\Printing\PrinterSettingsTests.cs (12)
374yield return new object[] { ImageFormat.Jpeg }; 375yield return new object[] { ImageFormat.Png }; 380public void IsDirectPrintingSupported_ImageFormatSupported_ReturnsExpected(ImageFormat imageFormat) 388yield return new object[] { ImageFormat.Emf }; 389yield return new object[] { ImageFormat.Exif }; 390yield return new object[] { ImageFormat.Gif }; 391yield return new object[] { ImageFormat.Icon }; 392yield return new object[] { ImageFormat.MemoryBmp }; 393yield return new object[] { ImageFormat.Tiff }; 394yield return new object[] { ImageFormat.Wmf }; 395yield return new object[] { ImageFormat.Bmp }; 400public void IsDirectPrintingSupported_ImageFormatNotSupported_ReturnsExpected(ImageFormat imageFormat)
System.Windows.Forms (6)
System\Windows\Forms\Controls\ImageList\ImageList.cs (1)
691if (result.RawFormat.Guid != ImageFormat.Icon.Guid)
System\Windows\Forms\Controls\ImageList\ImageList.ImageCollection.cs (1)
147if (_owner.UseTransparentColor && bitmap.RawFormat.Guid != ImageFormat.Icon.Guid)
System\Windows\Forms\Controls\ListView\ListView.cs (1)
5126BackgroundImage.Save(_backgroundImageFileName, Drawing.Imaging.ImageFormat.Bmp);
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (1)
1316if (image.RawFormat.Guid != ImageFormat.Icon.Guid)
System\Windows\Forms\Controls\ToolStrips\ToolStripItem.cs (2)
1054if (bmp.RawFormat.Guid != ImageFormat.Icon.Guid && !ImageAnimator.CanAnimate(bmp)) 1091if (currentImage.RawFormat.Guid != ImageFormat.Icon.Guid && !ImageAnimator.CanAnimate(currentImage))
System.Windows.Forms.Design (1)
System\Windows\Forms\Design\ImageListImage.cs (1)
44public ImageFormat RawFormat => Image.RawFormat;
System.Windows.Forms.Design.Tests (10)
System\Drawing\Design\BitmapEditorTests.cs (2)
74image.Save(stream, ImageFormat.Bmp); 80result.Save(resultStream, ImageFormat.Bmp);
System\Drawing\Design\ImageEditorTests.cs (2)
131image.Save(stream, ImageFormat.Bmp); 137result.Save(resultStream, ImageFormat.Bmp);
System\Drawing\Design\MetafileEditorTests.cs (1)
58image.Save(stream, ImageFormat.Bmp);
System\Windows\Forms\Design\ImageListImageEditorTests.cs (2)
19image.Save(stream, ImageFormat.Bmp); 28result.Image.Save(resultStream, ImageFormat.Bmp);
System\Windows\Forms\Design\ImageListImageTests.cs (3)
63bitmap.Save(memoryStream, Drawing.Imaging.ImageFormat.Bmp); 71result.Image.RawFormat.Should().Be(expected: Drawing.Imaging.ImageFormat.Bmp); 87result.Image.RawFormat.Should().Be(Drawing.Imaging.ImageFormat.MemoryBmp);
System.Windows.Forms.Tests (1)
System\Windows\Forms\RichTextBoxTests.ClipboardTests.cs (1)
22bitmap.Save(memoryStream, Drawing.Imaging.ImageFormat.Png);
System.Windows.Forms.UI.IntegrationTests (2)
Infra\ScreenRecordService.cs (1)
411frame.Save(stream, ImageFormat.Png);
Infra\ScreenshotService.cs (1)
36bitmap.Save(fullPath, ImageFormat.Png);
WindowsFormsIntegration (3)
System\Windows\Integration\Convert.cs (3)
151SDI.ImageFormat IntermediateFormat = fromImage.RawFormat; 152if (IntermediateFormat.Guid.CompareTo(SDI.ImageFormat.MemoryBmp.Guid) == 0) 154IntermediateFormat = SDI.ImageFormat.Bmp;