oracle.panama.imagex
Class ImageX

java.lang.Object
  |
  +--oracle.panama.imagex.ImageX

public class ImageX
extends java.lang.Object

This class provides some simple image format transformation functionality for formats supported by mobile devices, such as GIF, BMP and WBMP. Spatial Services such as routing and mapping return map image URLs. Unfortunately, the type of image format can not generally be influenced but depends on the particular mapping server. This API offers the functionality to transform an image at a given source URL to an image at given target URL. The user of this class has to provide a URL that can be written to. Furthermore, he has to organize garbage collection of images that are not needed any more. For the original image URL returned by the mapping server, this is not necessary.


Constructor Summary
ImageX()
           
 
Method Summary
TypeMethod
static void convertFormat(java.lang.String sourceURL, java.io.OutputStream targetStream, ImageFormats targetFormat, double scaleX, double scaleY)
          This function transforms an image from one image format to another.
static void convertFormat(java.lang.String sourceURL, java.io.OutputStream targetStream, ImageFormats targetFormat, int maxSizeX, int maxSizeY)
          This function transforms an image from one image format to another.
static void convertFormat(java.lang.String sourceURL, java.lang.String targetFile, ImageFormats targetFormat)
          This function transforms an image from one image format to another.
static void convertFormat(java.lang.String sourceURL, java.lang.String targetFile, ImageFormats targetFormat, double scaleX, double scaleY)
          This function transforms an image from one image format to another.
static void flipAntiDiagonal(java.lang.String sourceURL, java.lang.String targetFile)
          This function flips the original image antidiagonally and writes the result as a BMP image into the target URL.
static void flipDiagonal(java.lang.String sourceURL, java.lang.String targetFile)
          This function flips the original image diagonally and writes the result as a BMP image into the target URL.
static void flipHorizontal(java.lang.String sourceURL, java.lang.String targetFile)
          This function flips the original image horizontally and writes the result as a BMP image into the target URL.
static void flipVertical(java.lang.String sourceURL, java.lang.String targetFile)
          This function flips the original image vertically and writes the result as a BMP image into the target URL.
static java.lang.String getConvertedImageURL(java.lang.String sourceURL, java.lang.String transformationJSP, ImageFormats targetFormat, double scaleX, double scaleY)
          This function transforms an image from one image format to another.
static java.lang.String getConvertedImageURL(java.lang.String sourceURL, java.lang.String transformationJSP, ImageFormats targetFormat, int maxSizeX, int maxSizeY)
          This function transforms an image from one image format to another.
static void main(java.lang.String[] args)
           
static void rotate180(java.lang.String sourceURL, java.lang.String targetFile)
          This function rotates the original image by 180 degrees (with the clock) and writes the result as a BMP image into the target URL.
static void rotate270(java.lang.String sourceURL, java.lang.String targetFile)
          This function rotates the original image by 270 degrees (with the clock) and writes the result as a BMP image into the target URL.
static void rotate90(java.lang.String sourceURL, java.lang.String targetFile)
          This function rotates the original image by 90 degrees (with the clock) and writes the result as a BMP image into the target URL.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageX

public ImageX()
Method Detail

convertFormat

public static void convertFormat(java.lang.String sourceURL,
                                 java.lang.String targetFile,
                                 ImageFormats targetFormat)
                          throws java.io.IOException,
                                 PanamaException
This function transforms an image from one image format to another. An example for an image format is GIF. The source format is recognized automatically.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the file name of the target image
targetFormat - an ImageFormats object representing the target image format, to which the original image should be converted

convertFormat

public static void convertFormat(java.lang.String sourceURL,
                                 java.lang.String targetFile,
                                 ImageFormats targetFormat,
                                 double scaleX,
                                 double scaleY)
                          throws java.io.IOException,
                                 PanamaException
This function transforms an image from one image format to another. At the same time, the image is scaled to become larger or smaller. An example for an image format is GIF. The source format is recognized automatically. If source and target format are identical then the image is only scaled. If the scaling factor is 1.0 both vertically and horizontally then the image remains unchanged The image can be scaled with different factors horizontally and vertically. However, most applications will likely use identical factors.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the file name of the target image
targetFormat - an ImageFormats object representing the target image format, to which the original image should be converted
scaleX - a double representing the horizontal scale factor; a factor above 1.0 results in enlargement of the image
scaleY - a double representing the vertical scale factor; a factor above 1.0 results in enlargement of the image

getConvertedImageURL

public static java.lang.String getConvertedImageURL(java.lang.String sourceURL,
                                                    java.lang.String transformationJSP,
                                                    ImageFormats targetFormat,
                                                    double scaleX,
                                                    double scaleY)
                                             throws java.io.IOException,
                                                    PanamaException
This function transforms an image from one image format to another. At the same time, the image is scaled to become larger or smaller. An example for an image format is GIF. The source format is recognized automatically. If source and target format are identical then the image is only scaled. If the scaling factor is 1.0 both vertically and horizontally then the image remains unchanged The image can be scaled with different factors horizontally and vertically. However, most applications will likely use identical factors. In contrast to the functions convertFormat(...), this function returns the URL of a JSP file converting / scaling a source image. The converted image then does not have to be stored in an intermediate file.
Parameters:
sourceURL - a String representing the URL of the original image to be converted or scaled
transformationJSP - a String representing the URL of the transformation JSP file (this JSP file is supplied in the sample directory .../sample/sampleadapter/spatial/jsp/)
targetFormat - an ImageFormats object representing the target image format, to which the original image should be converted
scaleX - a double representing the horizontal scale factor; a factor above 1.0 results in enlargement of the image
scaleY - a double representing the vertical scale factor; a factor above 1.0 results in enlargement of the image

getConvertedImageURL

public static java.lang.String getConvertedImageURL(java.lang.String sourceURL,
                                                    java.lang.String transformationJSP,
                                                    ImageFormats targetFormat,
                                                    int maxSizeX,
                                                    int maxSizeY)
                                             throws java.io.IOException,
                                                    PanamaException
This function transforms an image from one image format to another. At the same time, the image is scaled to become larger or smaller and fit a given maximum size. An example for an image format is GIF. The source format is recognized automatically. If source and target format are identical then the image is only scaled. Scaling depends on the requested maximum image size and preserves the aspect ratio In contrast to the functions convertFormat(...), this function returns the URL of a JSP file converting / scaling a source image. The converted image then does not have to be stored in an intermediate file.
Parameters:
sourceURL - a String representing the URL of the original image to be converted or scaled
transformationJSP - a String representing the URL of the transformation JSP file (this JSP file is supplied in the sample directory .../sample/sampleadapter/spatial/jsp/)
targetFormat - an ImageFormats object representing the target image format, to which the original image should be converted
maxSizeX - an int representing the maximum horizontal image size (typically the horizontal resolution of the device). The preserve the aspect ratio, the actual horizontal image size might be lower than the maximum to keep the vertical image size at or below its maximum
maxSizeY - an int representing the maximum vertical image size (typically the vertical resolution of the device). The preserve the aspect ratio, the actual vertical image size might be lower than the maximum to keep the horizontal image size at or below its maximum

convertFormat

public static void convertFormat(java.lang.String sourceURL,
                                 java.io.OutputStream targetStream,
                                 ImageFormats targetFormat,
                                 double scaleX,
                                 double scaleY)
                          throws java.io.IOException,
                                 PanamaException
This function transforms an image from one image format to another. At the same time, the image is scaled to become larger or smaller. An example for an image format is GIF. The source format is recognized automatically. If source and target format are identical then the image is only scaled. If the scaling factor is 1.0 both vertically and horizontally then the image remains unchanged The image can be scaled with different factors horizontally and vertically. However, most applications will likely use identical factors.
Parameters:
sourceURL - a String representing the URL of the original image
targetStream - an OutputStream for the target image
targetFormat - an ImageFormats object representing the target image format, to which the original image should be converted
scaleX - a double representing the horizontal scale factor; a factor above 1.0 results in enlargement of the image
scaleY - a double representing the vertical scale factor; a factor above 1.0 results in enlargement of the image

convertFormat

public static void convertFormat(java.lang.String sourceURL,
                                 java.io.OutputStream targetStream,
                                 ImageFormats targetFormat,
                                 int maxSizeX,
                                 int maxSizeY)
                          throws java.io.IOException,
                                 PanamaException
This function transforms an image from one image format to another. At the same time, the image is scaled to become larger or smaller. With this function, scaling is performed to preserve the aspect ratio. Instead of a scaling factor, a target size is specified. An example for an image format is GIF. The source format is recognized automatically. If source and target format are identical then the image is only scaled.
Parameters:
sourceURL - a String representing the URL of the original image
targetStream - an OutputStream for the target image
targetFormat - an ImageFormats object representing the target image format, to which the original image should be converted
maxSizeX - an int representing the maximum horizontal size; as the aspect ratio is preserved, the actual size might be lower
maxSizeY - an int representing the maximum vertical size; as the aspect ratio is preserved, the actual size might be lower

flipVertical

public static void flipVertical(java.lang.String sourceURL,
                                java.lang.String targetFile)
                         throws java.io.IOException,
                                PanamaException
This function flips the original image vertically and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

flipHorizontal

public static void flipHorizontal(java.lang.String sourceURL,
                                  java.lang.String targetFile)
                           throws java.io.IOException,
                                  PanamaException
This function flips the original image horizontally and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

flipDiagonal

public static void flipDiagonal(java.lang.String sourceURL,
                                java.lang.String targetFile)
                         throws java.io.IOException,
                                PanamaException
This function flips the original image diagonally and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

flipAntiDiagonal

public static void flipAntiDiagonal(java.lang.String sourceURL,
                                    java.lang.String targetFile)
                             throws java.io.IOException,
                                    PanamaException
This function flips the original image antidiagonally and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

rotate90

public static void rotate90(java.lang.String sourceURL,
                            java.lang.String targetFile)
                     throws java.io.IOException,
                            PanamaException
This function rotates the original image by 90 degrees (with the clock) and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

rotate180

public static void rotate180(java.lang.String sourceURL,
                             java.lang.String targetFile)
                      throws java.io.IOException,
                             PanamaException
This function rotates the original image by 180 degrees (with the clock) and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

rotate270

public static void rotate270(java.lang.String sourceURL,
                             java.lang.String targetFile)
                      throws java.io.IOException,
                             PanamaException
This function rotates the original image by 270 degrees (with the clock) and writes the result as a BMP image into the target URL.
Parameters:
sourceURL - a String representing the URL of the original image
targetFile - a String representing the URL of the target BMP image

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception