Packages

 

com.aspose.cad

Class RasterImage

    • Method Detail

      • getXmpData

        public XmpPacketWrapper getXmpData()

        Gets or sets the XMP metadata.

        Value: The XMP metadata.
      • setXmpData

        public void setXmpData(XmpPacketWrapper value)

        Gets or sets the XMP metadata.

        Value: The XMP metadata.
      • getRawIndexedColorConverter

        public IIndexedColorConverter getRawIndexedColorConverter()

        Gets or sets the indexed color converter

        Value: The indexed color converter
      • setRawIndexedColorConverter

        public void setRawIndexedColorConverter(IIndexedColorConverter value)

        Gets or sets the indexed color converter

        Value: The indexed color converter
      • getRawCustomColorConverter

        public IColorConverter getRawCustomColorConverter()

        Gets or sets the custom color converter

        Value: The custom color converter
      • setRawCustomColorConverter

        public void setRawCustomColorConverter(IColorConverter value)

        Gets or sets the custom color converter

        Value: The custom color converter
      • getRawFallbackIndex

        public int getRawFallbackIndex()

        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 bounds
      • setRawFallbackIndex

        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 bounds
      • getRawDataFormat

        public PixelDataFormat getRawDataFormat()

        Gets the raw data format.

        Value: The raw data format.
      • getRawLineSize

        public int getRawLineSize()

        Gets the raw line size in bytes.

        Value: The raw line size in bytes.
      • isRawDataAvailable

        public boolean isRawDataAvailable()

        Gets a value indicating whether raw data loading is available.

        Value: true if this raw data loading is available; otherwise, false.
        Specified by:
        isRawDataAvailable in interface IRasterImageRawDataLoader
      • getHorizontalResolution

        public double getHorizontalResolution()

        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.

      • setHorizontalResolution

        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.

      • getVerticalResolution

        public double getVerticalResolution()

        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.

      • setVerticalResolution

        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.

      • hasTransparentColor

        public boolean hasTransparentColor()

        Gets a value indicating whether image has transparent color.

      • setTransparentColor

        public void setTransparentColor(boolean value)

        Gets a value indicating whether image has transparent color.

      • hasAlpha

        public boolean hasAlpha()

        Gets a value indicating whether this instance has alpha.

        Value: true if this instance has alpha; otherwise, false.
      • getTransparentColor

        public Color getTransparentColor()

        Gets the image transparent color.

      • setTransparentColor

        public void setTransparentColor(Color value)

        Gets the image transparent color.

      • dither

        public void dither(int ditheringMethod,
                           int bitsCount)

        Performs dithering on the current image.

        Parameters:
        ditheringMethod - The dithering method.
        bitsCount - The final bits count for dithering.
      • dither

        public abstract void dither(int ditheringMethod,
                                    int bitsCount,
                                    IColorPalette customPalette)

        Performs dithering on the current image.

        Parameters:
        ditheringMethod - The dithering method.
        bitsCount - The final bits count for dithering.
        customPalette - The custom palette for dithering.
      • getDefaultPixels

        public void getDefaultPixels(Rectangle rectangle,
                                     IPartialArgb32PixelLoader partialPixelLoader)

        Gets the default pixels array using partial pixel loader.

        Parameters:
        rectangle - The rectangle to get pixels for.
        partialPixelLoader - The partial pixel loader.
      • getDefaultRawData

        public void getDefaultRawData(Rectangle rectangle,
                                      IPartialRawDataLoader partialRawDataLoader,
                                      RawDataSettings rawDataSettings)

        Gets the default raw data array using partial pixel loader.

        Parameters:
        rectangle - The rectangle to get pixels for.
        partialRawDataLoader - The partial raw data loader.
        rawDataSettings - The raw data settings.
      • getDefaultArgb32Pixels

        public int[] getDefaultArgb32Pixels(Rectangle rectangle)

        Gets the default 32-bit ARGB pixels array.

        Parameters:
        rectangle - The rectangle to get pixels for.
        Returns:
        The default pixels array.
      • getDefaultRawData

        public byte[] getDefaultRawData(Rectangle rectangle,
                                        RawDataSettings rawDataSettings)

        Gets the default raw data array.

        Parameters:
        rectangle - The rectangle to get raw data for.
        rawDataSettings - The raw data settings.
        Returns:
        The default raw data array.
      • getArgb32Pixel

        public int getArgb32Pixel(int x,
                                  int y)

        Gets an image 32-bit ARGB pixel.

        Parameters:
        x - The pixel x location.
        y - The pixel y location.
        Returns:
        The 32-bit ARGB pixel for the specified location.
      • getPixel

        public Color getPixel(int x,
                              int y)

        Gets an image pixel.

        Parameters:
        x - The pixel x location.
        y - The pixel y location.
        Returns:
        The pixel color for the specified location.
      • setArgb32Pixel

        public void setArgb32Pixel(int x,
                                   int y,
                                   int argb32Color)

        Sets an image 32-bit ARGB pixel for the specified position.

        Parameters:
        x - The pixel x location.
        y - The pixel y location.
        argb32Color - The 32-bit ARGB pixel for the specified position.
      • setPixel

        public void setPixel(int x,
                             int y,
                             Color color)

        Sets an image pixel for the specified position.

        Parameters:
        x - The pixel x location.
        y - The pixel y location.
        color - The pixel color for the specified position.
      • readScanLine

        public Color[] readScanLine(int scanLineIndex)

        Reads the whole scan line by the specified scan line index.

        Parameters:
        scanLineIndex - Zero based index of the scan line.
        Returns:
        The scan line pixel color values array.
      • writeScanLine

        public void writeScanLine(int scanLineIndex,
                                  Color[] pixels)

        Writes the whole scan line to the specified scan line index.

        Parameters:
        scanLineIndex - Zero based index of the scan line.
        pixels - The pixel colors array to write.
      • loadPartialPixels

        public void loadPartialPixels(Rectangle desiredRectangle,
                                      IPartialPixelLoader pixelLoader)

        Loads pixels partially by packs.

        Parameters:
        desiredRectangle - The desired rectangle.
        pixelLoader - The pixel loader.
      • loadArgb32Pixels

        public int[] loadArgb32Pixels(Rectangle rectangle)

        Loads 32-bit ARGB pixels.

        Parameters:
        rectangle - The rectangle to load pixels from.
        Returns:
        The loaded 32-bit ARGB pixels array.
      • loadPixels

        public Color[] loadPixels(Rectangle rectangle)

        Loads pixels.

        Parameters:
        rectangle - The rectangle to load pixels from.
        Returns:
        The loaded pixels array.
      • loadCmykPixels

        public CmykColor[] loadCmykPixels(Rectangle rectangle)

        Loads pixels in CMYK format.

        Parameters:
        rectangle - The rectangle to load pixels from.
        Returns:
        The loaded CMYK pixels array.
      • saveRawData

        public void saveRawData(byte[] data,
                                int dataOffset,
                                Rectangle rectangle,
                                RawDataSettings rawDataSettings)

        Saves the raw data.

        Parameters:
        data - The raw data.
        dataOffset - The starting raw data offset.
        rectangle - The raw data rectangle.
        rawDataSettings - The raw data settings the data is in.
      • saveArgb32Pixels

        public void saveArgb32Pixels(Rectangle rectangle,
                                     int[] pixels)

        Saves the 32-bit ARGB pixels.

        Parameters:
        rectangle - The rectangle to save pixels to.
        pixels - The 32-bit ARGB pixels array.
      • savePixels

        public void savePixels(Rectangle rectangle,
                               Color[] pixels)

        Saves the pixels.

        Parameters:
        rectangle - The rectangle to save pixels to.
        pixels - The pixels array.
      • saveCmykPixels

        public void saveCmykPixels(Rectangle rectangle,
                                   CmykColor[] pixels)

        Saves the pixels.

        Parameters:
        rectangle - The rectangle to save pixels to.
        pixels - The CMYK pixels array.
      • setResolution

        public void setResolution(double dpiX,
                                  double dpiY)

        Sets the resolution for this RasterImage.

        Parameters:
        dpiX - The horizontal resolution, in dots per inch, of the RasterImage.
        dpiY - The vertical resolution, in dots per inch, of the RasterImage.
      • setPalette

        public void setPalette(IColorPalette palette,
                               boolean updateColors)

        Sets the image palette.

        Specified by:
        setPalette in class Image
        Parameters:
        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.
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           int resizeType)

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           ImageResizeSettings settings)

        Resizes the image with extended options.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
      • crop

        public void crop(Rectangle rectangle)

        Crops the specified rectangle.

        Parameters:
        rectangle - The rectangle.
      • binarizeFixed

        public void binarizeFixed(byte threshold)

        Binarization of an image with predefined threshold

        Parameters:
        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.
      • binarizeOtsu

        public void binarizeOtsu()

        Binarization of an image with Otsu thresholding

      • binarizeBradley

        public void binarizeBradley(double brightnessDifference)

        Binarization of an image using Bradley's adaptive thresholding algorithm using the integral image thresholding

        Parameters:
        brightnessDifference - The brightness difference between pixel and the average of an s x s window of pixels centered around this pixel.
      • grayscale

        public void grayscale()

        Transformation of an image to its grayscale representation

      • adjustBrightness

        public void adjustBrightness(int brightness)

        Adjust of a brightness for image.

        Parameters:
        brightness - Brightness value.
      • adjustContrast

        public void adjustContrast(float contrast)

        Image contrasting

        Parameters:
        contrast - Contrast value (in range [-100; 100])
      • adjustGamma

        public void adjustGamma(float gammaRed,
                                float gammaGreen,
                                float gammaBlue)

        Gamma-correction of an image.

        Parameters:
        gammaRed - Gamma for red channel coefficient
        gammaGreen - Gamma for green channel coefficient
        gammaBlue - Gamma for blue channel coefficient
      • adjustGamma

        public void adjustGamma(float gamma)

        Gamma-correction of an image.

        Parameters:
        gamma - Gamma for red, green and blue channels coefficient
      • crop

        public void crop(int leftShift,
                         int rightShift,
                         int topShift,
                         int bottomShift)

        Crop image with shifts.

        Parameters:
        leftShift - The left shift.
        rightShift - The right shift.
        topShift - The top shift.
        bottomShift - The bottom shift.
      • rotate

        public void rotate(float angle,
                           boolean resizeProportionally,
                           Color backgroundColor)

        Rotate image around the center.

        Parameters:
        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.
        Throws:
        com.aspose.ms.System.NotImplementedException
      • rotate

        public void rotate(float angle)

        Rotate image around the center.

        Parameters:
        angle - The rotate angle in degrees. Positive values will rotate clockwise.
      • filter

        public void filter(Rectangle rectangle,
                           FilterOptionsBase options)

        Filters the specified rectangle.

        Parameters:
        rectangle - The rectangle.
        options - The options.