Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace TI3ParserLib
- {
- public sealed class Filter
- {
- public Shape Appearance { get; private set; }
- public string Name { get; private set; }
- public List<Property> Properties { get; private set; }
- public string Category { get; private set; }
- public Connection Connections { get; private set; }
- public Filter(string name, string cat, Connection connections, Shape look = Shape.Square, params Property[] props)
- {
- this.Name = name;
- this.Category = cat;
- this.Appearance = look;
- this.Properties = new List<Property>(props);
- this.Connections = connections;
- }
- }
- public sealed class Property
- {
- public Type T { get; private set; } // string, double, int or enum
- public string Name { get; private set; }
- public object Value { get; set; }
- public Property(string name, Type t, object val)
- {
- this.Name = name;
- this.T = t;
- this.Value = val;
- }
- public static Property Make<T>(string name, T value)
- {
- return new Property(name, typeof(T), value);
- }
- }
- public enum Shape
- {
- Square, Circle, Diamond, Pentagon, PentagonInv, Parallelogram
- }
- public static class Plugins
- {
- public static List<Filter> GetFilters()
- {
- List<Filter> f = new List<Filter>();
- // global meta-filters
- f.Add(new Filter("Filetype", "Global", Connection.None, Shape.Square, Property.Make("Output type", Filetype._3DL2)));
- f.Add(new Filter("Parameters", "Global", Connection.None, Shape.Square, Property.Make("Parameters string", "")));
- f.Add(new Filter("Compression", "Global", Connection.None, Shape.Square, Property.Make("Method", CompressionMethod.LZO)));
- // value properties
- f.Add(new Filter("Input range", "Global", Connection.None, Shape.Square, Property.Make("Range", Range.Limited)));
- f.Add(new Filter("Output range", "Global", Connection.None, Shape.Square, Property.Make("Range", Range.Limited)));
- f.Add(new Filter("Input depth", "Global", Connection.None, Shape.Square, Property.Make("Channel A", 8), Property.Make("Channel B", 8), Property.Make("Channel C", 8)));
- f.Add(new Filter("Output depth", "Global", Connection.None, Shape.Square, Property.Make("Output depth", OutDepth._16)));
- // simple functions
- f.Add(new Filter("Invert", "Simple", Connection.Top | Connection.Bottom, Shape.Square));
- f.Add(new Filter("Constant (1)", "Simple", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Value", 0d)));
- f.Add(new Filter("Scale", "Simple", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Lower multiplier", 0d), Property.Make("Upper multiplier", 1d)));
- f.Add(new Filter("Clamp", "Simple", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Lower bound", 0d), Property.Make("Upper bound", 1d)));
- f.Add(new Filter("Gamma (PPC)", "Simple", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Gamma value", 2.2d), Property.Make("Invert", true)));
- // colorimetric functions
- f.Add(new Filter("Constant (3)", "Color", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Channel A", 0d), Property.Make("Channel B", 0d), Property.Make("Channel C", 0d)));
- f.Add(new Filter("Grayscale", "Color", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Primaries", Recommendation.BT709)));
- f.Add(new Filter("CalFile", "Color", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("File path", "")));
- f.Add(new Filter("LutFile", "Color", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("File path", "")));
- f.Add(new Filter("ICC (Single)", "Color", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("File path", ""), Property.Make("Rendering intent", RenderingIntent.Absolute)));
- f.Add(new Filter("ICC (Link)", "Color", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Source profile", ""), Property.Make("Destination profile", ""), Property.Make("Rendering intent", RenderingIntent.Absolute)));
- // XYZ
- f.Add(new Filter("RGB -> XYZ", "Color", Connection.Top | Connection.Bottom, Shape.Square,
- Property.Make("Red Primary X", ColorSpace.BT709.RedX), Property.Make("Red Primary Y", ColorSpace.BT709.RedY),
- Property.Make("Green Primary X", ColorSpace.BT709.GreenX), Property.Make("Green Primary Y", ColorSpace.BT709.GreenY),
- Property.Make("Blue Primary X", ColorSpace.BT709.BlueX), Property.Make("Blue Primary Y", ColorSpace.BT709.BlueY),
- Property.Make("White Primary X", ColorSpace.BT709.WhiteX), Property.Make("White Primary Y", ColorSpace.BT709.WhiteY)));
- f.Add(new Filter("XYZ -> RGB", "Color", Connection.Top | Connection.Bottom, Shape.Square,
- Property.Make("Red Primary X", ColorSpace.BT709.RedX), Property.Make("Red Primary Y", ColorSpace.BT709.RedY),
- Property.Make("Green Primary X", ColorSpace.BT709.GreenX), Property.Make("Green Primary Y", ColorSpace.BT709.GreenY),
- Property.Make("Blue Primary X", ColorSpace.BT709.BlueX), Property.Make("Blue Primary Y", ColorSpace.BT709.BlueY),
- Property.Make("White Primary X", ColorSpace.BT709.WhiteX), Property.Make("White Primary Y", ColorSpace.BT709.WhiteY)));
- // multiplexer
- f.Add(new Filter("Multiplex", "Channel", Connection.Top | Connection.Left | Connection.Right | Connection.Bottom, Shape.Square));
- f.Add(new Filter("Combine", "Channel", Connection.Top | Connection.Left | Connection.Right | Connection.Bottom, Shape.Square));
- f.Add(new Filter("Swap", "Channel", Connection.Top | Connection.Bottom, Shape.Square, Property.Make("Swap mode", SwapMode.AB)));
- return f;
- }
- /*
- private sealed class Plugin
- {
- public string filename;
- }*/
- }
- public enum Filetype
- {
- _3DLUT, _3DL2
- }
- public enum OutDepth
- {
- _8, _16, _32, _64
- }
- [Flags]
- public enum Connection : int
- {
- None = 0x00,
- Top = 0x01,
- Bottom = 0x02,
- Left = 0x04,
- Right = 0x08
- }
- }
Add Comment
Please, Sign In to add comment