Java BufferedImage Operation buildSectors(BufferedImage a, int sqrtSectors)

Here you can find the source of buildSectors(BufferedImage a, int sqrtSectors)

Description

build Sectors

License

Apache License

Declaration

private static Rectangle[] buildSectors(BufferedImage a, int sqrtSectors) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Rectangle;

import java.awt.image.BufferedImage;

public class Main {
    private static Rectangle[] buildSectors(BufferedImage a, int sqrtSectors) {
        int rows = sqrtSectors;
        int columns = sqrtSectors;

        int sectorWidth = a.getWidth() / columns;
        int sectorHeight = a.getHeight() / columns;

        Rectangle[] sectors = new Rectangle[sqrtSectors * sqrtSectors];
        for (int x = 0; x < columns; x++) {
            for (int y = 0; y < rows; y++) {
                int sectorStartX = x * sectorWidth;
                int sectorStartY = y * sectorHeight;

                int index = x + y * columns;
                sectors[index] = new Rectangle(sectorStartX, sectorStartY, sectorWidth, sectorHeight);
            }//from w  ww  .  ja v  a 2  s . c  o m
        }

        return sectors;
    }
}

Related

  1. blackAndWhiteCleaning(BufferedImage image)
  2. boostBufferedImagePerformance(BufferedImage image, boolean translucent)
  3. buildColorStatisticsOfImage(BufferedImage image)
  4. buildingCoordinatesInImage(BufferedImage imageSection)
  5. buildPixelAverages(BufferedImage a, Rectangle[] sectors)
  6. cascadeHorizontal(final BufferedImage... images)
  7. changeContrast(BufferedImage img, float amount)
  8. changeImageToArray(BufferedImage bufferedImage)
  9. checkIfManyColors(BufferedImage image)