Ejemplo n.º 1
0
        public static Atlas BuildAtlas(IEnumerable <IIndexableTexture> textures, AtlasLayoutMode mode)
        {
            switch (mode)
            {
            case AtlasLayoutMode.Positional:
                return(BuildPositionalAtlas(textures));

            case AtlasLayoutMode.Indexed:
                return(BuildIndexedAtlas(textures));
            }

            throw new ArgumentOutOfRangeException("Unrecognized Atlas mode.");
        }
Ejemplo n.º 2
0
        public Atlas(Bitmap bmp, AtlasLayoutMode mode, IEnumerable <AtlasPointer> pointers)
        {
            if (bmp == null)
            {
                throw new ArgumentNullException("The bitmap parameter for the Atlas cannot be null.");
            }
            if (pointers == null)
            {
                throw new ArgumentNullException("The pointers list for the Atlas cannot be null.");
            }

            SortedPointers = new SortedList <long, AtlasPointer>(4096);
            foreach (AtlasPointer pointer in pointers)
            {
                SortedPointers.Add(pointer.Id, pointer);
            }

            Data       = bmp;
            LayoutMode = mode;
        }