private static List <ImageInfos> getEmptyGridTemplate(Size PhotoSize, Padding PhotoMargin, Size PageSize, Padding PageMargin) { // TODO add template creation // TODO replace List<ImageInfos> with a real template class or struct int ncols = (int)((float)(PageSize.Width - PageMargin.Left - PageMargin.Right) / (float)PhotoSize.Width); int nrows = (int)((float)(PageSize.Height - PageMargin.Top - PageMargin.Bottom) / (float)PhotoSize.Height); List <PhotoPatchworkLibs.ImageInfos> Template = new List <PhotoPatchworkLibs.ImageInfos>(); for (int col = 0; col < ncols; col++) { for (int row = 0; row < nrows; row++) { ImageInfos ii = new ImageInfos(); // TODO use isEmpty instead of -1 detection ii.Crop = new Rectangle(-1, -1, -1, -1); ii.Region = new Rectangle((PhotoSize.Width + PhotoMargin.Left + PhotoMargin.Right) * col - PhotoMargin.Right, (PhotoSize.Height + PhotoMargin.Top + PhotoMargin.Bottom) * row - PhotoMargin.Bottom, PhotoSize.Width, PhotoSize.Height); Template.Add(ii); } } return(Template); }
private void PictureButtonDelete(object sender, EventArgs e) { PictureButton.PictureButton pb = (PictureButton.PictureButton)sender; ImageInfos pi = pb.ImageInfos; pi.Path = null; pb.ImageInfos = pi; }
private void PictureButtonOpen(object sender, EventArgs e) { PictureButton.PictureButton pb = (PictureButton.PictureButton)sender; if (openFileDialog.ShowDialog() == DialogResult.OK) { ImageInfos ii = pb.ImageInfos; ii.Path = openFileDialog.FileName; pb.ImageInfos = ii; } }
/// <summary> /// Update all the System Level Codes from Classic RMS. /// These are the codes that do not belong to a specific agency. /// </summary> public static void UpdateFromClassicRms(string classicRmsConnectionString) { // Update the Violation Codes from the Classic RMS Database ViolationCodes.UpdateFromClassicRms(classicRmsConnectionString); // Update the NCIC Codes from the Classic RMS Database NCICCodes.UpdateFromClassicRms(classicRmsConnectionString); // Import the ImageInfo Codes from the Classic RMS Database ImageInfos.ImportFromClassicRms(classicRmsConnectionString); }
private void DocumentPrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { e.Graphics.PageUnit = GraphicsUnit.Millimeter; foreach (Control pb in this.PagePanel.Controls) { ImageInfos ii = ((PictureButton.PictureButton)pb).ImageInfos; if (ii.Path != null) { Image image = Transforms.GetImageFromImageInfos(ii); e.Graphics.DrawImage(image, ii.Region); } } }
public void InitializeImages(ImageInfos imageInfos, PadControlImager imager, MapTo mappedTo) { Infos = imageInfos; Imager = imager; MappedTo = mappedTo; foreach (var ii in imageInfos) { var nameCode = GetNameCode(ii.Code); var button = FindName(nameCode.ToString()) as Button; ii.ButtonControl = button; SetImage(ii.Code, NavImageType.Normal, false); } SetHelpText(); }
void FillImageInfos() { Random rand = new Random(); foreach (string filePath in DataStorage.CitiesPhotoLibrary) { ImageInfos.Add(new ImageInfoViewModel() { ImageSource = filePath, FileName = string.Format("photo{0}.jpg", rand.Next(1000, 9999)), Rating = (double)rand.Next(5) + 1, IsVisible = true }); } }
public static void StoreImageInfoFunc() { var configObj = Resources.Load("Json/AnimationInfos"); var old_str = configObj.ToString(); using (var ms = new MemoryStream(Encoding.Unicode.GetBytes(old_str))) { var deseralizer = new DataContractJsonSerializer(typeof(ImageInfos)); old = (ImageInfos)deseralizer.ReadObject(ms);//反序列化ReadObject } characterInfos = new Dictionary <string, CharacterInfo>(); isShow = true; try { var dirs = Directory.GetDirectories(ImagePath, "*", SearchOption.TopDirectoryOnly); var list = dirs.ToList(); list.Add("Assets/Resources/Image/Effect"); for (int i = 0; i < list.Count; i++) { Progress = (float)i / (float)list.Count; currect_path = list[i]; EditorUtility.DisplayProgressBar("Progress", currect_path, Progress); var characterInfo = DealDir(list[i]); characterInfos.Add(characterInfo.characterName, characterInfo); } } catch (Exception e) { Debug.LogError(e.Message + '\n' + e.StackTrace); } EditorUtility.DisplayProgressBar("Progress", "Write In Json File", 1); CheckOldForceInfo(); WriteInJsonFile(); EditorUtility.ClearProgressBar(); isShow = false; Debug.Log("Store Image Info In Json File Over."); }
private TIPSImageInfo[] GetImageInfos(params int[] indices) { if (indices.Length != ImageInfos.Max(x => x.Index) + 1) { throw new Exception(); } TIPSImageInfo[] infos = new TIPSImageInfo[indices.Length]; for (int i = 0; i < infos.Length; i++) { // TODO: hacky! infos[i] = ImageInfos.Where(x => x.Index == i).Skip(indices[i]).FirstOrDefault(); if (infos[i] == null) { infos[i] = ImageInfos.LastOrDefault(x => x.Index == i); } } return(infos); }
private void GetImagePermutations(ref int[] indices, int t) { int numValues = ImageInfos.Where(x => x.Index == t).Count(); for (int v = 0; v < numValues; v++) { int[] stored = new int[indices.Length]; Array.Copy(indices, stored, indices.Length); ImagePermutations.Add(stored); indices[t]++; } if (t > 0 && indices[t - 1] != ImageInfos.Where(x => x.Index == t - 1).Count()) { indices[t - 1]++; indices[t] = 0; GetImagePermutations(ref indices, t); } }
private static void WriteInJsonFile() { var infos = new ImageInfos { infos = characterInfos }; var outputPath = resourcesPath + "Json/AnimationInfos.json"; //序列化 DataContractJsonSerializer js = new DataContractJsonSerializer(typeof(ImageInfos)); MemoryStream msObj = new MemoryStream(); //将序列化之后的Json格式数据写入流中 js.WriteObject(msObj, infos); msObj.Position = 0; //从0这个位置开始读取流中的数据 StreamReader sr = new StreamReader(msObj, Encoding.UTF8); string json = sr.ReadToEnd(); sr.Close(); msObj.Close(); using (StreamWriter sw = new StreamWriter(outputPath)) { sw.Write(json); } }
private DyldLoadedImage[] ReadLoadedImages() { return(ImageInfos.Select(i => new DyldLoadedImage(_dyldImage.VirtualAddressReader.Read <string>(i.PathAddress), i)).ToArray()); }
public PictureButton(ImageInfos pi) { InitializeComponent(); this._ImageInfos = pi; }
private void ApplyFilter() { ImageInfos.ForEach(x => x.IsVisible = x.Rating >= FilterRating); }