//#define DJ_DBG
#include <djColor.h>
#include <stdio.h>

using namespace dj;

int main(int argc, char ** argv)
{
  DJ_DBG_LOG();
  
  if (argc != 4) {
    printf("Usage: convert (color) (format) (type)\n");
    return 1;
  }
  
  StrList data = split(Str(argv[1]), ' ');
  Color color;
  inflateStr(data, &color);
  
  PIXEL_FORMAT format = PIXEL_FORMAT(0);
  data.del();
  data += Str(argv[2]);
  inflateStr(data, &format, pixelFormatStr());
  
  PIXEL_TYPE type = PIXEL_TYPE(0);
  data.del();
  data += Str(argv[3]);
  inflateStr(data, &type, pixelTypeStr());
  
  Color tmp(format, type);
  convert(color, &tmp);
  
  printf("%s\n", join(deflateStr(tmp), ' ').toAscii());
  
  return 0;
}
