Java Integer to intToRgbComponents(int rgb)

Here you can find the source of intToRgbComponents(int rgb)

Description

Convert rgb to its components

License

Open Source License

Parameter

Parameter Description
rgb a parameter

Declaration

public static int[] intToRgbComponents(int rgb) 

Method Source Code

//package com.java2s;
/* Image to ZX Spec/* w w  w .  j a  va2 s. c  om*/
 * Copyright (C) 2014 Silent Software (Benjamin Brown)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

public class Main {
    /**
     * Convert rgb to its components
     * 
     * @param rgb
     * @return
     */
    public static int[] intToRgbComponents(int rgb) {
        return new int[] { rgb >> 16 & 0xFF, rgb >> 8 & 0xFF, rgb & 0xFF };
    }
}

Related

  1. intToPlusMin(int i)
  2. intToPrefixCoded(final int val, final int shift, final char[] buffer)
  3. intToRegisters(int v)
  4. intToRGB(int color)
  5. IntToRGB(int rgbInt)
  6. intToRoman(int i)
  7. intToRoman(int value)
  8. intToScaleString(final int number, final int scale)
  9. intToShort(final int value)