Class RasterCachedImage
Represents a raster image supporting raster graphics operations. This image caches pixel data when required.
public abstract class RasterCachedImage : RasterImage, IDisposable, IObjectWithBounds, IRasterImageArgb32PixelLoader, IRasterImageRawDataLoader, IHasXmpData, IHasMetadata
- Inheritance
-
RasterCachedImage
- Implements
- Derived
- Inherited Members
Constructors
RasterCachedImage()
Initializes a new instance of the RasterCachedImage class.
protected RasterCachedImage()
RasterCachedImage(IColorPalette)
Initializes a new instance of the RasterCachedImage class.
protected RasterCachedImage(IColorPalette colorPalette)
Parameters
colorPalette
IColorPaletteThe color palette.
Properties
IsCached
Gets a value indicating whether image data is cached currently.
public override bool IsCached { get; }
Property Value
- bool
true
if image data is cached; otherwise,false
.
Methods
AdjustBrightness(int)
Adjust of a brightness for image.
public override void AdjustBrightness(int brightness)
Parameters
brightness
intBrightness value.
AdjustContrast(float)
Image contrasting
public override void AdjustContrast(float contrast)
Parameters
contrast
floatContrast value (in range [-100; 100])
AdjustGamma(float)
Gamma-correction of an image.
public override void AdjustGamma(float gamma)
Parameters
gamma
floatGamma for red, green and blue channels coefficient
AdjustGamma(float, float, float)
Gamma-correction of an image.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameters
gammaRed
floatGamma for red channel coefficient
gammaGreen
floatGamma for green channel coefficient
gammaBlue
floatGamma for blue channel coefficient
BinarizeBradley(double)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
public override void BinarizeBradley(double brightnessDifference)
Parameters
brightnessDifference
doubleThe brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
BinarizeBradley(double, int)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
public override void BinarizeBradley(double brightnessDifference, int windowSize)
Parameters
brightnessDifference
doubleThe brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
windowSize
intThe size of s x s window of pixels centered around this pixel
BinarizeFixed(byte)
Binarization of an image with predefined threshold
public override void BinarizeFixed(byte threshold)
Parameters
threshold
byteThreshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise.
BinarizeOtsu()
Binarization of an image with Otsu thresholding
public override void BinarizeOtsu()
Blend(Point, RasterImage, Rectangle, byte)
Blends this image instance with the overlay
image.
public override void Blend(Point origin, RasterImage overlay, Rectangle overlayArea, byte overlayAlpha = 255)
Parameters
origin
PointThe background image blending origin.
overlay
RasterImageThe overlay image.
overlayArea
RectangleThe overlay area.
overlayAlpha
byteThe overlay alpha.
CacheData()
Caches the data and ensures no additional data loading will be performed from the underlying DataStreamContainer.
public override void CacheData()
Crop(Rectangle)
Cropping the image.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
RectangleThe rectangle.
Dither(DitheringMethod, int, IColorPalette)
Performs dithering on the current image.
public override void Dither(DitheringMethod ditheringMethod, int bitsCount, IColorPalette customPalette)
Parameters
ditheringMethod
DitheringMethodThe dithering method.
bitsCount
intThe final bits count for dithering.
customPalette
IColorPaletteThe custom palette for dithering.
Grayscale()
Transformation of an image to its grayscale representation
public override void Grayscale()
OnCached()
Called when data is cached and all related resources may be de-allocated.
protected virtual void OnCached()
OnPaletteChanged(IColorPalette, IColorPalette)
Called when palette is changed.
protected override void OnPaletteChanged(IColorPalette oldPalette, IColorPalette newPalette)
Parameters
oldPalette
IColorPaletteThe old palette.
newPalette
IColorPaletteThe new palette.
Resize(int, int, ImageResizeSettings)
Resizes the image.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
settings
ImageResizeSettingsThe resize settings.
Resize(int, int, ResizeType)
Resizes the image.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
resizeType
ResizeTypeThe resize type.
Rotate(float, bool, Color)
Rotate image around the center.
public override void Rotate(float angle, bool resizeProportionally, Color backgroundColor)
Parameters
angle
floatThe rotate angle in degrees. Positive values will rotate clockwise.
resizeProportionally
boolif set to
true
you will have your image size changed according to rotated rectangle (corner points) projections in other case that leaves dimensions untouched and only internal image contents are rotated.backgroundColor
ColorColor of the background.
RotateFlip(RotateFlipType)
Rotates, flips, or rotates and flips the image.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipTypeThe rotate flip type.
UpdateDimensions(int, int)
Updates the image dimensions.
protected abstract void UpdateDimensions(int newWidth, int newHeight)