コード例 #1
0
 public static Color brightnessAdjust(Color original, float brightness) {
   float[] hsb = getHSB(original);
   hsb[2] = brightness;
   if (hsb[2] < 0.0f) hsb[2] = 0.0f;
   else if (hsb[2] > 1.0f) hsb[2] = 1.0f;
   int newRGB = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
   return new Color(newRGB);
 }
コード例 #2
0
 public static Color saturationAdjust(Color original, float saturation) {
   float[] hsb = getHSB(original);
   hsb[1] = saturation;
   if (hsb[1] < 0.0f) hsb[1] = 0.0f;
   else if (hsb[1] > 1.0f) hsb[1] = 1.0f;
   int newRGB = Color.HSBtoRGB(hsb[0], hsb[1], 1.0f);
   return new Color(newRGB);
 }