コード例 #1
0
ファイル: ProgramArgs.cs プロジェクト: hmms/xmemtft
        /// <summary>
        /// constructor
        /// </summary>

        public ProgramArgs(string[] args)
        {
            int    depth;
            string device;

            if (args.Length != 4 && args.Length != 5)
            {
                usage();
            }

            InputBitmapFilename  = args[0];
            OutputBitmapFilename = args[1];
            device = args[2];
            depth  = int.Parse(args[3]);

            if (args.Length == 5)
            {
                if (args[4].Equals("-c"))
                {
                    this.Compress = true;
                }
                else
                {
                    usage();
                }
            }
            else
            {
                this.Compress = false;
            }

            switch (device.ToLower())
            {
            case "hx8347a":
                this.TargetDevice = HX8347AConverter.createInstance(depth);
                break;

            case "ili9325":
                this.TargetDevice = ILI9325Converter.createInstance(depth);
                break;

            case "ili9325a":
                this.TargetDevice = ILI9325AConverter.createInstance(depth);
                break;

            case "ili9327":
                this.TargetDevice = ILI9327Converter.createInstance(depth);
                break;

            case "ili9481":
                this.TargetDevice = ILI9481Converter.createInstance(depth);
                break;

            case "mc2pa8201":
                this.TargetDevice = MC2PA8201Converter.createInstance(depth);
                break;

            case "lds285":
                this.TargetDevice = LDS285Converter.createInstance(depth);
                break;

            case "ssd1963":
                this.TargetDevice = SSD1963Converter.createInstance(depth);
                break;

            case "st7783":
                this.TargetDevice = ST7783Converter.createInstance(depth);
                break;

            default:
                throw new Exception(device + " is an unrecognised device");
            }
        }
コード例 #2
0
        /// <summary>
        /// constructor
        /// </summary>

        public ProgramArgs(string[] args)
        {
            int    depth;
            string device;

            if (args.Length < 4 || args.Length > 8)
            {
                usage();
            }

            InputBitmapFilename  = args[0];
            OutputBitmapFilename = args[1];
            device         = args[2];
            depth          = int.Parse(args[3]);
            this.Compress  = false;
            this.ByteOrder = Endianness.LittleEndian;
            this.Flip      = RotateFlipType.RotateNoneFlipNone;

            for (int i = 4; i < args.Length; i++)
            {
                if (args[i].Equals("-c"))
                {
                    this.Compress = true;
                }
                else if (args[i].Equals("-b"))
                {
                    this.ByteOrder = Endianness.BigEndian;
                }
                else if (args[i].Equals("-fx"))
                {
                    this.Flip = RotateFlipType.RotateNoneFlipX;
                }
                else if (args[i].Equals("-fy"))
                {
                    this.Flip = RotateFlipType.RotateNoneFlipY;
                }
                else if (args[i].Equals("-fxy"))
                {
                    this.Flip = RotateFlipType.RotateNoneFlipXY;
                }
                else if (args[i].Equals("-r90"))
                {
                    this.Rotate = RotateFlipType.Rotate90FlipNone;
                }
                else if (args[i].Equals("-r180"))
                {
                    this.Rotate = RotateFlipType.Rotate180FlipNone;
                }
                else if (args[i].Equals("-r270"))
                {
                    this.Rotate = RotateFlipType.Rotate270FlipNone;
                }
            }



            switch (device.ToLower())
            {
            case "hx8347a":
                this.TargetDevice = HX8347AConverter.createInstance(depth);
                break;

            case "hx8352a":
                this.TargetDevice = HX8352AConverter.createInstance(depth);
                break;

            case "ili9325":
                this.TargetDevice = ILI9325Converter.createInstance(depth);
                break;

            case "ili9327":
                this.TargetDevice = ILI9327Converter.createInstance(depth);
                break;

            case "ili9481":
                this.TargetDevice = ILI9481Converter.createInstance(depth);
                break;

            case "mc2pa8201":
                this.TargetDevice = MC2PA8201Converter.createInstance(depth);
                break;

            case "lds285":
                this.TargetDevice = LDS285Converter.createInstance(depth);
                break;

            case "ssd1963":
                this.TargetDevice = SSD1963Converter.createInstance(depth);
                break;

            case "st7783":
                this.TargetDevice = ST7783Converter.createInstance(depth);
                break;

            case "r61523":
                this.TargetDevice = R61523Converter.createInstance(depth);
                break;

            default:
                throw new Exception(device + " is an unrecognised device");
            }
        }