示例#1
0
        internal static Babl Create(string name,
                                    int id,
                                    bool hasLuma   = false,
                                    bool hasChroma = false,
                                    bool hasAlpha  = false,
                                    string doc     = "")
        {
            var value = db.Exists(id, name);

            if (id is not 0 && value is null && db.Exists(name) is not null)
            {
                Fatal.AlreadyRegistered(name, nameof(BablComponent));
            }

            if (value is not null)
            {
                // There is an instance already registerd by the required id/name,
                // returning the preexistent one instead if it doesn't differ.
                if (!((BablComponent)value).Equals(hasLuma, hasChroma, hasAlpha))
                {
                    Fatal.ExistsAsDifferentValue(name, nameof(BablComponent));
                }
                return(value);
            }
            value = new BablComponent(name, id, hasLuma, hasChroma, hasAlpha, doc);

            // Since there is not an already registered instance by the required
            // id/name, inserting newly created class into database.
            db.Insert(value);
            return(value);
        }
示例#2
0
        //public static Babl? Sampling(int horizontal, int vertical)
        //{

        //}

        public static Babl Component(string name) =>
        BablComponent.Find(name);
示例#3
0
 public static Babl CreateComponent(string name, int id, bool hasLuma = false, bool hasChroma = false, bool hasAlpha = false, string doc = "") =>
 BablComponent.Create(name, id, hasLuma, hasChroma, hasAlpha, doc);