Java examples for java.lang:Math Matrix
get Single Color Int Matrix
//package com.java2s; import java.awt.Color; public class Main { public static int[][] getSingleColorIntMatrix(int[][] colorIntMatrix, int width, int height, Color color) { int[][] singleColorRGBIntMatrix = new int[width][height]; Color c = null;//from w ww . j a v a2 s . c o m for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { c = new Color(colorIntMatrix[i][j]); if (color.equals(Color.red)) { singleColorRGBIntMatrix[i][j] = c.getRed(); } else if (color.equals(Color.blue)) { singleColorRGBIntMatrix[i][j] = c.getBlue(); } else if (color.equals(Color.green)) { singleColorRGBIntMatrix[i][j] = c.getGreen(); } } } return singleColorRGBIntMatrix; } }