Changeset 15d3e8a in thomson for tools/gfx2mo5/png2mo5.c


Ignore:
Timestamp:
Mar 20, 2016, 10:04:25 PM (8 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
a8929a8
Parents:
2366419
Message:

gfx2mo5: can now convert bitmap16 files.

git-svn-id: svn://localhost/thomson@68 85ae3b6b-dc8f-4344-a89d-598714f2e4e5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/gfx2mo5/png2mo5.c

    r2366419 r15d3e8a  
    3939
    4040  char opt;
    41   int fixup = -1;
    42   bool to = false;
     41  int fixup;
     42  bool to;
     43  bool bitmap16;
    4344
    4445  unsigned char thomheader[] = {
     
    5152
    5253  // End marker block : type=255, size and address=0
    53   const unsigned char end[]={255,0,0,0,0};
     54  static const unsigned char end[]={255,0,0,0,0};
    5455
    5556  if(argc < 3)
    5657  {
    5758    printf("Utilisation : %s [options] input_filename output_filename\n",argv[0]);
     59        printf("Option -m s: Mode to use (bm16/40c)\n");
    5860        printf("Option -t: use TO transcoding.\n");
    5961        printf("Option -f n: use modified algorithm to avoid artifacts on some MO5 gate array versions. n is the index of the background color.\n");
     
    6163  }
    6264
    63   while((opt = getopt(argc, argv, "tf:")) != -1) {
     65  fixup = -1;
     66  to = false;
     67  bitmap16 = false;
     68
     69  while((opt = getopt(argc, argv, "tf:m:")) != -1) {
    6470    switch(opt) {
    6571      case 't':
     
    7379                  fixup = atoi(optarg);
    7480                  break;
     81          case 'm':
     82                  if (strcmp(optarg, "bm16") == 0)
     83                          bitmap16 = true;
    7584        }
    7685  }
     
    153162  png_read_image(png_ptr, ptrRow);
    154163
    155   outBuffer = raw2mo5(inBuffer, height, fixup, to);
    156 
    157   pxsize = width * height / 8;
     164  if (bitmap16) {
     165        if (width != 160) {
     166                puts("Image not using the full screen width are not supported yet!");
     167                return ERROR;
     168        }
     169        outBuffer = raw2bm16(inBuffer, height);
     170        pxsize = width * height / 4;
     171  } else {
     172        if (width != 320) {
     173                puts("Image not using the full screen width are not supported yet!");
     174                return ERROR;
     175        }
     176        outBuffer = raw2mo5(inBuffer, height, fixup, to);
     177        pxsize = width * height / 8;
     178  }
     179
    158180  thomheader[7] = pxsize >> 8;
    159181  thomheader[8] = pxsize;
Note: See TracChangeset for help on using the changeset viewer.