コード例 #1
0
        private static void DrawLogo()
        {
            Assembly assembly = typeof(AsciiImage).Assembly;

            using (Stream stream = assembly.GetManifestResourceStream(
                       $"GrisaiaExtractorConsole.grisaia.ascii"))
            {
                AsciiImage logo = AsciiImage.FromStream(stream);
                if (Console.CursorLeft != 0)
                {
                    Console.WriteLine();
                }
                logo.Draw();
            }
        }
コード例 #2
0
        public static AsciiImage FromStream(Stream stream)
        {
            AsciiImage   image  = new AsciiImage();
            BinaryReader reader = new BinaryReader(stream);

            int width  = reader.ReadInt32();
            int height = reader.ReadInt32();

            image.Pixels = new Pixel[width, height];
            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    image.Pixels[x, y] = new Pixel(
                        reader.ReadByte(), reader.ReadByte());
                }
            }

            return(image);
        }