@Override public void unsafe_set(int x, int y, int value) { data[getIndex(x,y)] = (byte)value; }
/** * Sets the value of the specified pixel. * * @param x pixel coordinate. * @param y pixel coordinate. * @param value The pixel's new value. */ @Override public void set(int x, int y, int value) { if (!isInBounds(x, y)) throw new ImageAccessException("Requested pixel is out of bounds: "+x+" "+y); data[getIndex(x, y)] = (byte) value; }
public static void convert( GrayS8 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( from.data[indexFrom++] ); } } } else { final int N = from.width * from.height; System.arraycopy(from.data, 0, to.data, 0, N); } }
public static void convert( GrayU8 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] & 0xFF); } } } else { final int N = from.width * from.height; System.arraycopy(from.data, 0, to.data, 0, N); } }
public static void convert( GrayU16 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] & 0xFFFF); } } } else { final int N = from.width * from.height; for (int i = 0; i < N; i++) { to.data[i] = ( byte )( from.data[i] & 0xFFFF); } } }
public static void convert( GrayS32 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] ); } } } else { final int N = from.width * from.height; for (int i = 0; i < N; i++) { to.data[i] = ( byte )( from.data[i] ); } } }
public static void convert( GrayF64 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] ); } } } else { final int N = from.width * from.height; for (int i = 0; i < N; i++) { to.data[i] = ( byte )( from.data[i] ); } } }
public static void convert( GrayS64 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] ); } } } else { final int N = from.width * from.height; for (int i = 0; i < N; i++) { to.data[i] = ( byte )( from.data[i] ); } } }
public static void convert( GrayF32 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] ); } } } else { final int N = from.width * from.height; for (int i = 0; i < N; i++) { to.data[i] = ( byte )( from.data[i] ); } } }
public static void convert( GrayS16 from, GrayI8 to ) { if (from.isSubimage() || to.isSubimage()) { for (int y = 0; y < from.height; y++) { int indexFrom = from.getIndex(0, y); int indexTo = to.getIndex(0, y); for (int x = 0; x < from.width; x++) { to.data[indexTo++] = ( byte )( from.data[indexFrom++] ); } } } else { final int N = from.width * from.height; for (int i = 0; i < N; i++) { to.data[i] = ( byte )( from.data[i] ); } } }