public abstract class RasterImage extends Image implements IRasterImageArgb32PixelLoader, com.aspose.imaging_internal.IPixelsSaver
Represents a raster image supporting raster graphics operations.
Modifier and Type | Method and Description |
---|---|
void |
adjustBrightness(int brightness)
Adjust of a brightness for image.
|
void |
adjustContrast(float contrast)
Image contrasting
|
void |
adjustGamma(float gamma)
Gamma-correction of an image.
|
void |
adjustGamma(float gammaRed,
float gammaGreen,
float gammaBlue)
Gamma-correction of an image.
|
void |
binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
|
void |
binarizeBradley(double brightnessDifference,
int windowSize)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
|
void |
binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
|
void |
binarizeOtsu()
Binarization of an image with Otsu thresholding
|
void |
crop(int leftShift,
int rightShift,
int topShift,
int bottomShift)
Crop image with shifts.
|
void |
crop(Rectangle rectangle)
Crops the specified rectangle.
|
void |
dither(int ditheringMethod,
int bitsCount)
Performs dithering on the current image.
|
abstract void |
dither(int ditheringMethod,
int bitsCount,
IColorPalette customPalette)
Performs dithering on the current image.
|
void |
filter(Rectangle rectangle,
FilterOptionsBase options)
Filters the specified rectangle.
|
int |
getArgb32Pixel(int x,
int y)
Gets an image 32-bit ARGB pixel.
|
int[] |
getDefaultArgb32Pixels(Rectangle rectangle)
Gets the default 32-bit ARGB pixels array.
|
void |
getDefaultPixels(Rectangle rectangle,
IPartialArgb32PixelLoader partialPixelLoader)
Gets the default pixels array using partial pixel loader.
|
void |
getDefaultRawData(Rectangle rectangle,
IPartialRawDataLoader partialRawDataLoader,
RawDataSettings rawDataSettings)
Gets the default raw data array using partial pixel loader.
|
byte[] |
getDefaultRawData(Rectangle rectangle,
RawDataSettings rawDataSettings)
Gets the default raw data array.
|
double |
getHorizontalResolution()
Gets or sets the horizontal resolution, in pixels per inch, of this
RasterImage . |
float |
getImageOpacity()
Gets opacity of this image.
|
Date |
getModifyDate(boolean useDefault)
Gets the date and time the resource image was last modified.
|
Color |
getPixel(int x,
int y)
Gets an image pixel.
|
boolean |
getPremultiplyComponents()
Gets or sets a value indicating whether the image components must be premultiplied.
|
IColorConverter |
getRawCustomColorConverter()
Gets or sets the custom color converter
|
PixelDataFormat |
getRawDataFormat()
Gets the raw data format.
|
RawDataSettings |
getRawDataSettings()
Gets the current raw data settings.
|
int |
getRawFallbackIndex()
Gets or sets the fallback index to use when palette index is out of bounds
|
IIndexedColorConverter |
getRawIndexedColorConverter()
Gets or sets the indexed color converter
|
int |
getRawLineSize()
Gets the raw line size in bytes.
|
Color |
getTransparentColor()
Gets the image transparent color.
|
boolean |
getUpdateXmpData()
Gets or sets a value indicating whether to update the XMP metadata.
|
boolean |
getUseRawData()
Gets or sets a value indicating whether to use raw data loading when the raw data loading is available.
|
double |
getVerticalResolution()
Gets or sets the vertical resolution, in pixels per inch, of this
RasterImage . |
XmpPacketWrapper |
getXmpData()
Gets or sets the XMP metadata.
|
void |
grayscale()
Transformation of an image to its grayscale representation
|
boolean |
hasAlpha()
Gets a value indicating whether this instance has alpha.
|
boolean |
hasTransparentColor()
Gets a value indicating whether image has transparent color.
|
boolean |
isRawDataAvailable()
Gets a value indicating whether raw data loading is available.
|
int[] |
loadArgb32Pixels(Rectangle rectangle)
Loads 32-bit ARGB pixels.
|
long[] |
loadArgb64Pixels(Rectangle rectangle)
Loads 64-bit ARGB pixels.
|
int[] |
loadCmyk32Pixels(Rectangle rectangle)
Loads pixels in CMYK format.
|
CmykColor[] |
loadCmykPixels(Rectangle rectangle)
Deprecated.
use instead loadCmyk32Pixels(Rectangle)
|
void |
loadPartialArgb32Pixels(Rectangle desiredRectangle,
IPartialArgb32PixelLoader pixelLoader)
Loads 32-bit ARGB pixels partially by packs.
|
void |
loadPartialPixels(Rectangle desiredRectangle,
IPartialPixelLoader pixelLoader)
Loads pixels partially by packs.
|
Color[] |
loadPixels(Rectangle rectangle)
Loads pixels.
|
void |
loadRawData(Rectangle rectangle,
RawDataSettings rawDataSettings,
IPartialRawDataLoader rawDataLoader)
Loads raw data.
|
void |
loadRawData(Rectangle rectangle,
Rectangle destImageBounds,
RawDataSettings rawDataSettings,
IPartialRawDataLoader rawDataLoader)
Loads raw data.
|
int[] |
readArgb32ScanLine(int scanLineIndex)
Reads the whole scan line by the specified scan line index.
|
Color[] |
readScanLine(int scanLineIndex)
Reads the whole scan line by the specified scan line index.
|
void |
replaceColor(Color oldColor,
byte oldColorDiff,
Color newColor)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
|
void |
replaceColor(int oldColorArgb,
byte oldColorDiff,
int newColorArgb)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
|
void |
replaceNonTransparentColors(Color newColor)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
|
void |
replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges.
|
void |
resize(int newWidth,
int newHeight,
ImageResizeSettings settings)
Resizes the image with extended options.
|
void |
resize(int newWidth,
int newHeight,
int resizeType)
Resizes the image.
|
void |
rotate(float angle)
Rotate image around the center.
|
void |
rotate(float angle,
boolean resizeProportionally,
Color backgroundColor)
Rotate image around the center.
|
void |
saveArgb32Pixels(Rectangle rectangle,
int[] pixels)
Saves the 32-bit ARGB pixels.
|
void |
saveCmyk32Pixels(Rectangle rectangle,
int[] pixels)
Saves the pixels.
|
void |
saveCmykPixels(Rectangle rectangle,
CmykColor[] pixels)
Deprecated.
use instead saveCmyk32Pixels(Rectangle, int[])
|
void |
savePixels(Rectangle rectangle,
Color[] pixels)
Saves the pixels.
|
void |
saveRawData(byte[] data,
int dataOffset,
Rectangle rectangle,
RawDataSettings rawDataSettings)
Saves the raw data.
|
void |
setArgb32Pixel(int x,
int y,
int argb32Color)
Sets an image 32-bit ARGB pixel for the specified position.
|
void |
setHorizontalResolution(double value)
Gets or sets the horizontal resolution, in pixels per inch, of this
RasterImage . |
void |
setPalette(IColorPalette palette,
boolean updateColors)
Sets the image palette.
|
void |
setPixel(int x,
int y,
Color color)
Sets an image pixel for the specified position.
|
void |
setPremultiplyComponents(boolean value)
Gets or sets a value indicating whether the image components must be premultiplied.
|
void |
setRawCustomColorConverter(IColorConverter value)
Gets or sets the custom color converter
|
void |
setRawFallbackIndex(int value)
Gets or sets the fallback index to use when palette index is out of bounds
|
void |
setRawIndexedColorConverter(IIndexedColorConverter value)
Gets or sets the indexed color converter
|
void |
setResolution(double dpiX,
double dpiY)
Sets the resolution for this
RasterImage . |
void |
setTransparentColor(boolean value)
Gets a value indicating whether image has transparent color.
|
void |
setTransparentColor(Color value)
Gets the image transparent color.
|
void |
setUpdateXmpData(boolean value)
Gets or sets a value indicating whether to update the XMP metadata.
|
void |
setUseRawData(boolean value)
Gets or sets a value indicating whether to use raw data loading when the raw data loading is available.
|
void |
setVerticalResolution(double value)
Gets or sets the vertical resolution, in pixels per inch, of this
RasterImage . |
void |
setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata.
|
BufferedImage |
toBitmap()
Converts raster image to the bitmap.
|
void |
writeArgb32ScanLine(int scanLineIndex,
int[] argb32Pixels)
Writes the whole scan line to the specified scan line index.
|
void |
writeScanLine(int scanLineIndex,
Color[] pixels)
Writes the whole scan line to the specified scan line index.
|
canLoad, canLoad, canLoad, canLoad, canSave, create, getBackgroundColor, getBitsPerPixel, getBounds, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getHeight, getInterruptMonitor, getOriginalOptions, getPalette, getProportionalHeight, getProportionalWidth, getSize, getWidth, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, rotateFlip, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setInterruptMonitor, setPalette
cacheData, getDataStreamContainer, isCached, save, save, save, save
close, dispose, getDisposed
public boolean getPremultiplyComponents()
Gets or sets a value indicating whether the image components must be premultiplied.
true
if the image components must be premultiplied; otherwise, false
.public void setPremultiplyComponents(boolean value)
Gets or sets a value indicating whether the image components must be premultiplied.
value
- true
if the image components must be premultiplied; otherwise, false
.public boolean getUseRawData()
Gets or sets a value indicating whether to use raw data loading when the raw data loading is available.
true
if use raw data loading when the raw data loading is available.; otherwise, false
.public void setUseRawData(boolean value)
Gets or sets a value indicating whether to use raw data loading when the raw data loading is available.
value
- true
if use raw data loading when the raw data loading is available.; otherwise, false
.public boolean getUpdateXmpData()
Gets or sets a value indicating whether to update the XMP metadata.
true
if update the XMP metadata; otherwise, false
.public void setUpdateXmpData(boolean value)
Gets or sets a value indicating whether to update the XMP metadata.
value
- true
if update the XMP metadata; otherwise, false
.public XmpPacketWrapper getXmpData()
Gets or sets the XMP metadata.
public void setXmpData(XmpPacketWrapper value)
Gets or sets the XMP metadata.
value
- The XMP metadata.public IIndexedColorConverter getRawIndexedColorConverter()
Gets or sets the indexed color converter
public void setRawIndexedColorConverter(IIndexedColorConverter value)
Gets or sets the indexed color converter
value
- The indexed color converterpublic IColorConverter getRawCustomColorConverter()
Gets or sets the custom color converter
public void setRawCustomColorConverter(IColorConverter value)
Gets or sets the custom color converter
value
- The custom color converterpublic int getRawFallbackIndex()
Gets or sets the fallback index to use when palette index is out of bounds
public void setRawFallbackIndex(int value)
Gets or sets the fallback index to use when palette index is out of bounds
value
- The fallback index to use when palette index is out of boundspublic RawDataSettings getRawDataSettings()
IRasterImageRawDataLoader
Gets the current raw data settings. Note when using these settings the data loads without conversion.
getRawDataSettings
in interface IRasterImageRawDataLoader
public PixelDataFormat getRawDataFormat()
Gets the raw data format.
public int getRawLineSize()
Gets the raw line size in bytes.
public boolean isRawDataAvailable()
Gets a value indicating whether raw data loading is available.
isRawDataAvailable
in interface IRasterImageRawDataLoader
true
if this raw data loading is available; otherwise, false
.public double getHorizontalResolution()
Gets or sets the horizontal resolution, in pixels per inch, of this RasterImage
.
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public void setHorizontalResolution(double value)
Gets or sets the horizontal resolution, in pixels per inch, of this RasterImage
.
value
- The horizontal resolution.
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public double getVerticalResolution()
Gets or sets the vertical resolution, in pixels per inch, of this RasterImage
.
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public void setVerticalResolution(double value)
Gets or sets the vertical resolution, in pixels per inch, of this RasterImage
.
value
- The vertical resolution.
Note by default this value is always 96 since different platforms cannot return the screen resolution. You may consider using the SetResolution method for updating both resolution values in single call.
public boolean hasTransparentColor()
Gets a value indicating whether image has transparent color.
public void setTransparentColor(boolean value)
Gets a value indicating whether image has transparent color.
public boolean hasAlpha()
Gets a value indicating whether this instance has alpha.
true
if this instance has alpha; otherwise, false
.public Color getTransparentColor()
Gets the image transparent color.
public void setTransparentColor(Color value)
Gets the image transparent color.
public float getImageOpacity()
Gets opacity of this image.
public Date getModifyDate(boolean useDefault)
Gets the date and time the resource image was last modified.
useDefault
- if set to true
uses the information from FileInfo as default value.public void dither(int ditheringMethod, int bitsCount)
Performs dithering on the current image.
ditheringMethod
- The dithering method.bitsCount
- The final bits count for dithering.public abstract void dither(int ditheringMethod, int bitsCount, IColorPalette customPalette)
Performs dithering on the current image.
ditheringMethod
- The dithering method.bitsCount
- The final bits count for dithering.customPalette
- The custom palette for dithering.public void getDefaultPixels(Rectangle rectangle, IPartialArgb32PixelLoader partialPixelLoader)
Gets the default pixels array using partial pixel loader.
rectangle
- The rectangle to get pixels for.partialPixelLoader
- The partial pixel loader.public void getDefaultRawData(Rectangle rectangle, IPartialRawDataLoader partialRawDataLoader, RawDataSettings rawDataSettings)
Gets the default raw data array using partial pixel loader.
rectangle
- The rectangle to get pixels for.partialRawDataLoader
- The partial raw data loader.rawDataSettings
- The raw data settings.public int[] getDefaultArgb32Pixels(Rectangle rectangle)
Gets the default 32-bit ARGB pixels array.
rectangle
- The rectangle to get pixels for.public byte[] getDefaultRawData(Rectangle rectangle, RawDataSettings rawDataSettings)
Gets the default raw data array.
rectangle
- The rectangle to get raw data for.rawDataSettings
- The raw data settings.public int getArgb32Pixel(int x, int y)
Gets an image 32-bit ARGB pixel.
x
- The pixel x location.y
- The pixel y location.public Color getPixel(int x, int y)
Gets an image pixel.
x
- The pixel x location.y
- The pixel y location.public void setArgb32Pixel(int x, int y, int argb32Color)
Sets an image 32-bit ARGB pixel for the specified position.
x
- The pixel x location.y
- The pixel y location.argb32Color
- The 32-bit ARGB pixel for the specified position.public void setPixel(int x, int y, Color color)
Sets an image pixel for the specified position.
x
- The pixel x location.y
- The pixel y location.color
- The pixel color for the specified position.public Color[] readScanLine(int scanLineIndex)
Reads the whole scan line by the specified scan line index.
scanLineIndex
- Zero based index of the scan line.public int[] readArgb32ScanLine(int scanLineIndex)
Reads the whole scan line by the specified scan line index.
scanLineIndex
- Zero based index of the scan line.public void writeScanLine(int scanLineIndex, Color[] pixels)
Writes the whole scan line to the specified scan line index.
scanLineIndex
- Zero based index of the scan line.pixels
- The pixel colors array to write.public void writeArgb32ScanLine(int scanLineIndex, int[] argb32Pixels)
Writes the whole scan line to the specified scan line index.
scanLineIndex
- Zero based index of the scan line.argb32Pixels
- The 32-bit ARGB colors array to write.public void loadPartialArgb32Pixels(Rectangle desiredRectangle, IPartialArgb32PixelLoader pixelLoader)
Loads 32-bit ARGB pixels partially by packs.
loadPartialArgb32Pixels
in interface IRasterImageArgb32PixelLoader
desiredRectangle
- The desired rectangle.pixelLoader
- The 32-bit ARGB pixel loader.public void loadPartialPixels(Rectangle desiredRectangle, IPartialPixelLoader pixelLoader)
Loads pixels partially by packs.
desiredRectangle
- The desired rectangle.pixelLoader
- The pixel loader.public int[] loadArgb32Pixels(Rectangle rectangle)
Loads 32-bit ARGB pixels.
rectangle
- The rectangle to load pixels from.public long[] loadArgb64Pixels(Rectangle rectangle)
Loads 64-bit ARGB pixels.
rectangle
- The rectangle to load pixels from.public Color[] loadPixels(Rectangle rectangle)
Loads pixels.
rectangle
- The rectangle to load pixels from.@Deprecated public CmykColor[] loadCmykPixels(Rectangle rectangle)
Loads pixels in CMYK format.
This method is deprecated. Please use more effective the loadCmyk32Pixels(Rectangle)
method.
rectangle
- The rectangle to load pixels from.public int[] loadCmyk32Pixels(Rectangle rectangle)
Loads pixels in CMYK format.
rectangle
- The rectangle to load pixels from.public void loadRawData(Rectangle rectangle, RawDataSettings rawDataSettings, IPartialRawDataLoader rawDataLoader)
IRasterImageRawDataLoader
Loads raw data.
loadRawData
in interface IRasterImageRawDataLoader
rectangle
- The rectangle to load raw data from.rawDataSettings
- The raw data settings to use for loaded data. Note if data is not in the format specified then data conversion will be performed.rawDataLoader
- The raw data loader.public void loadRawData(Rectangle rectangle, Rectangle destImageBounds, RawDataSettings rawDataSettings, IPartialRawDataLoader rawDataLoader)
Loads raw data.
rectangle
- The rectangle to load raw data from.destImageBounds
- The dest image bounds.rawDataSettings
- The raw data settings to use for loaded data. Note if data is not in the format specified then data conversion will be performed.rawDataLoader
- The raw data loader.public void saveRawData(byte[] data, int dataOffset, Rectangle rectangle, RawDataSettings rawDataSettings)
Saves the raw data.
data
- The raw data.dataOffset
- The starting raw data offset.rectangle
- The raw data rectangle.rawDataSettings
- The raw data settings the data is in.public void saveArgb32Pixels(Rectangle rectangle, int[] pixels)
Saves the 32-bit ARGB pixels.
saveArgb32Pixels
in interface com.aspose.imaging_internal.IPixelsSaver
rectangle
- The rectangle to save pixels to.pixels
- The 32-bit ARGB pixels array.public void savePixels(Rectangle rectangle, Color[] pixels)
Saves the pixels.
rectangle
- The rectangle to save pixels to.pixels
- The pixels array.public BufferedImage toBitmap()
Converts raster image to the bitmap.
@Deprecated public void saveCmykPixels(Rectangle rectangle, CmykColor[] pixels)
Saves the pixels.
This method is deprecated. Please use more effective the saveCmyk32Pixels(Rectangle, int[])
method.
rectangle
- The rectangle to save pixels to.pixels
- The CMYK pixels array.public void saveCmyk32Pixels(Rectangle rectangle, int[] pixels)
Saves the pixels.
rectangle
- The rectangle to save pixels to.pixels
- The CMYK pixels presented as the 32-bit integer values.public void setResolution(double dpiX, double dpiY)
Sets the resolution for this RasterImage
.
dpiX
- The horizontal resolution, in dots per inch, of the RasterImage
.dpiY
- The vertical resolution, in dots per inch, of the RasterImage
.public void setPalette(IColorPalette palette, boolean updateColors)
Sets the image palette.
setPalette
in class Image
palette
- The palette to set.updateColors
- if set to true
colors will be updated according to the new palette; otherwise color indexes remain unchanged. Note that unchanged indexes may crash the image on loading if some indexes have no corresponding palette entries.public void resize(int newWidth, int newHeight, int resizeType)
Resizes the image.
public void resize(int newWidth, int newHeight, ImageResizeSettings settings)
Resizes the image with extended options.
public void crop(Rectangle rectangle)
Crops the specified rectangle.
rectangle
- The rectangle.public void binarizeFixed(byte threshold)
Binarization of an image with predefined threshold
threshold
- Threshold value. If corresponding gray value of a pixel is greater than threshold, a value of 255 will be assigned to it, 0 otherwise.public void binarizeOtsu()
Binarization of an image with Otsu thresholding
public void binarizeBradley(double brightnessDifference)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
brightnessDifference
- The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.public void binarizeBradley(double brightnessDifference, int windowSize)
Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding
brightnessDifference
- The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.windowSize
- The size of s x s window of pixels centered around this pixelpublic void grayscale()
Transformation of an image to its grayscale representation
public void adjustBrightness(int brightness)
Adjust of a brightness for image.
brightness
- Brightness value.public void adjustContrast(float contrast)
Image contrasting
contrast
- Contrast value (in range [-100; 100])public void adjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Gamma-correction of an image.
gammaRed
- Gamma for red channel coefficientgammaGreen
- Gamma for green channel coefficientgammaBlue
- Gamma for blue channel coefficientpublic void adjustGamma(float gamma)
Gamma-correction of an image.
gamma
- Gamma for red, green and blue channels coefficientpublic void crop(int leftShift, int rightShift, int topShift, int bottomShift)
Crop image with shifts.
leftShift
- The left shift.rightShift
- The right shift.topShift
- The top shift.bottomShift
- The bottom shift.public void rotate(float angle, boolean resizeProportionally, Color backgroundColor)
Rotate image around the center.
angle
- The rotate angle in degrees. Positive values will rotate clockwise.resizeProportionally
- if 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
- Color of the background.com.aspose.ms.System.NotImplementedException
public void rotate(float angle)
Rotate image around the center.
angle
- The rotate angle in degrees. Positive values will rotate clockwise.public void filter(Rectangle rectangle, FilterOptionsBase options)
Filters the specified rectangle.
rectangle
- The rectangle.options
- The options.public void replaceColor(Color oldColor, byte oldColorDiff, Color newColor)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
oldColor
- Old color to be replaced.oldColorDiff
- Allowed difference in old color to be able to widen replaced color tone.newColor
- New color to replace old color with.public void replaceColor(int oldColorArgb, byte oldColorDiff, int newColorArgb)
Replaces one color to another with allowed difference and preserves original alpha value to save smooth edges.
oldColorArgb
- Old color ARGB value to be replaced.oldColorDiff
- Allowed difference in old color to be able to widen replaced color tone.newColorArgb
- New color ARGB value to replace old color with.public void replaceNonTransparentColors(Color newColor)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
newColor
- New color to replace non transparent colors with.public void replaceNonTransparentColors(int newColorArgb)
Replaces all non-transparent colors with new color and preserves original alpha value to save smooth edges. Note: if you use it on images without transparency, all colors will be replaced with a single one.
newColorArgb
- New color ARGB value to replace non transparent colors with.Copyright (c) 2008-2018 Aspose Pty Ltd. All Rights Reserved.