private void ShowPedestrians() { if (IsShowPedestrians) { // fix bug when application stop if focus was set on image without object if (!_frames.Any(x => x.IsVisible)) { IsShowPedestrians = false; if (IsShowFavorites) { IsShowFavorites = false; ShowFavorites(); } return; } IsShowFavorites = false; SelectedIndex = Frames.FindIndex(x => x.IsVisible); Frames = _frames.FindAll(x => x.IsVisible); UpdateUi(); } else { Frames = new List <Frame>(_frames); UpdateUi(); } }
private PlayerScore GetPreviousFramePlayerScore(RollScoreBase playerRollScore, Frame frame) { var frameIndex = Frames.FindIndex(x => x.FrameId == frame.FrameId); var previousFrame = Frames[frameIndex - 1]; var previousFramePlayerScore = GetPlayerScore(previousFrame, playerRollScore.PlayerId); return(previousFramePlayerScore); }
/// <summary> /// Returns the value of the frame with the specified frame id and value /// </summary> /// <param name="frameId"></param> /// <param name="frameValue"></param> /// <returns></returns> private string GetFrame(string frameId, string frameValue) { int index = -1; if ((index = Frames.FindIndex((f => f.Id == frameId && f.Value == frameValue))) > -1) { return(Frames[index].Value); } return(""); }
private void SetText(string frameId, string text) { int index = -1; if ((index = Frames.FindIndex((f => f.Id == frameId))) > -1) { Frames[index].Value = text; } else { Frames.Add(new Frame(frameId, "", text)); } }
public void AddToFavorites() { Frames[SelectedIndex].IsFavorite = !Frames[SelectedIndex].IsFavorite; if (IsShowFavorites) { IsShowPedestrians = false; //fix bug when application stop if focus was set on image without object if (!_frames.Any(x => x.IsFavorite)) { IsShowFavorites = false; ShowFavorites(); return; } SelectedIndex = Frames.FindIndex(x => x.IsFavorite); Frames = _frames.FindAll(x => x.IsFavorite); UpdateUi(); } }
public void ApplyAnimation(float time, float maxTime) { Sort(); int frameIndex = Math.Max(Frames.FindIndex(f => f.Frame >= time) - 1, 0); AnimationFrame frame = Frames[frameIndex]; AnimationFrame nextFrame = null; if (Repeat) { nextFrame = Frames[(frameIndex + 1) % Frames.Count]; } else if (frameIndex < Frames.Count - 1) { nextFrame = Frames[frameIndex + 1]; } else { return; } float diff = time - frame.Frame; float frameTime = nextFrame.Frame - frame.Frame; /*if (diff == 0) * { * Node.LocalTransform = frame.Transform.ToMatrix(); * } * else if (diff > 0)*/ float percent = diff / frameTime; if (Node.Name.Contains("$")) { Console.WriteLine(frameIndex + " - " + percent); } { //Matrix m1 = frame.Transform.ToMatrix(); //Matrix m2 = nextFrame.Transform.ToMatrix(); //Node.LocalTransform = Matrix.Lerp(m1,m2,percent); Node.LocalTransform = AnimationTransform.Lerp(frame.Transform, nextFrame.Transform, percent).ToMatrix(); } }
protected void LoadMetadata(string directory) { string[] lines = Exiftool.GetExifMetadata(directory); CultureInfo culture = new CultureInfo("en-US"); if (lines != null) { string TVtmp; string AVtmp; string SVtmp; double TVdenom; double TVnume; double tmpD; int tmpI; int f = -1; for (int i = 0; i < lines.Length; i++) { if (MainWorker.CancellationPending) { return; } if (lines[i].StartsWith("======== ")) { f = Frames.FindIndex(t => lines[i].ToLower() == "======== " + t.FilePath.ToLower().Replace(@"\", "/")); } else if (f >= 0) { if (lines[i].ToLower().StartsWith("aperturevalue")) { AVtmp = lines[i].Substring(lines[i].IndexOf(":") + 2); if (double.TryParse(AVtmp, NumberStyles.Any, culture, out tmpD)) { Frames[f].AVstring = AVtmp; Frames[f].Av = tmpD; Frames[f].Av = Math.Log(Math.Pow(Frames[f].Av, 2), 2); } else { Frames[f].Av = 0; Frames[f].AVstring = "N/A"; } } else if (lines[i].ToLower().StartsWith("shutterspeedvalue")) { TVtmp = lines[i].Substring(lines[i].IndexOf(":") + 2); if (TVtmp.Contains(@"/")) { if (double.TryParse(TVtmp.Substring(0, TVtmp.IndexOf(@"/")), NumberStyles.Any, culture, out TVnume) && double.TryParse(TVtmp.Substring(TVtmp.IndexOf(@"/") + 1), NumberStyles.Any, culture, out TVdenom)) { Frames[f].Tv = TVnume / TVdenom; Frames[f].TVstring = TVtmp; } else { Frames[f].TVstring = "N/A"; } } else if (double.TryParse(TVtmp, NumberStyles.Any, culture, out tmpD)) { Frames[f].Tv = tmpD; Frames[f].TVstring = TVtmp; } else { Frames[f].TVstring = "N/A"; } Frames[f].Tv = Math.Log(1 / Frames[f].Tv, 2); } else if (lines[i].ToLower().StartsWith("iso")) { SVtmp = lines[i].Substring(lines[i].IndexOf(":") + 2); if (int.TryParse(SVtmp, out tmpI)) { Frames[f].Sv = Math.Log(tmpI, 3.125f); Frames[f].SVstring = SVtmp; } else { Frames[f].SVstring = "N/A"; } } else if (lines[i].ToLower().StartsWith("wb_rggblevelsasshot")) { //string[] WBtmp = lines[i].Substring(lines[i].IndexOf(":") + 2).Split(' '); //int[] WBvals = new int[4] { Convert.ToInt32(WBtmp[0]), Convert.ToInt32(WBtmp[1]), Convert.ToInt32(WBtmp[2]), Convert.ToInt32(WBtmp[3]) }; //LTODO: calc the resulting brightness steps and write to Frames[f].WB } else if (lines[i].ToLower().StartsWith("colorspace")) { string colspace = lines[i].Substring(lines[i].IndexOf(":") + 2).ToLower().Replace(" ", ""); switch (colspace) { case "adobergb": Frames[f].ColorSpace = new RGBColorspaceAdobeRGB(); break; case "widegamut": case "widegamutrgb": case "adobewidegamut": case "adobewidegamutrgb": Frames[f].ColorSpace = new RGBColorspaceWideGamutRGB(); break; case "ciergb": Frames[f].ColorSpace = new RGBColorspaceCIERGB(); break; case "prophotorgb": case "prophoto": Frames[f].ColorSpace = new RGBColorspaceProPhotoRGB(); break; case "srgb": default: Frames[f].ColorSpace = new RGBColorspacesRGB(); break; } } else if (lines[i].ToLower().StartsWith("imagesize")) { string[] tmp = lines[i].Substring(lines[i].IndexOf(":") + 2).Split('x'); if (int.TryParse(tmp[0], out tmpI)) { Frames[f].Width = tmpI; } else { Frames[f].Width = 1; } if (int.TryParse(tmp[1], out tmpI)) { Frames[f].Height = tmpI; } else { Frames[f].Height = 1; } } } if (f >= 0 && f < Frames.Count) { if (Frames[f].AVstring == "N/A" && Frames[f].TVstring == "N/A" && Frames[f].SVstring == "N/A") { Frames[f].HasMetadata = false; } else { Frames[f].HasMetadata = true; } //Brightness Value Frames[f].Bv = Frames[f].Av + Frames[f].Tv - Frames[f].Sv; } } } }