< prev index next >

src/demo/share/jfc/J2Ddemo/java2d/demos/Images/ImageOps.java

Print this page

        

@@ -1,8 +1,8 @@
 /*
  *
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:
  *

@@ -64,37 +64,37 @@
  */
 @SuppressWarnings("serial")
 public class ImageOps extends ControlsSurface implements ChangeListener {
 
     protected JSlider slider1, slider2;
-    private static final String imgName[] = { "bld.jpg", "boat.png" };
-    private static final BufferedImage img[] = new BufferedImage[imgName.length];
-    private static final String opsName[] = {
+    private static final String[] imgName = { "bld.jpg", "boat.png" };
+    private static final BufferedImage[] img = new BufferedImage[imgName.length];
+    private static final String[] opsName = {
         "Threshold", "RescaleOp", "Invert", "Yellow Invert", "3x3 Blur",
         "3x3 Sharpen", "3x3 Edge", "5x5 Edge" };
-    private static final BufferedImageOp biop[] =
+    private static final BufferedImageOp[] biop =
             new BufferedImageOp[opsName.length];
     private static int rescaleFactor = 128;
     private static float rescaleOffset = 0;
     private static final int low = 100, high = 200;
     private int opsIndex, imgIndex;
 
     static {
         thresholdOp(low, high);
         int i = 1;
         biop[i++] = new RescaleOp(1.0f, 0, null);
-        byte invert[] = new byte[256];
-        byte ordered[] = new byte[256];
+        byte[] invert = new byte[256];
+        byte[] ordered = new byte[256];
         for (int j = 0; j < 256; j++) {
             invert[j] = (byte) (256 - j);
             ordered[j] = (byte) j;
         }
         biop[i++] = new LookupOp(new ByteLookupTable(0, invert), null);
         byte[][] yellowInvert = new byte[][] { invert, invert, ordered };
         biop[i++] = new LookupOp(new ByteLookupTable(0, yellowInvert), null);
-        int dim[][] = { { 3, 3 }, { 3, 3 }, { 3, 3 }, { 5, 5 } };
-        float data[][] = { { 0.1f, 0.1f, 0.1f, // 3x3 blur
+        int[][] dim = { { 3, 3 }, { 3, 3 }, { 3, 3 }, { 5, 5 } };
+        float[][] data = { { 0.1f, 0.1f, 0.1f, // 3x3 blur
                 0.1f, 0.2f, 0.1f,
                 0.1f, 0.1f, 0.1f },
             { -1.0f, -1.0f, -1.0f, // 3x3 sharpen
                 -1.0f, 9.0f, -1.0f,
                 -1.0f, -1.0f, -1.0f },

@@ -132,11 +132,11 @@
         setConstraints(new String[] {
                     BorderLayout.NORTH, BorderLayout.WEST, BorderLayout.EAST });
     }
 
     public static void thresholdOp(int low, int high) {
-        byte threshold[] = new byte[256];
+        byte[] threshold = new byte[256];
         for (int j = 0; j < 256; j++) {
             if (j > high) {
                 threshold[j] = (byte) 255;
             } else if (j < low) {
                 threshold[j] = (byte) 0;

@@ -178,11 +178,11 @@
 
         }
         repaint();
     }
 
-    public static void main(String s[]) {
+    public static void main(String[] s) {
         createDemoFrame(new ImageOps());
     }
 
 
     static class DemoControls extends CustomControls implements ActionListener {
< prev index next >