Example #1
0
        private void openIMG(string path)
        {
            var img = BCLIM.makeBMP(path, CHK_PNG.Checked);

            if (img == null)
            {
                return;
            }
            PB_BCLIM.Size            = new Size(img.Width + 2, img.Height + 2);
            PB_BCLIM.BackgroundImage = img;
        }
Example #2
0
        // File Generation
        public void makeBMP(string path)
        {
            BCLIM.CLIM bclim = BCLIM.analyze(path);
            GB_Details.Visible = true;
            L_Details.Text     = String.Format("{1}{0}{2}{0}{3}{0}{4}{0}{5}", Environment.NewLine,
                                               bclim.FileFormat, bclim.Width, bclim.Height, bclim.TileWidth, bclim.TileHeight);

            var img = BCLIM.makeBMP(path, CHK_AutoSavePNG.Checked, !CHK_NoCrop.Checked);

            if (img == null)
            {
                return;
            }
            showPaletteBox(bclim);
            PB_BCLIM.Image = img;
        }
Example #3
0
        private void openIMG(string path)
        {
            var img = BCLIM.makeBMP(path, CHK_PNG.Checked);

            if (img == null)
            {
                try
                {
                    var flim = new BFLIM(path);
                    if (!flim.Footer.Valid)
                    {
                        return;
                    }
                    img = flim.GetBitmap();
                }
                catch (Exception ree)
                {
                    Console.WriteLine(ree.Message);
                    return;
                }
                if (CHK_PNG.Checked)
                {
                    var dir     = Path.GetDirectoryName(path);
                    var fn      = Path.GetFileNameWithoutExtension(path);
                    var outpath = Path.Combine(dir, $"{fn}.png");
                    img.Save(outpath);
                }
            }
            PB_BCLIM.Size            = new Size(img.Width + 2, img.Height + 2);
            PB_BCLIM.BackgroundImage = img;
            int leftpad        = PB_BCLIM.Location.X;
            int suggestedWidth = leftpad * 2 + PB_BCLIM.Width + 10;

            if (Width < suggestedWidth)
            {
                Width = suggestedWidth;
            }

            int suggestedHeight = PB_BCLIM.Location.Y + PB_BCLIM.Height + leftpad + 30;

            if (Height < suggestedHeight)
            {
                Height = suggestedHeight;
            }
        }