Here you can find the source of checkBounds(BufferedImage image, int xStart, int yStart, int width, int height)
Parameter | Description |
---|---|
image | a parameter |
xStart | a parameter |
yStart | a parameter |
width | a parameter |
height | a parameter |
private static void checkBounds(BufferedImage image, int xStart, int yStart, int width, int height)
//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"); } } }