using System; using Autofac; using Chernobyl.App.Core; using Chernobyl.App.Layout; using Chernobyl.Config; using Chernobyl.Creation; using Chernobyl.Extensions; using Chernobyl.Graphics; using Chernobyl.Mathematics; using Chernobyl.Mathematics.Geometry; using Chernobyl.Mathematics.Vectors; namespace Chernobyl.App.Visual { /// /// Injects the visual services. /// public class Module : Autofac.Module { /// protected override void Load(ContainerBuilder builder) { builder.BindTemplateResourceAuto(); // The factory that creates visual patterns. builder.RegisterType() .As, IFactory>() .WithMetadata(c => c.For(fm => fm.CreationName, "Visual")) .SingleInstance(); // The method that determines the color of each pixel in the images created by VisualFactory. builder.Register(context => { // TODO: Add the following modules that can be connected together: // - A module that controls the composition of the image // - For example: putting more shading here than over there. // - A module that creates lines (probably using the shading module?) // - Add the ability to control chaotic nature of the the line return Func.StaticFactory(ColorHsla.Black) .To2D() .Replace(Plane.Predicate.Square((.3, .3), .4, .4), pos => ColorHsla.Red) .Select((hlsa, index, param) => (ColorRgba)hlsa); }).As>(); } } }