Commits

Justin Koke committed 8403fc0

Adding .gitignore and also fixing up the packaging + formatting

Conforming to Atalssian standards

Comments (0)

Files changed (2)

+.idea/
+*.iml
+*.ipr
+*.iws
+target/
+.project
+.classpath

src/main/java/com/atlassian/image/ImageGenerator.java

  *
  ****************************************************************************/
 
-package org.j3d.util;
+package com.atlassian.image;
 
 // External imports
-import java.awt.image.*;
 
-import java.awt.Image;
+import java.awt.image.BufferedImage;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageConsumer;
+import java.awt.image.WritableRaster;
 import java.util.Hashtable;
 
 // Local imports
 /**
  * The conversion class that is an image consumer and creates a buffered
  * image as the output.
- * <p>
- *
+ * <p/>
+ * <p/>
  * The generator only works on a single image instance at a time. The
  * consumer can be reset if needed to work on another image. If the image
  *
  */
 class ImageGenerator implements ImageConsumer
 {
-    /** Semaphore to block return of a loader until the image is complete */
+    /**
+     * Semaphore to block return of a loader until the image is complete
+     */
     private Object holder;
 
-    /** Colour model given to us by the consumer */
+    /**
+     * Colour model given to us by the consumer
+     */
     private ColorModel colorModel;
 
-    /** List of properties from the original image */
+    /**
+     * List of properties from the original image
+     */
     private Hashtable properties;
 
-    /** Raster used to put the image values in to as the pixels are read */
+    /**
+     * Raster used to put the image values in to as the pixels are read
+     */
     private WritableRaster raster;
 
-    /** Width of the image in pixels */
+    /**
+     * Width of the image in pixels
+     */
     private int width;
 
-    /** Height of the image in pixels */
+    /**
+     * Height of the image in pixels
+     */
     private int height;
 
     private BufferedImage image;
      */
     public void imageComplete(int status)
     {
-        if(status == STATICIMAGEDONE ||
-            status == IMAGEABORTED ||
-            status == IMAGEERROR ||
-            status == SINGLEFRAMEDONE)
+        if (status == STATICIMAGEDONE ||
+                status == IMAGEABORTED ||
+                status == IMAGEERROR ||
+                status == SINGLEFRAMEDONE)
         {
-            synchronized(holder)
+            synchronized (holder)
             {
                 loadComplete = true;
                 holder.notify();
             }
         }
         else
+        {
             System.err.println("Some other value passed to complete");
+        }
     }
 
     /**
      * Notification of a bunch of pixel values in byte form. Used for
      * 256 color or less images (eg GIF, greyscale etc).
      *
-     * @param x The starting x position of the pixels
-     * @param y The starting y position of the pixels
-     * @param w The number of pixels in the width
-     * @param h The number of pixels in the height
-     * @param model The color model used with these pixel values
-     * @param offset The offset into the source array to copy from
+     * @param x        The starting x position of the pixels
+     * @param y        The starting y position of the pixels
+     * @param w        The number of pixels in the width
+     * @param h        The number of pixels in the height
+     * @param model    The color model used with these pixel values
+     * @param offset   The offset into the source array to copy from
      * @param scansize The number of pixel values between rows
      */
     public void setPixels(int x,
-        int y,
-        int w,
-        int h,
-        ColorModel model,
-        byte[] pixels,
-        int offset,
-        int scansize)
+                          int y,
+                          int w,
+                          int h,
+                          ColorModel model,
+                          byte[] pixels,
+                          int offset,
+                          int scansize)
     {
         if (loadComplete)
+        {
             return;
+        }
 
-        if((intBuffer == null) || (pixels.length > intBuffer.length))
+        if ((intBuffer == null) || (pixels.length > intBuffer.length))
+        {
             intBuffer = new int[pixels.length];
+        }
 
-        for(int i = pixels.length; --i >= 0 ; )
-            intBuffer[i] = (int)pixels[i] & 0xFF;
+        for (int i = pixels.length; --i >= 0; )
+        {
+            intBuffer[i] = (int) pixels[i] & 0xFF;
+        }
 
         raster.setPixels(x, y, w, h, intBuffer);
     }
      * Notification of a bunch of pixel values as ints. These will be
      * full 3 or 4 component images.
      *
-     * @param x The starting x position of the pixels
-     * @param y The starting y position of the pixels
-     * @param w The number of pixels in the width
-     * @param h The number of pixels in the height
-     * @param model The color model used with these pixel values
-     * @param offset The offset into the source array to copy from
+     * @param x        The starting x position of the pixels
+     * @param y        The starting y position of the pixels
+     * @param w        The number of pixels in the width
+     * @param h        The number of pixels in the height
+     * @param model    The color model used with these pixel values
+     * @param offset   The offset into the source array to copy from
      * @param scansize The number of pixel values between rows
      */
     public void setPixels(int x,
-        int y,
-        int w,
-        int h,
-        ColorModel model,
-        int[] pixels,
-        int offset,
-        int scansize)
+                          int y,
+                          int w,
+                          int h,
+                          ColorModel model,
+                          int[] pixels,
+                          int offset,
+                          int scansize)
     {
         if (loadComplete)
+        {
             return;
+        }
 
         image.setRGB(x, y, w, h, pixels, offset, scansize);
     }
      */
     BufferedImage getImage()
     {
-        synchronized(holder)
+        synchronized (holder)
         {
-            if(!loadComplete)
+            if (!loadComplete)
             {
                 try
                 {
                     holder.wait();
                 }
-                catch(InterruptedException ie)
+                catch (InterruptedException ie)
                 {
                 }
             }
      */
     void reset()
     {
-        synchronized(holder)
+        synchronized (holder)
         {
             holder.notify();
         }
     private void createImage()
     {
         // meet the preconditions first.
-        if((image != null) ||
-            (width == -1) ||
-            (colorModel == null) || loadComplete)
+        if ((image != null) ||
+                (width == -1) ||
+                (colorModel == null) || loadComplete)
+        {
             return;
+        }
 
         raster = colorModel.createCompatibleWritableRaster(width, height);