Java ByteBuffer Size checkBounds(BufferedImage image, int xStart, int yStart, int width, int height)

Here you can find the source of checkBounds(BufferedImage image, int xStart, int yStart, int width, int height)

Description

check Bounds

License

Open Source License

Parameter

Parameter Description
image a parameter
xStart a parameter
yStart a parameter
width a parameter
height a parameter

Declaration

private static void checkBounds(BufferedImage image, int xStart, int yStart, int width, int height) 

Method Source Code

//package com.java2s;
/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
* COPYRIGHT 2016.  ALL RIGHTS RESERVED.  THIS MODULE CONTAINS
* CHARTER COMMUNICATIONS CONFIDENTIAL AND PROPRIETARY INFORMATION.
* THE INFORMATION CONTAINED HEREIN IS GOVERNED BY LICENSE AND
* SHALL NOT BE DISTRIBUTED OR COPIED WITHOUT WRITTEN PERMISSION
* FROM CHARTER COMMUNICATIONS.//from  w  w  w . jav  a 2 s.  c  om
*
* Author:  Nagaraju.Meka
* File:    CommonFunctions.java
* Created: Dec 06, 2016
*
* Description: Class to help normalize startup and usage of
* retrieving the objects from Jenkins/Properties file.
*
*
*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-*/

import java.awt.image.BufferedImage;

public class Main {
    /**
     * 
     * @param image
     * @param xStart
     * @param yStart
     * @param width
     * @param height
     */
    private static void checkBounds(BufferedImage image, int xStart, int yStart, int width, int height) {
        int imgWidth = image.getWidth();
        int imgHeight = image.getHeight();
        if (xStart > imgWidth || width > imgWidth || (xStart + width) > imgWidth) {
            throw new RuntimeException("image does not fully contain the comparison region");
        }
        if (yStart > imgHeight || height > imgHeight || (yStart + height) > imgHeight) {
            throw new RuntimeException("image does not fully contain the comparison region");
        }
    }
}

Related

  1. adaptImageSize(final BufferedImage img, final int width, final int height)
  2. addToStringBuilder(StringBuilder sb, ByteBuffer buffer, int size)
  3. calcSize(ByteBuffer buffer)
  4. check(ByteBuffer buffer, int size)
  5. checkBufferSize(ByteBuffer buf, int elementSize)
  6. chooseAppropriateTileSize(BufferedImage image)
  7. collidesWithImage(BufferedImage image, int x, int y, int width, int height, boolean pixelPerfect)
  8. convolve(final BufferedImage image, float[] elements, int theWidth, int theHeight)