Here you can find the source of intToRgbComponents(int rgb)
Parameter | Description |
---|---|
rgb | a parameter |
public static int[] intToRgbComponents(int rgb)
//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 }; } }