Here you can find the source of pixelRange(int p)
Parameter | Description |
---|---|
p | Input value |
public static int pixelRange(int p)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w .j a v a2 s . c o m*/ * Utility method to limit the value within [0,255] range * * @param p Input value * @return Limited value */ public static int pixelRange(int p) { return ((p > 255) ? 255 : (p < 0) ? 0 : p); } /** * Utility method to limit the value within [0,255] range * * @param p Input value * @return Limited value */ public static int pixelRange(double p) { return ((p > 255) ? 255 : (p < 0) ? 0 : (int) p); } }