+static void OptDumpPalette (const char* Opt attribute ((unused)),
+ const char* Arg attribute ((unused)))
+/* Dump the palette of the current work bitmap */
+{
+ /* We must have a bitmap ... */
+ if (C == 0) {
+ Error ("No bitmap");
+ }
+
+ /* ... which must be indexed */
+ if (!BitmapIsIndexed (C)) {
+ Error ("Current bitmap is not indexed");
+ }
+
+ /* Dump the palette */
+ DumpPalette (stdout, GetBitmapPalette (C));
+}
+
+
+
static void OptHelp (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Print usage information and exit */
const char* Arg attribute ((unused)))
/* Print the assembler version */
{
- fprintf (stderr,
- "%s V%s - (C) Copyright 2012, Ullrich von Bassewitz\n",
- ProgName, GetVersionAsString ());
+ fprintf (stderr, "%s V%s\n", ProgName, GetVersionAsString ());
}
/* Parse the argument */
Collection* A = ParseAttrList (Arg, NameList, 2);
+ /* We must have output data */
+ if (D == 0) {
+ Error ("No conversion, so there's nothing to write");
+ }
+
/* Write the file */
- WriteOutputFile (D, A);
+ WriteOutputFile (D, A, C);
/* Delete the attribute list */
FreeAttrList (A);
/* Program long options */
static const LongOpt OptTab[] = {
{ "--convert-to", 1, OptConvertTo },
+ { "--dump-palette", 0, OptDumpPalette },
{ "--help", 0, OptHelp },
{ "--list-conversions", 0, OptListConversions },
{ "--pop", 0, OptPop },
++I;
}
+ /* Cleanup data */
+ SetWorkBitmap (C);
+ FreeBitmap (B);
+ FreeStrBuf (D);
+
/* Success */
return EXIT_SUCCESS;
}