public static ColorMode getType() {
   for (ColorMode type : ColorMode.values()) {
     if (type.isSet()) {
       return type;
     }
   }
   return ColorMode.ORDER;
 }
 @Override
 public void setSelected(AnActionEvent e, boolean enabled) {
   if (enabled) {
     myType.set();
   }
   myGutter.revalidateMarkup();
 }
  public ShowAnnotationColorsAction(EditorGutterComponentEx gutter) {
    super("Colors", true);

    final ArrayList<AnAction> kids = new ArrayList<AnAction>(ShortNameType.values().length);
    for (ColorMode type : ColorMode.values()) {
      kids.add(new SetColorModeAction(type, gutter));
    }
    myChildren = kids.toArray(new AnAction[kids.size()]);
  }
 /** Parses chunk data for header information. */
 private void parseData() {
   int w = parser.parseInt();
   int h = parser.parseInt();
   int depth = parser.parseInt(1);
   ColorMode mode = ColorMode.fromData(parser.parseInt(1));
   CompressionEngine compression = CompressionEngine.fromData(parser.parseInt(1));
   FilterMethod filter = FilterMethod.fromData(parser.parseInt(1));
   InterlaceMethod interlace = InterlaceMethod.fromData(parser.parseInt(1));
   setProperties(w, h, depth, mode, compression, filter, interlace);
 }
 /**
  * Creates the data byte array for this chunk.
  *
  * @return The data byte array.
  */
 private byte[] createDataBytes() {
   ByteComposer composer = new ByteComposer(13);
   composer.composeInt(width);
   composer.composeInt(height);
   composer.composeInt(sampleDepth, 1);
   composer.composeInt(mode.dataValue(), 1);
   composer.composeInt(compressionEngine.dataValue(), 1);
   composer.composeInt(filterMethod.dataValue(), 1);
   composer.composeInt(interlaceMethod.dataValue(), 1);
   return composer.toArray();
 }
  public int getColorComp(Color c) {
    float[] compArray = new float[4];
    c.getColorComponents(compArray);

    return (int) (compArray[mode.ordinal()] * 255);
  }
 public SetColorModeAction(ColorMode type, EditorGutterComponentEx gutter) {
   super(type.getDescription());
   myType = type;
   myGutter = gutter;
 }