com.aspose.imaging
Class RasterImage

java.lang.Object
  extended by com.aspose.imaging.DisposableObject
      extended by com.aspose.imaging.DataStreamSupporter
          extended by com.aspose.imaging.Image
              extended by com.aspose.imaging.RasterImage
All Implemented Interfaces:
IObjectWithBounds
Direct Known Subclasses:
BmpImage, GifFrameBlock, GifImage, JpegImage, PngImage, PsdImage, TiffImage

public abstract class RasterImage
extends Image

Represents a raster image supporting raster graphics operations.


Constructor Summary
protected RasterImage()
           Initializes a new instance of the RasterImage class.
protected RasterImage(IColorPalette colorPalette, boolean useCompactPalette)
           Initializes a new instance of the RasterImage class.
 
Method Summary
 double getHorizontalResolution()
           Gets the horizontal resolution, in pixels per inch, of this RasterImage.
 Color getPixel(int x, int y)
           Gets an image pixel.
 double getVerticalResolution()
           Gets the vertical resolution, in pixels per inch, of this RasterImage.
 Color[] loadPixels(Rectangle rectangle)
           Loads pixels.
protected abstract  Color[] loadPixelsInternal(Rectangle rectangle)
           Loads pixels (format specific method).
 Color[] readScanLine(int scanLineIndex)
           Reads the whole scan line by the specified scan line index.
protected  void releaseManagedResources()
           Releases the managed resources.
 void resize(int newWidth, int newHeight, int resizeType)
           Resizes the image.
protected  void rotateFlip(Color[] rotatedPixels, int newWidth, int newHeight)
           Performs (completes) rotate, flip or both rotate and flip operation.
 void rotateFlip(int rotateFlipType)
           Rotates, flips, or rotates and flips the image.
 void savePixels(Rectangle rectangle, Color[] pixels)
           Saves the pixels.
protected abstract  void savePixelsInternal(Rectangle rectangle, Color[] pixels)
           Saves pixels (format specific method).
 void setHorizontalResolution(double value)
           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 setResolution(double dpiX, double dpiY)
           Sets the resolution for this RasterImage.
 void setVerticalResolution(double value)
           Sets the vertical resolution, in pixels per inch, of this RasterImage.
 void writeScanLine(int scanLineIndex, Color[] pixels)
           Writes the whole scan line to the specified scan line index.
 
Methods inherited from class com.aspose.imaging.Image
canLoad, canLoad, canLoad, canLoad, canSave, create, getBitsPerPixel, getBounds, getContainer, getFileFormat, getFileFormat, getFitRectangle, getFitRectangle, getFittingRectangle, getFittingRectangle, getHeight, getImageLoaderDescriptorName, getPalette, getSize, getUseCompactPalette, getWidth, load, load, onCompactPaletteUsageChanged, onPaletteChanged, onPaletteChanging, resize, save, save, save, setContainer, setPalette, setUseCompactPalette
 
Methods inherited from class com.aspose.imaging.DataStreamSupporter
flush, getDataStreamContainer, onDataStreamContainerChanging, save, save, setDataStreamContainer
 
Methods inherited from class com.aspose.imaging.DisposableObject
dispose, getDisposed, releaseUnmanagedResources, verifyNotDisposed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RasterImage

protected RasterImage()

Initializes a new instance of the RasterImage class.


RasterImage

protected RasterImage(IColorPalette colorPalette,
                      boolean useCompactPalette)

Initializes a new instance of the RasterImage class.

Parameters:
colorPalette - The color palette.
useCompactPalette - if set to true compact palette is used.
Method Detail

getHorizontalResolution

public double getHorizontalResolution()

Gets 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.


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.

getVerticalResolution

public double getVerticalResolution()

Gets 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.


loadPixels

public Color[] loadPixels(Rectangle rectangle)

Loads pixels.

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

loadPixelsInternal

protected abstract Color[] loadPixelsInternal(Rectangle rectangle)

Loads pixels (format specific method).

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

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.

releaseManagedResources

protected void releaseManagedResources()

Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.

Overrides:
releaseManagedResources in class DataStreamSupporter

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.

rotateFlip

protected void rotateFlip(Color[] rotatedPixels,
                          int newWidth,
                          int newHeight)

Performs (completes) rotate, flip or both rotate and flip operation. This method is called to update the data stream.

Parameters:
rotatedPixels - The already rotated pixels.
newWidth - The new estimated width.
newHeight - The new estimated height.

rotateFlip

public void rotateFlip(int rotateFlipType)

Rotates, flips, or rotates and flips the image.

Specified by:
rotateFlip in class Image
Parameters:
rotateFlipType - The rotate flip type.

savePixels

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

Saves the pixels.

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

savePixelsInternal

protected abstract void savePixelsInternal(Rectangle rectangle,
                                           Color[] pixels)

Saves pixels (format specific method).

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

setHorizontalResolution

public void setHorizontalResolution(double value)

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.


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.

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.

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.

setVerticalResolution

public void setVerticalResolution(double value)

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.


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.