public static Image FrameSliceOf3DSpectrogram_ConstantMin(Bitmap bmp1, Image titleBar, int nyquistFreq, int minuteOfDay, FileInfo sunriseSetData) { int imageWidth = bmp1.Width; int imageHeight = bmp1.Height; Graphics g = Graphics.FromImage(bmp1); Pen pen = new Pen(Color.White); Font stringFont = new Font("Arial", 12); TimeSpan time = TimeSpan.FromMinutes(minuteOfDay); string str = string.Format("Time = {0}h:{1}m", time.Hours, time.Minutes); g.DrawString(str, stringFont, Brushes.Wheat, new PointF(10, 7)); int binCount = 512; if (imageHeight <= 256) { binCount = 256; } int lineCount = nyquistFreq / 1000; double gridLineInterval = 1000 / (nyquistFreq / (double)binCount); for (int i = 1; i <= lineCount; i++) { int y = imageHeight - (int)Math.Round(i * gridLineInterval); for (int x = 1; x < imageWidth; x++) { bmp1.SetPixel(x, y, Color.White); bmp1.SetPixel(x - 1, y, Color.Black); x++; } } AddDaylightMinutesToImage(bmp1, sunriseSetData, minuteOfDay); //TimeSpan xAxisPixelDuration = TimeSpan.FromSeconds(60); //var minOffset = TimeSpan.Zero; //SpectrogramTools.DrawGridLinesOnImage((Bitmap)bmp1, minOffset, X_interval, xAxisPixelDuration, 120, 10); const int trackHeight = 20; var timeScale12Months = ImageTrack.DrawYearScale_horizontal(imageWidth, trackHeight); var imageList = new List <Image> { titleBar, timeScale12Months, bmp1, timeScale12Months }; var compositeBmp = ImageTools.CombineImagesVertically(imageList.ToArray()); //imageWidth = compositeBmp.Height; //imageList = new List<Image>(); //imageList.Add(timeScale12Months); //imageList.Add(compositeBmp); //compositeBmp = ImageTools.CombineImagesInLine(imageList.ToArray()); return(compositeBmp); }
public static Image <Rgb24> FrameSliceOf3DSpectrogram_ConstantMin(Image <Rgb24> bmp1, Image <Rgb24> titleBar, int nyquistFreq, int minuteOfDay, FileInfo sunriseSetData) { int imageWidth = bmp1.Width; int imageHeight = bmp1.Height; Pen pen = new Pen(Color.White, 1); Font stringFont = Drawing.Arial12; TimeSpan time = TimeSpan.FromMinutes(minuteOfDay); string str = $"Time = {time.Hours}h:{time.Minutes}m"; bmp1.Mutate(g => { g.DrawText(str, stringFont, Color.Wheat, new PointF(10, 7)); }); int binCount = 512; if (imageHeight <= 256) { binCount = 256; } int lineCount = nyquistFreq / 1000; double gridLineInterval = 1000 / (nyquistFreq / (double)binCount); for (int i = 1; i <= lineCount; i++) { int y = imageHeight - (int)Math.Round(i * gridLineInterval); for (int x = 1; x < imageWidth; x++) { bmp1[x, y] = Color.White; bmp1[x - 1, y] = Color.Black; x++; } } AddDaylightMinutesToImage(bmp1, sunriseSetData, minuteOfDay); //TimeSpan xAxisPixelDuration = TimeSpan.FromSeconds(60); //var minOffset = TimeSpan.Zero; //SpectrogramTools.DrawGridLinesOnImage((Image<Rgb24>)bmp1, minOffset, X_interval, xAxisPixelDuration, 120, 10); const int trackHeight = 20; var timeScale12Months = ImageTrack.DrawYearScale_horizontal(imageWidth, trackHeight); var imageList = new [] { titleBar, timeScale12Months, bmp1, timeScale12Months }; var compositeBmp = ImageTools.CombineImagesVertically(imageList); //imageWidth = compositeBmp.Height; //imageList = new List<Image>(); //imageList.Add(timeScale12Months); //imageList.Add(compositeBmp); //compositeBmp = ImageTools.CombineImagesInLine(imageList.ToArray()); return(compositeBmp); }