Class ImageContainer
Represents a container for images. It can be used to store multiple images of various sizes and color depths.
public class ImageContainer : ImmutableObject, IBaseObjectWithAttr, IBaseObjectWithId, INotifyPropertyChanged, IImmutableObject, IDisposableObject, IBaseObject, IImageContainer, IDisposable, IComparer<SizeI>
- Inheritance
-
ImageContainer
- Implements
- Derived
- Extension Methods
Constructors
- ImageContainer()
Initializes a new instance of the ImageContainer class.
- ImageContainer(bool)
Initializes a new instance of the ImageContainer class with the specified immutability.
Fields
- DefaultImageSize
Gets or sets the default size of the images in the image container, in pixels.
Properties
- FirstImage
Gets the first image in the container or null if the container is empty. Result is returned as immutable image if the container is immutable.
- HasImageWithSmallSystemIconSize
Gets whether container contains an image with the small system icon size.
- HasImageWithSystemIconSize
Gets whether container contains an image with the system icon size.
- ImageOfSmallSystemIconSize
Gets the first image in the container which has the small system icon size. Result is returned as immutable image if the container is immutable.
- ImageOfSystemIconSize
Gets the first image in the container which has the system icon size. Result is returned as immutable image if the container is immutable.
- ImageWithSmallSystemIconSize
Gets image with size equal to small system icon size.
- ImageWithSystemIconSize
Gets image with size equal to system icon size.
- IsOk
Gets whether object is ok.
- IsReadOnly
Gets whether object is readonly.
- SmallestImage
Gets the smallest image in the container. Result is returned as immutable image if the container is immutable.
Methods
- Add(Image?)
Adds image.
- Add(Stream?)
Adds image from the stream.
- AddFromAssemblyUrl(Assembly, string?)
Adds image from the specified assembly and relative path to the resource.
- AddFromUrl(string?)
Adds image from the specified resource url. See FromUrl(string, BitmapType) for the url format example.
- AddImageStrip(Image, SizeI)
Adds image strip to the image container. The image strip is a single image that contains multiple images concatenated horizontally. This method divides the image strip into individual images based on the
imageSizeparameter and adds them to the container.
- AddResized(Image, SizeI)
Adds the image to the image container, resizing it if necessary. If image size equal to the specified size, it is added without resizing.
- AddSvg(SvgImage, SizeI, Color?)
Adds svg to the image container with the specified color.
- AddSvg(SvgImage, SizeI, bool)
Adds svg to the image container with the default normal color for the specified color theme.
- AddSvg(SvgImage, SizeI, bool?, Color?)
Adds svg to the image container with the specified color or default color for the specified theme. If
isDarkThemeis not null, it is used to determine the svg color. Otherwise, ifcoloris not null, it is used as the svg color. If both parameters are null, the default color of the svg is used.
- AsImage(SizeI)
Gets the image from the container that is the closest in size to the specified size. If there are multiple images of the same size, the first one is returned. If there are no images in the container, an empty Bitmap is returned.
- AsImageStrip(SizeI)
Creates a single image strip by combining all images in the collection horizontally.
- AsSkiaStrip(SizeI, SKSamplingOptions?)
Creates a single horizontal bitmap strip by concatenating all images in the collection.
- Clear()
Removes all images from the container.
- DisposeManaged()
Override to dispose managed resources. Here we dispose all used object references.
- Draw(Graphics, float, float, int)
Draws an image on the specified graphic surface at the location specified by a coordinate pair.
- ExportImagesToFiles(string, IReadOnlyList<string>)
Exports all images in the collection to files at the specified base path, using the provided file names or default names if none are specified.
- GetClosestImage(SizeI)
Gets the image from the container that is the closest to the specified size. If there are multiple images of the same size, the first one is returned. If there are no images in the container, null is returned.
- GetEffectiveImageSize(ImageSizeKind?, SizeI?)
Gets an effective image size for the specified size, taking into account the system settings and overrides.
- GetExactImage(SizeI)
Gets the image from the container that has the specified size, or null if no such image exists.
- GetExactOrClosestImage(SizeI, params ImageSizeFallback[])
Gets the image from the container that has the specified size, or null if no such image exists.
- GetExactOrDownscaleLargerImage(SizeI, bool)
Get the image from the container that has the specified size, or the downscaled closest larger image if no exact match is found.
- GetExactOrScaledImage(SizeI, bool, bool)
Get the image from the container that has the specified size, or the scaled closest image if no exact match is found.
- GetExactOrUpscaleSmallerImage(SizeI, bool)
Get the image from the container that has the specified size, or the upscaled closest smaller image if no exact match is found.
- GetImageAt(int?)
Retrieves an image from the container at the specified index.
- GetImageSizes(bool?)
Enumerates the images in the container, yielding size of each image. Result is optionally ordered by size.
- GetImageWithFallback(ImageSizeFallbackOptions?)
Gets the image from the container that has the specified size using image size fallback options in case an exact match is not found.
- GetMinSize()
Gets the minimal size of the bitmaps in this image container. If there are no bitmaps, returns DefaultImageSize.
- GetNearestLargerImage(SizeI)
Gets the image from the container that is larger than the specified size, or null if no such image exists.
- GetNearestSmallerImage(SizeI)
Gets the image from the container that is smaller than the specified size, or null if no such image exists.
- GetSuggestedSize(float, int)
Gets suggested size of the image for the specified scale factor.
- IsSmallerThan(Image, Image)
Compares two images and returns a value indicating whether the first image is smaller than the second image. This method is used for sorting images by size.
- IsSmallerThan(SizeI, SizeI)
Compares two sizes and returns a value indicating whether the first size is smaller than the second size. This method is used for sorting images by size.
- MakeImmutableIfNeeded(Image?)
Makes image immutable if the container is immutable.
- OnChanged()
Called when Changed event is raised.
- OnImageInserted(object?, int, Image)
Called when image is inserted in the container.
- OnImageRemoved(object?, int, Image)
Called when image is removed from the container.
- RaiseChanged()
Raises Changed event and OnChanged() method.
- RemoveAt(int)
Removes image from the container.
Events
- Changed
Occurs when object is changed (image is added or removed).