public bool Equals(DataFrameMeta other)
 {
     return(other.hash == hash &&
            other.spacing == spacing &&
            other.size == size &&
            other.rows == rows &&
            other.frames == frames);
 }
Example #2
0
        private static Point?GetFramePoint(DataFrameMeta meta, Bitmap bmp, int dataframe, int startX)
        {
            for (int x = startX; x < bmp.Width; x++)
            {
                for (int y = 0; y < meta.rows; y++)
                {
                    if (bmp.GetPixel(x, y).B == dataframe)
                    {
                        return(new Point(x, y));
                    }
                }
            }

            return(null);
        }
Example #3
0
        public static List <DataFrame> CreateFrames(DataFrameMeta meta, Bitmap bmp)
        {
            var dataFrames = new List <DataFrame>()
            {
                new DataFrame(new Point(0, 0), 0)
            };

            for (int dataframe = 1; dataframe < meta.frames; dataframe++)
            {
                var point = GetFramePoint(meta, bmp, dataframe, dataFrames.Last().point.X);
                if (point == null)
                {
                    break;
                }
                dataFrames.Add(new DataFrame(point.Value, dataframe));
            }

            return(dataFrames);
        }
Example #4
0
        public static void SaveConfiguration(Rectangle rect, System.Version addonVersion, DataFrameMeta meta, List <DataFrame> dataFrames)
        {
            var config = new DataFrameConfig
            {
                rect         = rect,
                addonVersion = addonVersion,
                meta         = meta,
                frames       = dataFrames
            };
            string output = JsonConvert.SerializeObject(config);

            File.WriteAllText(ConfigurationFilename, output);
        }