< prev index next >

src/java.desktop/share/classes/java/awt/image/SinglePixelPackedSampleModel.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -64,17 +64,17 @@
  */
 
 public class SinglePixelPackedSampleModel extends SampleModel
 {
     /** Bit masks for all bands of the image data. */
-    private int bitMasks[];
+    private int[] bitMasks;
 
     /** Bit Offsets for all bands of the image data. */
-    private int bitOffsets[];
+    private int[] bitOffsets;
 
     /** Bit sizes for all the bands of the image data. */
-    private int bitSizes[];
+    private int[] bitSizes;
 
     /** Maximum bit size. */
     private int maxBitSize;
 
     /** Line stride of the region of image data described by this

@@ -104,11 +104,11 @@
      *         either {@code DataBuffer.TYPE_BYTE},
      *         {@code DataBuffer.TYPE_USHORT}, or
      *         {@code DataBuffer.TYPE_INT}
      */
     public SinglePixelPackedSampleModel(int dataType, int w, int h,
-                                   int bitMasks[]) {
+                                   int[] bitMasks) {
         this(dataType, w, h, w, bitMasks);
         if (dataType != DataBuffer.TYPE_BYTE &&
             dataType != DataBuffer.TYPE_USHORT &&
             dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("Unsupported data type "+

@@ -138,11 +138,11 @@
      *         either {@code DataBuffer.TYPE_BYTE},
      *         {@code DataBuffer.TYPE_USHORT}, or
      *         {@code DataBuffer.TYPE_INT}
      */
     public SinglePixelPackedSampleModel(int dataType, int w, int h,
-                                   int scanlineStride, int bitMasks[]) {
+                                   int scanlineStride, int[] bitMasks) {
         super(dataType, w, h, bitMasks.length);
         if (dataType != DataBuffer.TYPE_BYTE &&
             dataType != DataBuffer.TYPE_USHORT &&
             dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("Unsupported data type "+

@@ -304,16 +304,16 @@
      * SinglePixelPackedSampleModel/DataBuffer combination.
      * @exception RasterFormatException if the length of the bands argument is
      *                                  greater than the number of bands in
      *                                  the sample model.
      */
-    public SampleModel createSubsetSampleModel(int bands[]) {
+    public SampleModel createSubsetSampleModel(int[] bands) {
         if (bands.length > numBands)
             throw new RasterFormatException("There are only " +
                                             numBands +
                                             " bands");
-        int newBitMasks[] = new int[bands.length];
+        int[] newBitMasks = new int[bands.length];
         for (int i=0; i<bands.length; i++)
             newBitMasks[i] = bitMasks[bands[i]];
 
         return new SinglePixelPackedSampleModel(this.dataType, width, height,
                                            this.scanlineStride, newBitMasks);

@@ -424,16 +424,16 @@
      * @param iArray    If non-null, returns the samples in this array
      * @param data      The DataBuffer containing the image data.
      * @return all samples for the specified pixel.
      * @see #setPixel(int, int, int[], DataBuffer)
      */
-    public int [] getPixel(int x, int y, int iArray[], DataBuffer data) {
+    public int [] getPixel(int x, int y, int[] iArray, DataBuffer data) {
         if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) {
             throw new ArrayIndexOutOfBoundsException
                 ("Coordinate out of bounds!");
         }
-        int pixels[];
+        int[] pixels;
         if (iArray == null) {
             pixels = new int [numBands];
         } else {
             pixels = iArray;
         }

@@ -458,21 +458,21 @@
      * @param data      The DataBuffer containing the image data.
      * @return all samples for the specified region of pixels.
      * @see #setPixels(int, int, int, int, int[], DataBuffer)
      */
     public int[] getPixels(int x, int y, int w, int h,
-                           int iArray[], DataBuffer data) {
+                           int[] iArray, DataBuffer data) {
         int x1 = x + w;
         int y1 = y + h;
 
         if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
             y < 0 || y >= height || h > height || y1 < 0 || y1 >  height)
         {
             throw new ArrayIndexOutOfBoundsException
                 ("Coordinate out of bounds!");
         }
-        int pixels[];
+        int[] pixels;
         if (iArray != null) {
            pixels = iArray;
         } else {
            pixels = new int [w*h*numBands];
         }

@@ -530,17 +530,17 @@
      * @return the samples for the specified band for the specified
      *         region of pixels.
      * @see #setSamples(int, int, int, int, int, int[], DataBuffer)
      */
     public int[] getSamples(int x, int y, int w, int h, int b,
-                           int iArray[], DataBuffer data) {
+                           int[] iArray, DataBuffer data) {
         // Bounds check for 'b' will be performed automatically
         if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
             throw new ArrayIndexOutOfBoundsException
                 ("Coordinate out of bounds!");
         }
-        int samples[];
+        int[] samples;
         if (iArray != null) {
            samples = iArray;
         } else {
            samples = new int [w*h];
         }

@@ -632,11 +632,11 @@
      * @param iArray    The input samples in an int array.
      * @param data      The DataBuffer containing the image data.
      * @see #getPixel(int, int, int[], DataBuffer)
      */
     public void setPixel(int x, int y,
-                         int iArray[],
+                         int[] iArray,
                          DataBuffer data) {
         if ((x < 0) || (y < 0) || (x >= width) || (y >= height)) {
             throw new ArrayIndexOutOfBoundsException
                 ("Coordinate out of bounds!");
         }

@@ -661,11 +661,11 @@
      * @param iArray    The input samples in an int array.
      * @param data      The DataBuffer containing the image data.
      * @see #getPixels(int, int, int, int, int[], DataBuffer)
      */
     public void setPixels(int x, int y, int w, int h,
-                          int iArray[], DataBuffer data) {
+                          int[] iArray, DataBuffer data) {
         int x1 = x + w;
         int y1 = y + h;
 
         if (x < 0 || x >= width || w > width || x1 < 0 || x1 > width ||
             y < 0 || y >= height || h > height || y1 < 0 || y1 >  height)

@@ -730,11 +730,11 @@
      * @param iArray    The input samples in an int array.
      * @param data      The DataBuffer containing the image data.
      * @see #getSamples(int, int, int, int, int, int[], DataBuffer)
      */
     public void setSamples(int x, int y, int w, int h, int b,
-                          int iArray[], DataBuffer data) {
+                          int[] iArray, DataBuffer data) {
         // Bounds check for 'b' will be performed automatically
         if ((x < 0) || (y < 0) || (x + w > width) || (y + h > height)) {
             throw new ArrayIndexOutOfBoundsException
                 ("Coordinate out of bounds!");
         }
< prev index next >