static void Main(string[] args) { Console.OutputEncoding = Encoding.Default; Console.WriteLine($"\u001b[38;2;128;20;196m\u2580\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588\u2589\u258A\u258B\u258C\u258D\u258E\u258F\u2590\u2591\u2592\u2593\u2594\u2595\u2596\u2597\u2598\u2599\u259A\u259B\u259C\u259D\u259E\u259F\u2615\u26Be\u001b[38;2;128;128;128m"); Console.WriteLine($"\u001b[38;2;128;20;196m\u2580\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588\u2589\u258A\u258B\u258C\u258D\u258E\u258F\u2590\u2591\u2592\u2593\u2594\u2595\u2596\u2597\u2598\u2599\u259A\u259B\u259C\u259D\u259E\u259F\u2615\u26Be\u001b[38;2;128;128;128m"); Console.WriteLine($"\u001b[38;2;128;20;196m\u2580\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588\u2589\u258A\u258B\u258C\u258D\u258E\u258F\u2590\u2591\u2592\u2593\u2594\u2595\u2596\u2597\u2598\u2599\u259A\u259B\u259C\u259D\u259E\u259F\u2615\u26Be\u001b[38;2;170;170;170m"); Console.WriteLine("▀▁▂▃▄▅▆▇█▉▊▋▌▍▎▏▐░▒▓▔▕▖▗▘▙▚▛▜▝▞▟☕⚾"); MP3 mp3 = new MP3(); //mp3.Decode($@"C:\Users\johnr\Downloads\MBR\warez.zip\Mp3\Contra.mp3"); mp3.Decode($@"C:\Users\johnr\Documents\outputWave1-ABR-192.mp3"); return; DirectoryInfo directoryInfo = new DirectoryInfo($@"c:\users\johnr\pictures"); //foreach (var file in directoryInfo.GetFiles()) //{ // if (new string[] { ".jpg", ".jpeg", ".jfif" }.Contains(file.Extension.ToLower())) // { // Console.WriteLine($"File: {file.FullName}"); // JPEG jpg = new JPEG(file.FullName); // } //} //JPEG jpeg = new JPEG($@"c:\users\johnr\pictures\Calculator1.jpg"); JPEG jpeg = new JPEG($@"c:\users\johnr\pictures\68518b2cd5485d576cc34355ffb0027d.jpg"); return; GIF gif = new GIF($@"c:\users\johnr\pictures\Calculator1.gif"); LZW lzw = new LZW(); BMP bmp = new BMP($@"c:\users\johnr\pictures\3Sphere_2c.bmp"); directoryInfo = new DirectoryInfo($@"c:\users\johnr\pictures"); foreach (var file in directoryInfo.GetFiles()) { if (file.Extension.ToLower() == ".png") { Console.WriteLine($"File: {file.FullName}"); PNG png = new PNG(file.FullName); var header = png.DataChunks.Where(x => x.ChunkType.ToLower() == "ihdr").FirstOrDefault(); var properties = (header.DataChunkRepresentation as PNG.DataChunk.HeaderChunkRepresentation).ToProperties(header.Data); //if ((byte)properties["ColorType"].Value == 6) // Console.ReadLine(); } } //Console.WriteLine("Enter PNG Filename:"); //string path = Console.ReadLine(); //PNG png = new PNG(path); }
private void btnStiToGif_Click(object sender, EventArgs e) { this.ofd.Filter = "GIF файлы (*.sti)|*.sti"; if (this.ofd.ShowDialog() == DialogResult.OK) { foreach (string _stiFileName in this.ofd.FileNames) { try { StciData stciData = new StciData(_stiFileName, 0); List <ExtendedBitmap> _bmps = new List <ExtendedBitmap>(); int _foreshorteningIndex = (int)this.nudForeshorteningIndex.Value; if (stciData._Indexed != null) { ETRLEData data = IndexedConverter.LoadIndexedImageData(stciData); _bmps = IndexedConverter.ConvertEtrleDataToBitmaps(data, _foreshorteningIndex); } else { StringBuilder _sb = new StringBuilder(); _sb.AppendLine(String.Format( "Не индексированный STI-файл {0}, конвертация в GIF невозможна.", _stiFileName)); _sb.AppendLine(); _sb.AppendLine(String.Format( "Not indexed STI-file {0}, convertation to STI is denied.", _stiFileName)); MessageBox.Show(_sb.ToString(), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string _gifFileName = Path.ChangeExtension(_stiFileName, "gif"); if (_foreshorteningIndex > 0) { string _fileNameWithoutExtention = Path.GetFileNameWithoutExtension(_stiFileName); string _path = Path.Combine(Path.GetDirectoryName(_stiFileName), _fileNameWithoutExtention); _gifFileName = String.Format("{0}_F_{1}.gif", _path, _foreshorteningIndex); } ushort _delay = (ushort)this.nudDelay.Value; bool _isTransparentBackground = this.chbTransparentBackground.Checked; GIF.ConvertBitmapsToGif(_bmps, _gifFileName, _delay, _isTransparentBackground, false); } catch (Exception exc) { string _excMessage = String.Format("{0}\n{1}\n{2}", _stiFileName, exc.Message, exc.StackTrace); ExceptionForm _excForm = new ExceptionForm(_excMessage); _excForm.ShowDialog(); //MessageBox.Show(_excMessage); } } } }
static void Main(string[] args) { int width = int.Parse(args[0]); int height = int.Parse(args[1]); int colors = int.Parse(args[2]); string path = args[3]; using (FileStream fs = new FileStream(path, FileMode.Create)) { GIF gif = new GIF() { Output = fs, ScreenWidth = width, ScreenHeight = height, GlobalColorTable = new GIF.ColorTable() { Table = new Color[colors], }, Debug = true, }; for (int n = 0; n < colors; ++n) { gif.GlobalColorTable.Table[n] = Color.FromArgb(n, n, n); } GIF.Image image = new GIF.Image() { ImageData = new byte[width * height], }; for (int n = 0; n < image.ImageData.Length; ++n) { image.ImageData[n] = (byte)(n % colors); } gif.Begin(); gif.WriteImage(image); gif.End(); fs.Flush(); } }
private void ConfigureScreen() { var navBar = BaseContentPage.Instance.ConfigureNavBar("", true, true); Progress progress = new Progress(1, 0, false); ViewModel.Progress = progress; Label instructionLabel = new Label { FontSize = 17, HorizontalTextAlignment = TextAlignment.Center, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.CenterAndExpand, TextColor = Color.Black, VerticalOptions = LayoutOptions.Start, }; instructionLabel.SetBinding(Label.TextProperty, new Binding(nameof(ViewModel.Instruction), converter: new ValueConverter(value => value.ToString().ToUpper()))); Label directionLabel = new Label { FontSize = 17, HorizontalTextAlignment = TextAlignment.Center, TextColor = Color.Black, FontAttributes = FontAttributes.Bold, Margin = 0 }; directionLabel.SetBinding(Label.TextProperty, new Binding(nameof(ViewModel.DirectionInstruction), converter: new ValueConverter(value => value.ToString().ToUpper()))); RoundedBorderedLabel roundedLabel = new RoundedBorderedLabel(directionLabel, ColorPalette.Pink, 3, Color.White, new Thickness(30, 1)) { VerticalOptions = LayoutOptions.Start, Margin = new Thickness(5, 5, 5, 0) }; GIF InstructionGIF = new GIF() { HorizontalOptions = LayoutOptions.CenterAndExpand, WidthRequest = App.ScreenWidth, MinimumHeightRequest = 50, VerticalOptions = LayoutOptions.FillAndExpand, }; InstructionGIF.SetBinding(GIF.GifSourceProperty, nameof(ViewModel.InstructionGIFSource)); Button measureSpaceButton = new Button { Text = "Medir vaga".ToUpper(), TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 17, BackgroundColor = ColorPalette.Pink, VerticalOptions = LayoutOptions.EndAndExpand, Margin = new Thickness(20, 0), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, Command = ViewModel.MeasureSpaceCommand, }; measureSpaceButton.SetBinding(IsVisibleProperty, new Binding(nameof(ViewModel.MeasuringSpace), converter: new ValueConverter((value) => !(bool)value))); Button endMeasurementButton = new Button() { TextColor = Color.White, FontAttributes = FontAttributes.Bold, FontSize = 17, BackgroundColor = ColorPalette.Pink, VerticalOptions = LayoutOptions.EndAndExpand, Margin = new Thickness(20, 0), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, Command = ViewModel.EndMeasurementCommand, }; endMeasurementButton.SetBinding(IsVisibleProperty, new Binding(nameof(ViewModel.MeasuringSpace))); Button cancelButton = new Button() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, Text = "cancelar".ToUpper(), VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.End, Margin = new Thickness(20, 5), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, FontSize = 14, FontAttributes = FontAttributes.Bold, Command = ViewModel.CancelMeasurementCommand }; Button jumpButton = new Button() { BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, Text = "pular medição".ToUpper(), VerticalOptions = LayoutOptions.EndAndExpand, HorizontalOptions = LayoutOptions.Start, Margin = new Thickness(20, 5), //Padding = new Thickness(12), BorderRadius = 18, HeightRequest = 55, FontSize = 14, FontAttributes = FontAttributes.Bold, Command = ViewModel.JumpMeasurementCommand }; Button teste = new Button() { BackgroundColor = ColorPalette.LightBlue, FontSize = 0, HorizontalOptions = LayoutOptions.End, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, BorderRadius = 50 }; RowDefinitions.Add(new RowDefinition() { Height = 60 }); RowDefinitions.Add(new RowDefinition() { Height = 50 }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); ColumnDefinitions.Add(new ColumnDefinition() { Width = App.ScreenWidth }); //Grid.ColumnDefinitions.Add() Children.Add(navBar, 0, 0); Children.Add(progress, 0, 1); Children.Add(instructionLabel, 0, 2); Children.Add(roundedLabel, 0, 3); if (Storage.TrainingMode) { Children.Add(teste, 0, 3); } Children.Add(InstructionGIF, 0, 4); Children.Add(measureSpaceButton, 0, 5); Children.Add(endMeasurementButton, 0, 5); Children.Add(cancelButton, 0, 6); Children.Add(jumpButton, 0, 6); //if (App.IsAndroidSDKBelowMarshmallow) //{ ViewModel.PropertyChanged += (sender, e) => { Device.BeginInvokeOnMainThread(() => { try { if (Storage.TrainingMode) { if (teste.IsVisible && Models.Sensor.StatusChecked) { teste.IsVisible = false; teste.IsEnabled = false; } else if (!teste.IsVisible && Models.Sensor.StatusChecked) { teste.IsVisible = true; teste.IsEnabled = true; } } //sizeTypeInTime = DistanceManager.Instance.CalculateParkingSpaceSizeType(Math.Round(ViewModel.ParkingSpaceSize+0.1)); //ViewModel.CountMetters(Math.Round(ViewModel.ParkingSpaceSize)); //switch (sizeTypeInTime) //{ // case Models.ParkingSpaceSizeType.VeryEasy: // case Models.ParkingSpaceSizeType.Easy: // case Models.ParkingSpaceSizeType.Average: // endMeasurementButton.BackgroundColor = Color.Green; // break; // case Models.ParkingSpaceSizeType.Hard: // endMeasurementButton.BackgroundColor = Color.Orange; // break; // case Models.ParkingSpaceSizeType.VeryHard: // endMeasurementButton.BackgroundColor = Color.Gray; // break; // default: // endMeasurementButton.BackgroundColor = Color.Red; // break; //} measureSpaceButton.IsVisible = measureSpaceButton.IsVisible; endMeasurementButton.IsVisible = endMeasurementButton.IsVisible; if (e.PropertyName == nameof(ViewModel.DirectionInstruction)) { directionLabel.Text = ViewModel.DirectionInstruction.ToUpper(); } else if (e.PropertyName == nameof(ViewModel.InstructionGIFSource)) { InstructionGIF.GIFSource = ViewModel.InstructionGIFSource; } else if (e.PropertyName == nameof(ViewModel.Instruction)) { instructionLabel.Text = ViewModel.Instruction.ToUpper(); } else if (e.PropertyName == nameof(ViewModel.MeasuringSpace)) { endMeasurementButton.IsVisible = ViewModel.MeasuringSpace; measureSpaceButton.IsVisible = !ViewModel.MeasuringSpace; } else if (e.PropertyName == nameof(ViewModel.ParkingSpaceSize)) { endMeasurementButton.Text = $"Concluir medição ({Math.Round(ViewModel.ParkingSpaceSize, 0)} CM)"; //measureSpaceButton.Text = $"Medir Vaga \n({Math.Round(ViewModel.ParkingSpaceSize, 0)} CM)"; } } catch (System.Exception ex) { string title = this.GetType().Name + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name; BalizaFacil.App.Instance.UnhandledException(title, ex); } }); }; //} }
void Awake() { _gif = FindObjectOfType <GIF> (); _gif.gameObject.SetActive(false); }
private void ConfigureScreen() { //ServicesManager.Instance.SoundPlayer.StopSound(); //BackgroundColor = Color.White; NavBar = BaseContentPage.Instance.ConfigureNavBar("Conectando"); BoxView whiteBox = new BoxView() { BackgroundColor = Color.White }; BoxView lightBlueBox = new BoxView() { Color = ColorPalette.LightBlue }; CustomLabel text = new CustomLabel() { Margin = new Thickness(70, 15), BackgroundColor = Color.White, Text = "Conectando o sensor ao bluetooth".ToUpper(), FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, FontSize = 15, TextColor = Color.Black, }; //UI.Animation directionGIF = new UI.Animation(AnimationType.Wainting); GIF gif = new GIF() { //Source = ImageSource.FromFile("wainting.gif"), GIFSource = "loading", Aspect = Aspect.AspectFill, IsOpaque = true }; Button cancelButton = new Button() { TextColor = ColorPalette.Pink, Text = "Cancelar".ToLower(), HeightRequest = 60, BackgroundColor = Color.Transparent, Command = new Command(() => { Cancelled?.Invoke(); }) }; RowDefinitions.Add(new RowDefinition() { Height = new GridLength(60, GridUnitType.Auto) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto) }); Children.Add(gif, 0, 2); //Children.Add(directionGIF, 0, 2); Children.Add(whiteBox, 0, 0); Children.Add(NavBar, 0, 0); Children.Add(text, 0, 1); Children.Add(lightBlueBox, 0, 3); Children.Add(cancelButton, 1, 3); Grid.SetRowSpan(whiteBox, 2); Grid.SetColumnSpan(gif, 2); Grid.SetColumnSpan(whiteBox, 2); Grid.SetColumnSpan(NavBar, 2); Grid.SetColumnSpan(text, 2); Grid.SetColumnSpan(lightBlueBox, 2); NavBar.TitleLabel.HorizontalTextAlignment = TextAlignment.Center; NavBar.TitleLabel.VerticalOptions = LayoutOptions.CenterAndExpand; NavBar.TitleLabel.HorizontalOptions = LayoutOptions.CenterAndExpand; }
private List <ExtendedBitmap> getImageList(string fileName, int foreshorting) { if (fileName.EndsWith(".sti", StringComparison.InvariantCultureIgnoreCase)) { StciData stciData = new StciData(fileName, 0); infoData.Add(stciData); List <ExtendedBitmap> bm = new List <ExtendedBitmap>(); if (stciData._Indexed != null) { try { ETRLEData data = IndexedConverter.LoadIndexedImageData(stciData); bm = IndexedConverter.ConvertEtrleDataToBitmaps(data, foreshorting); infoEtrleData.Add(data); } catch (Exception exc) { MessageBox.Show(String.Format("{3} {0}/n{1}/n{2}", fileName, exc.Message, exc.StackTrace, Resources.GetString("LoadingError"))); } } else { ExtendedBitmap exBm = RGBConverter.GetBitmap(stciData); exBm.ApplicationData = null; bm.Add(exBm); } return(bm); } else if (fileName.EndsWith(".tif", StringComparison.InvariantCultureIgnoreCase)) { List <Bitmap> bitmaps = TIFF.ConvertTiffToBitmaps(fileName); return(bitmaps.ConvertAll <ExtendedBitmap>( delegate(Bitmap bm) { return new ExtendedBitmap(bm, 0, 0); })); } else if (fileName.EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase)) { List <ExtendedBitmap> result = new List <ExtendedBitmap>(); try { bool containsLocalPalette; result = GIF.ConvertGifToBitmaps(fileName, 0, out containsLocalPalette); if (containsLocalPalette) { MessageBox.Show(Resources.GetString("FileContainsLocaPalettes"), Resources.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception exc) { MessageBox.Show(exc.Message, //Resources.GetString("FileContainsLocaPalettes"), Resources.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(result); } else if (fileName.EndsWith(".bmp", StringComparison.InvariantCultureIgnoreCase)) { List <ExtendedBitmap> result = new List <ExtendedBitmap>(); Bitmap bm = new Bitmap(fileName); result.Add(new ExtendedBitmap(bm, 0, 0)); return(result); } else if (fileName.EndsWith(".pcx", StringComparison.InvariantCultureIgnoreCase)) { List <ExtendedBitmap> result = new List <ExtendedBitmap>(); Bitmap bm = new Bitmap(fileName); result.Add(new ExtendedBitmap(bm, 0, 0)); return(result); } else { return(null); } }
private void ConfigureScreen() { BackgroundColor = Color.White; float GIFRatio = 0.78409f; float GIFWidth = App.ScreenWidth * 0.5f; float GIFHeight = App.ScreenWidth * 0.5f / GIFRatio; RowDefinitions.Add(new RowDefinition() { Height = 60 }); // NavBar RowDefinitions.Add(new RowDefinition() { Height = (App.ScreenHeight - 60 - GIFHeight - 50) / 2 }); // Titulo //RowDefinitions.Add(new RowDefinition() { Height = 30 }); // RowDefinitions.Add(new RowDefinition() { Height = 50 }); RowDefinitions.Add(new RowDefinition() { Height = GIFHeight }); RowDefinitions.Add(new RowDefinition() { Height = (App.ScreenHeight - 60 - GIFHeight - 50) / 2 }); ColumnDefinitions.Add(new ColumnDefinition() { Width = App.ScreenWidth / 2 }); ColumnDefinitions.Add(new ColumnDefinition() { Width = App.ScreenWidth / 2 }); CustomNavBar navBar = BaseContentPage.Instance.ConfigureNavBar("", true, true); Label title = new Label() { Text = "Escolha sua vaga".ToUpper(), FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.End, Margin = new Thickness(70, 40), FontSize = 20, TextColor = Color.Black }; GIF left = new GIF() { WidthRequest = GIFWidth, HeightRequest = GIFHeight, GIFSource = "left_choice", Margin = new Thickness(5, 0, 0, 0), OnClickParameter = Direction.Left, OnClick = ViewModel.DirectionChoosed }; GIF right = new GIF() { WidthRequest = GIFWidth, HeightRequest = GIFHeight, GIFSource = "right_choice", Margin = new Thickness(0, 0, 5, 0), OnClickParameter = Direction.Right, OnClick = ViewModel.DirectionChoosed }; Label rightLabel = new Label() { Text = "Direita".ToUpper(), TextColor = Color.Black, FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.End, FontSize = 16, }; Label leftLabel = new Label() { Text = "Esquerda".ToUpper(), TextColor = Color.Black, FontAttributes = FontAttributes.Bold, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.End, FontSize = 16, }; Button checkTest = new Button { Text = "Modo de treinamento".ToUpper(), //Margin = new Thickness(70, 50), BackgroundColor = ColorPalette.LightBlue, TextColor = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.End, FontSize = 16, //Command = ChooseCarViewModel.checkTest, }; checkTest.Clicked += (sender, e) => { if (checkTest.Text == "Modo de treinamento".ToUpper()) { checkTest.Text = "Modo padrão".ToUpper(); StepViewModel.TrainingMode = true; } else { checkTest.Text = "Modo de treinamento".ToUpper(); StepViewModel.TrainingMode = false; } }; Children.Add(navBar, 0, 0); Children.Add(title, 0, 1); //Children.Add(checkTest); Children.Add(leftLabel, 0, 2); Children.Add(rightLabel, 1, 2); Children.Add(left, 0, 3); Children.Add(right, 1, 3); Grid.SetColumnSpan(navBar, 2); Grid.SetColumnSpan(title, 2); }
public void TinyGifTest() { using (MemoryStream stream = new MemoryStream()) { GIF gif = new GIF() { Output = stream, ScreenWidth = 1, ScreenHeight = 1, GlobalColorTable = new GIF.ColorTable() { Table = new Color[2] { Color.White, Color.Black } } }; gif.Begin(); gif.WriteImage(new GIF.Image() { ImageData = new byte[] { 0 }, }); gif.End(); int codeSize = 2; int clear = 1 << codeSize; int end = 1 + clear; byte[] got = stream.ToArray(); byte[] expected = new byte[] { // 0: Signature (byte)'G', (byte)'I', (byte)'F', (byte)'8', (byte)'9', (byte)'a', // 6: Logical screen descriptor 1, 0, 1, 0, 0xF0, 0, 49, // 13: Global Color Table 0xFF, 0xFF, 0xFF, 0, 0, 0, // 19: Graphic control extension 0x21, 0xF9, 0x04, 1 << 2, 0, 0, 0, 0, // 27: Image descriptor 0x2C, 0, 0, 0, 0, 1, 0, 1, 0, 0, // 37: Image data // 37: Minimum code size 2, // 38: Data block 2, (byte)(clear | 0 << 3 | (end << 6)), (byte)(end >> 2), // 41: Block terminator 0, // 42: Trailer 0x3B }; TestUtils.AreEqual(expected, got, "TinyGifTest"); } }
private void button3_Click(object sender, EventArgs e) { GIF.ConvertBitmapsToGif(this.movie, this.openFileDialog.FileName, (UInt16)this.nudTimeOut.Value, this.chbTransparent.Checked, !this.chbGlobalPalette.Checked); }