Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4238919

awt.image.DirectColorModel.createCompatibleWritableRaster(int,int) has doc prob.

XMLWordPrintable

    • 2d
    • beta
    • generic
    • generic

      awt.image.DirectColorModel.createCompatibleWritableRaster(int w, int h) throws java.lang.NegativeArraySizeException when int argumets are negetive. But spec does not specify about any exception.

      Sample Test
      ------------
      import java.awt.image.DirectColorModel;
      import java.awt.color.ColorSpace;

      import java.awt.image.WritableRaster;
      import java.awt.image.DataBuffer;


      public class DCMTest{

      public static void main(String[] arg){

      ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_sRGB);
      int bits = 32;
      int rmask = 0x00ff0000;
      int gmask = 0x0000ff00;
      int bmask = 0x000000ff;
      int amask = 0xff000000;

      DirectColorModel dCM = new DirectColorModel(
      cs,
      bits,
      rmask,
      gmask,
      bmask,
      amask,
      false,
      DataBuffer.TYPE_INT
      );
      /* Testing method createCompatibleWritableRaster(int,int) */

      WritableRaster raster = dCM.createCompatibleWritableRaster(10,5);
      System.out.println("no exception test is ok");
      }
      }

            tdv Dmitri Trembovetski (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: