Colors.java
Go to the documentation of this file.
00001 package edu.tum.cs.ias.knowrob.util;
00002 
00009 public class Colors {
00010         public static Colors defaultInstance;
00011         static { defaultInstance = new Colors(); }
00012         
00013         public static int[][] defaultColors = new int[][] {
00014                 {255,0,0,255},
00015                 {255,255,0,255},
00016                 {0,0,255,255},
00017                 {255,0,255,255},
00018                 {150,150,0,255},
00019                 {0,150,150,255},
00020                 {0,255,0,255},
00021                 {150,0,0,255},
00022                 {0,150,0,255},
00023                 {150,0,150,255},
00024                 {0,255,255,255},
00025                 {0,150,255,255},
00026                 {150,0,255,255},
00027                 {0,255,150,255},
00028                 {0,0,150,255},
00029                 {150,255,0,255},
00030                 {255,0,150,255},
00031                 {255,150,0,255},
00032         };
00033         
00034         private int currentDefaultColor;
00035         
00039         public static int convertColor(int red, int green, int blue, int alpha) {
00040                 return (((((alpha << 8) + red) << 8) + green) << 8) + blue;
00041         }
00042         public static int getRed(int color) {
00043                 return (color >> 16) % 256;
00044         }
00045         public static int getGreen(int color) {
00046                 return (color >> 8) % 256;
00047         }
00048         public static int getBlue(int color) {
00049                 return color% 256;
00050         }
00051         public static int getAlpha(int color) {
00052                 return (color >> 24) % 256;
00053         }
00059         public int nextColor() {
00060                 int color = convertColor(defaultColors[currentDefaultColor][0],defaultColors[currentDefaultColor][1],defaultColors[currentDefaultColor][2],defaultColors[currentDefaultColor][3]);
00061                 currentDefaultColor = (currentDefaultColor+1) % defaultColors.length;
00062                 return color;
00063         }
00064         
00068         public static int getColor() {
00069                 return defaultInstance.nextColor();
00070         }
00071 }


mod_vis
Author(s): Moritz Tenorth, Jakob Engel
autogenerated on Sat Dec 28 2013 17:09:49