public void UpdateProperties(SodaImage img, ImageProperties properties) { if (img == null) { propertyGrid1.SelectedObject = img; return; } propertyGrid1.SelectedObject = properties; CurrentProperties = properties; }
public void UpdateProperties(SodaImage img, MainForm form) { _parentForm = form; if (img == null) { propertyGrid1.SelectedObject = img; CurrentProperties = null; return; } var properties = new ImageProperties() { Height = img.Height, Width = img.Width, PlacementX = img.PlacementX, PlacementY = img.PlacementY, Size = img.Size, Position = img.Position }; propertyGrid1.SelectedObject = properties; CurrentProperties = properties; }
public void ConvertWilTask(string file, string dest) { SelectedWil = new WilLibrary(file); var countimg = SelectedWil.Images.Count(); SelectedWil = null; var title = Path.GetFileNameWithoutExtension(file); SodaImageLibrary lib = new SodaImageLibrary(title + ".slib"); WilLibrary wil = new WilLibrary(file); for (int i = 0; i < countimg - 1; i++) { var wilimg = wil.GetCachedImage(i); if (wilimg != null) { var image = new SodaImage(); image.Height = wil.Images[i].Height; image.Width = wil.Images[i].Width; image.PlacementX = wil.Images[i].PlacementX; image.PlacementY = wil.Images[i].PlacementY; using (var img = new MagickImage((Bitmap)wilimg)) { tryagain: try { img.Transparent(MagickColors.Black); var newimg = img.ToBitmap(); image.Image = newimg; } catch (Exception ex) { var stop = true; goto tryagain; } } lib.Images.Add(image); } else { var image = new SodaImage(); image.Height = 0; image.Width = 0; image.PlacementX = 0; image.PlacementY = 0; image.Image = null; lib.Images.Add(image); } } lib.WriteToBinaryFile(dest + "\\" + title + ".slib", lib, false); foreach (var img in lib.Images) { img.FreeImages(); } }