Here you can find the source of rgbBitfieldToString(int rgb)
Parameter | Description |
---|---|
rgb | The color of the pixel as bitfield |
public static String rgbBitfieldToString(int rgb)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww. jav a 2 s. co m * Extracts the red green and blue portions as of a pixel and returns them * as String. * * @param rgb * The color of the pixel as bitfield * @return A String of the decimal representations of RED, GREEN and BLUE */ public static String rgbBitfieldToString(int rgb) { return getRed(rgb) + " " + getGreen(rgb) + " " + getBlue(rgb); } /** * Extracts the red portion from a given RGB color * * @param rgb * The color as bitfield * @return the decimal portion of red */ public static int getRed(int rgb) { return (rgb >> 16) & 0xff; } /** * Extracts the green portion from a given RGB color * * @param rgb * The color as bitfield * @return the decimal portion of green */ public static int getGreen(int rgb) { return (rgb >> 8) & 0xff; } /** * Extracts the blue portion from a given RGB color * * @param rgb * The color as bitfield * @return the decimal portion of blue */ public static int getBlue(int rgb) { return (rgb) & 0xff; } }