예제 #1
0
 public void SetName(Screen screen, WatchZone watchZone, Watcher watcher)
 {
     _Name = screen.Name + "/" + watchZone.Name + "/" + watcher.Name + " - " + FileName;
 }
예제 #2
0
 internal WatchImage(Watcher watcher, string filePath)
 {
     Watcher  = watcher;
     FilePath = filePath;
 }
        public static void Compile(GameProfile gameProfile, bool useExtremePrecision)
        {
            if (CWatchZones != null)
            {
                foreach (var cWatchZone in CWatchZones)
                {
                    cWatchZone.Dispose();
                }
                Array.Clear(CWatchZones, 0, CWatchZones.Length);
            }
            HasDupeCheck        = false;
            UseExtremePrecision = useExtremePrecision;

            var cWatchZones = new CWatchZone[gameProfile.WatchZones.Count];
            var indexCount  = 0;

            for (int i1 = 0; i1 < gameProfile.WatchZones.Count; i1++)
            {
                WatchZone watchZone = gameProfile.WatchZones[i1];
                Screen    screen    = watchZone.Screen;

                var CWatches = new CWatcher[watchZone.Watches.Count];

                var gameGeo   = screen.GameGeometry.HasSize ? screen.GameGeometry : screen.Geometry;
                var wzCropGeo = watchZone.WithoutScale(gameGeo);
                wzCropGeo.RemoveAnchor(gameGeo);
                wzCropGeo.ResizeTo(screen.CropGeometry, gameGeo);
                wzCropGeo.Update(screen.CropGeometry.X, screen.CropGeometry.Y);

                for (int i2 = 0; i2 < watchZone.Watches.Count; i2++)
                {
                    Watcher watcher = watchZone.Watches[i2];

                    if (watcher.WatcherType == WatcherType.Standard)
                    {
                        var CWatchImages = new CWatchImage[watcher.WatchImages.Count];

                        for (int i3 = 0; i3 < watcher.WatchImages.Count; i3++)
                        {
                            WatchImage watchImage = watcher.WatchImages[i3];
                            var        mi         = new MagickImage(watchImage.Image)
                            {
                                ColorSpace = watcher.ColorSpace
                            };
                            GetComposedImage(ref mi, watcher.Channel);
                            if (!UseExtremePrecision)
                            {
                                StandardResize(ref mi, wzCropGeo.ToMagick(false));
                            }
                            else
                            {
                                PreciseResize(ref mi, watchZone.Geometry, gameGeo);
                            }
                            if (watcher.Equalize)
                            {
                                mi.Equalize();
                            }

                            CWatchImages[i3] = new CWatchImage(watchImage.Name, indexCount, mi);
                            indexCount++;
                        }

                        CWatches[i2] = new CWatcher(CWatchImages, watcher);
                    }
                    else if (watcher.WatcherType == WatcherType.BestMatch)
                    {
                        var mic = new MagickImageCollection();
                        for (int i3 = 0; i3 < watcher.WatchImages.Count; i3++)
                        {
                            WatchImage watchImage = watcher.WatchImages[i3];
                            var        mi         = new MagickImage(watchImage.FilePath)
                            {
                                ColorSpace = watcher.ColorSpace
                            };
                            GetComposedImage(ref mi, watcher.Channel);
                            if (!UseExtremePrecision)
                            {
                                StandardResize(ref mi, wzCropGeo.ToMagick(false));
                            }
                            else
                            {
                                PreciseResize(ref mi, watchZone.Geometry, gameGeo);
                            }
                            if (watcher.Equalize)
                            {
                                mi.Equalize();
                            }

                            //CWatchImages[i3] = new CWatchImage(watchImage.Name, indexCount, mi);
                            indexCount++;
                        }
                    }
                    else if (watcher.WatcherType == WatcherType.DuplicateFrame)
                    {
                        HasDupeCheck = true;
                    }
                }

                cWatchZones[i1] = new CWatchZone(watchZone.Name, wzCropGeo, CWatches);
            }

            CWatchZones = cWatchZones;
        }