Java ByteBuffer Size scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order, int width, int height)

Here you can find the source of scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order, int width, int height)

Description

scan For Duplicates

License

Open Source License

Declaration

private static void scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order,
            int width, int height) 

Method Source Code

//package com.java2s;
/*//w  w w . j av  a  2s.c o  m
 *    leola-live 
 *  see license.txt
 */

import java.awt.image.BufferedImage;

public class Main {
    private static void scanForDuplicates(BufferedImage leftImage, BufferedImage[] images, int i, int[] order,
            int width, int height) {

        for (int j = i + 1; j < images.length; j++) {
            BufferedImage right = images[j];
            if (right != null) {
                if (isDataEqual(leftImage, right, width, height)) {
                    order[j] = i;
                }
            }
        }
    }

    /**
     * Tests to see if the data is equal
     *
     * @param left
     * @param right
     * @param width
     * @param height
     * @return
     */
    private static boolean isDataEqual(BufferedImage left, BufferedImage right, int width, int height) {

        for (int x = 0; x < width; x++) {
            for (int y = 0; y < height; y++) {
                if (left.getRGB(x, y) != right.getRGB(x, y)) {
                    return false;
                }
            }
        }
        return true;
    }
}

Related

  1. overlapsPoints(BufferedImage inImage, int inX, int inY, int inWidth, int inHeight, Color inTextColour)
  2. pack(List buffers, int elements, int size)
  3. rescaleImage(BufferedImage img, int targetWidth, int targetHeight, Object hint)
  4. rightSize(ByteBuffer in)
  5. sameSize(BufferedImage im1, BufferedImage im2)
  6. sizeOfBytes(ByteBuffer bytes)
  7. sizeOfBytesMap(Map m)
  8. sizeOfValue(ByteBuffer bytes)
  9. sizeP(ByteBuffer bb)