public bool ParseFiles(string lfdir) { spriteList.Clear(); string dat = scintilla.Text; int begin = dat.IndexOf("<bmp_begin>"), end = dat.IndexOf("<bmp_end>", begin + 11); if (begin < 0 || end < 0) { return(false); } string script = dat.Substring(begin + 11, end - begin); MatchCollection matches = Regex.Matches(script, SpriteSheet.regexPattern); if (matches.Count < 1) { return(false); } for (int i = 0; i < matches.Count; i++) { string path = lfdir + "\\" + matches[i].Groups[3].Value.Trim(); Bitmap img = HelperTools.GetClonedBitmap(path); img.Tag = Path.GetFileName(path); int si = int.Parse(matches[i].Groups[1].Value.Trim()), ei = int.Parse(matches[i].Groups[2].Value.Trim()), w = int.Parse(matches[i].Groups[4].Value.Trim()), h = int.Parse(matches[i].Groups[5].Value.Trim()), r = int.Parse(matches[i].Groups[6].Value.Trim()), c = int.Parse(matches[i].Groups[7].Value.Trim()); SpriteSheet fm = new SpriteSheet(si, ei, img.Tag as string, img, w, h, c, r); spriteList.Add(fm); } return(true); }
public FormTransparencyTools(string path, MainForm main) { InitializeComponent(); mainForm = main; Bitmap img = HelperTools.GetClonedBitmap(path); bmp = new Bitmap(img.Width, img.Height, PixelFormat.Format32bppRgb); using (Graphics g = Graphics.FromImage(bmp)) g.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height)); original = (Bitmap)bmp.Clone(); this.path = path; }
public FormSpriteMirrorer(string path, MainForm main) { InitializeComponent(); mainForm = main; foreach (string rft in RotateFlipType.GetNames(typeof(RotateFlipType))) { comboBox_Mode.Items.Add(rft); } drawBox_OriginalSprite.Image = original = HelperTools.GetClonedBitmap(path); drawBox_ModifedSprite.Image = (Bitmap)original.Clone(); this.path = Path.GetDirectoryName(path) + "\\" + Path.GetFileNameWithoutExtension(path) + "_mirror" + Path.GetExtension(path); }
public FormImageSaver(string path, bool checkFormat, MainForm main) : this(HelperTools.GetClonedBitmap(path), path, checkFormat, main) { }