KGySoft.Drawing Namespace

KGy SOFT Drawing Libraries Help
The KGySoft.Drawing namespace contains extension methods and types built around the types of the System.Drawing namespace. Among others, provides advanced support for the Icon type such as extracting, combining and converting multi-resolution icons, including hi-resolution ones, supports saving several Image formats, including formats without built-in encoders (eg. icons and Metafiles), provides methods for pixel format conversion, quantizing, dithering, etc.
See the Remarks section for details.
Classes

  ClassDescription
Public classBitmapExtensions
Provides extension methods for the Bitmap type.
Public classCursorHandle
Represents a windows cursor that supports colors and partial transparency. The CursorHandle instance can be passed to the System.Windows.Forms.Cursor constructor to create a new cursor.
See the Remarks section for details.
Public classDrawingCoreModule
Represents the KGySoft.Drawing.Core module.
See the Remarks section of the Initialize method for details.
Public classDrawingModule
Represents the KGySoft.Drawing module.
See the Remarks section of the Initialize method for details.
Public classGraphicsExtensions
Contains extension methods for the Graphics type.
Public classIconExtensions
Provides extension methods for the Icon type.
Public classIconInfo
Provides information about an Icon image.
Public classIcons
Provides some icon-related methods as well as properties returning general icons in multi resolution. Unlike SystemIcons, these icons should be disposed when not used any more.
Public classImageExtensions
Provides extension methods for the Image type.
Public classMetafileExtensions
Contains extension methods for the Metafile type.
Public classPixelFormatExtensions
Contains extension methods for the PixelFormat type.
Enumerations

  EnumerationDescription
Public enumerationColorChannels
Represents the RGB color channels when manipulating images.
Public enumerationDrawingOperation
Represents various drawing operations to indicate the current operation when reporting progress using an IAsyncProgress implementation. This library always uses the DrawingOperation type as a type argument when calling the New<T>(T, int, int) method.
Public enumerationScalingMode
Represents the scaling mode when an image needs to be resized.
Public enumerationStockIcon
Represents the Windows stock icons can be retrieved by the Icons.GetStockIcon method in Windows Vista and above.
See also the SHSTOCKICONID Enumeration at the Microsoft Docs site.
Public enumerationSystemIconSize
Represents the predefined system icon sizes.
Remarks

Note Note
Starting with version 7.0.0 the KGySoft.Drawing libraries have been split into multiple packages. If a type is not found at compile time you can check this documentation where the Assembly indicates the name of the assembly (and the NuGet package) in which the type is located.
KGySoft.Drawing.Core
This package contains the technology and platform independent core functionality and covers most of the types in the KGySoft.Drawing.Imaging namespace along with a few ones in the KGySoft.Drawing namespace. The other packages are dependent on this one.
KGySoft.Drawing
Most types of the KGySoft.Drawing namespace are located in this package. It provides support for many GDI+ types such as Bitmap, Metafile, Icon, Graphics and is dependent on the System.Drawing.Common package, which is supported only on Windows when targeting .NET 7 or later. This package has only one single public class in the KGySoft.Drawing.Imaging namespace, ReadableBitmapDataExtensions, which contains the extension methods that had to be removed from the BitmapDataExtensions class because they use the Bitmap type. Additionally, it defines also a single type converter in the KGySoft.ComponentModel namespace.
KGySoft.Drawing.Wpf
This package provides dedicated support for the System.Windows.Media.Imaging.WriteableBitmap and System.Windows.Media.Imaging.BitmapSource types. Use the WriteableBitmapExtensions.GetReadWriteBitmapData extension method to expose the underlying buffer of a WriteableBitmap of any pixel format as an IReadWriteBitmapData to be able to use all of the core operations and transformations for a bitmap data.
KGySoft.Drawing.WinUI
Similarly to the WPF package, this one provides support for the Microsoft.UI.Xaml.Media.Imaging.WriteableBitmap, which is used by Windows App SDK in WinUI applications. It also has a GetReadWriteBitmapData extension method to obtain an IReadWriteBitmapData instance for the bitmap. This package requires targeting at least .NET 5 and Windows 10.0.17763.0 (October 2018 release, version 1809).
KGySoft.Drawing.Uwp
Just like the WinUI package, this one provides support for the Windows.UI.Xaml.Media.Imaging.WriteableBitmap used by the Universal Windows Platform (UWP) platform. Its documentation is not compiled to this combined documentation due to technical reasons but it provides exactly the same functionality as the WinUI package. This package requires targeting at least Windows 10.0.16299.0 (Fall Creators Update, version 1709) so it can reference the .NET Standard 2.0 version of the KGySoft.Drawing.Core library.