diff options
author | Sravan Kumar Lakkimsetti | 2015-03-08 09:56:39 +0000 |
---|---|---|
committer | Sravan Kumar Lakkimsetti | 2015-03-08 09:56:39 +0000 |
commit | d8668bdb9b98e21baf4bd9d0be252a7c3cfc735b (patch) | |
tree | 1470c9cc07d939c39357b64bd0dba33b70df9ee1 | |
parent | 0e07f03c1116ee0ef9105442c9657b8a3c36cafd (diff) | |
download | eclipse.platform.swt-d8668bdb9b98e21baf4bd9d0be252a7c3cfc735b.tar.gz eclipse.platform.swt-d8668bdb9b98e21baf4bd9d0be252a7c3cfc735b.tar.xz eclipse.platform.swt-d8668bdb9b98e21baf4bd9d0be252a7c3cfc735b.zip |
Added Java doc to public functions
Change-Id: Id8eb6be359745e013c8b7d1019f400d21ae48347
Signed-off-by: Sravan Kumar Lakkimsetti <sravankumarl@in.ibm.com>
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java | 100 |
1 files changed, 79 insertions, 21 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java index 2a4d28a332..e10052a21c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Image.java @@ -663,8 +663,10 @@ public Image(Device device, InputStream stream) { * of an unsupported type. * <p> * This constructor is provided for convenience when loading - * a single image only. If the specified file contains - * multiple images, only the first one will be used. + * a image from image file only.This constructor will search for + * other representations at the same location with the pattern + * <filename>@*x.<extension>. * represents 1.5 for 1.5 times of the image + * and 2 represents double size * * @param device the device on which to create the image * @param filename the name of the file to load the image from @@ -687,6 +689,33 @@ public Image(Device device, String filename) { this (device, DPIUtil.getImageNames(filename)); } +/** + * Constructs an instance of this class by loading its representations + * from the files with the specified name. Throws an error if an error + * occurs while loading the image, or if the result is an image + * of an unsupported type. + * <p> + * This constructor is provided for convenience when loading + * a image from image files only. + * + * @param device the device on which to create the image + * @param filenames the name of the file to load the image from + * + * @exception IllegalArgumentException <ul> + * <li>ERROR_NULL_ARGUMENT - if device is null and there is no current device</li> + * <li>ERROR_NULL_ARGUMENT - if the file name is null</li> + * </ul> + * @exception SWTException <ul> + * <li>ERROR_IO - if an IO error occurs while reading from the file</li> + * <li>ERROR_INVALID_IMAGE - if the image file contains invalid data </li> + * <li>ERROR_UNSUPPORTED_DEPTH - if the image file describes an image with an unsupported depth</li> + * <li>ERROR_UNSUPPORTED_FORMAT - if the image file contains an unrecognized format</li> + * </ul> + * @exception SWTError <ul> + * <li>ERROR_NO_HANDLES if a handle could not be obtained for image creation</li> + * </ul> + */ + public Image(Device device, String[] filenames) { super(device); for (int i = 0; i < filenames.length; i++) { @@ -1773,45 +1802,74 @@ void copyImageDataToDpiImageStorage (int imageSelectorIndex) { dpiSurface[imageSelectorIndex] = surface; } -public void addRepresentation (Image srcImage) { - addRepresentation(srcImage, 100); -} -public void addRepresentation (Image srcImage, int zoom) { - copyImage(device, srcImage, SWT.IMAGE_COPY); - copyImageDataToDpiImageStorage(DPIUtil.mapZoomToImageSelectorIndex(zoom)); - copyImageDataFromDpiImageStorage(device.getImageSelector()); -} - +/** + * Adds a new image representation to the Image object using the + * ImageData supplied. This will replaces the any existing Image data + * This adds Image data for a zoom level of 100% + * + * @param srcImageData Image data for the representation + */ public void addRepresentation (ImageData srcImageData) { addRepresentation(srcImageData, 100); } +/** + * Adds a new image representation to the Image object using the + * ImageData supplied. This will replaces the any existing Image data + * This adds Image data for a zoom level of 100% + * + * @param srcImageData image data for the representation + * @param zoom zoom level 100,150 or 200. they corresponds to 100%, 150% and 200% + */ public void addRepresentation (ImageData srcImageData, int zoom) { init(srcImageData); copyImageDataToDpiImageStorage(DPIUtil.mapZoomToImageSelectorIndex(zoom)); copyImageDataFromDpiImageStorage(device.getImageSelector()); } -public void addRepresentation (InputStream srcStream) { - addRepresentation(srcStream, 100); -} - -public void addRepresentation (InputStream srcStream, int zoom) { - init(new ImageData(srcStream)); - copyImageDataToDpiImageStorage(DPIUtil.mapZoomToImageSelectorIndex(zoom)); - copyImageDataFromDpiImageStorage(device.getImageSelector()); -} - +/** + * Adds a new image representation to the Image object using the + * file supplied. This will replaces the any existing representation + * This adds Image data for a zoom level of 100% + * + * @param filename fully qualified filename representing a image + */ public void addRepresentation (String filename) { addRepresentation(filename, 100); } +/** + * Adds a new image representation to the Image object using the + * file supplied. This will replaces the any existing representation + * This adds Image data for a zoom level of 100% + * + * @param filename fully qualified filename representing a image + * @param zoom zoom level 100,150 or 200. they corresponds to 100%, 150% and 200% + */ + public void addRepresentation (String filename, int zoom) { int imageSelctionIndex = DPIUtil.mapZoomToImageSelectorIndex(zoom); dpiFilename[imageSelctionIndex] = filename; copyImageDataFromDpiImageStorage(device.getImageSelector()); } +/** + * Returns an <code>ImageData</code> based on the receiver + * Modifications made to this <code>ImageData</code> will not + * affect the Image. + * + * @param zoom zoom level 100,150 or 200. they corresponds to 100%, 150% and 200% + * + * @return an <code>ImageData</code> containing the image's data and attributes + * + * @exception SWTException <ul> + * <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_INVALID_IMAGE - if the image is not a bitmap or an icon</li> + * </ul> + * + * @see ImageData + */ + public ImageData getImageData (int zoom) { copyImageDataFromDpiImageStorage(DPIUtil.mapZoomToImageSelectorIndex(zoom)); ImageData returnVal = getImageData (); |