Here you can find the source of encodeRGBIntString(Color color, boolean withAlpha)
Parameter | Description |
---|---|
color | the color to encode |
withAlpha | whether the alpha value should be appended |
public static String encodeRGBIntString(Color color, boolean withAlpha)
//package com.java2s; //License from project: Apache License import java.awt.Color; public class Main { /**/*from w ww. j a v a 2 s .co m*/ * Create a string of the integer values of the RGB components of the color. The components are * separated by comma. * * @param color * the color to encode * @param withAlpha * whether the alpha value should be appended * @return the string or null if color was null */ public static String encodeRGBIntString(Color color, boolean withAlpha) { if (color == null) { return null; } StringBuilder colorString = new StringBuilder(); colorString.append(color.getRed()).append(",").append(color.getGreen()).append(",").append(color.getBlue()); if (withAlpha) { colorString.append(",").append(color.getAlpha()); } return colorString.toString(); } }