Ejemplo n.º 1
0
        public int[] DublicatePages(int[] source, int count, DuplicationType type = DuplicationType.EachPage)
        {
            var temp = new List <int>();

            switch (type)
            {
            case DuplicationType.EachPage:
                Log.Debug("Duplicating each pages");
                foreach (var t in source)
                {
                    for (int j = 0; j < count; j++)
                    {
                        temp.Add(t);
                    }
                }
                break;

            case DuplicationType.GroupPage:
                Log.Debug("Dublicating group pages");
                for (int i = 0; i < count; i++)
                {
                    temp.AddRange(source);
                }
                break;

            case DuplicationType.None:
            default:
                Log.Fatal("Duplication type are not is defined");
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }

            return(temp.ToArray());
        }
Ejemplo n.º 2
0
    void OnGUI()
    {
        GUILayout.Label("Image Duplicator Options", EditorStyles.boldLabel);
        BlackAndWhiteImage = EditorGUILayout.ObjectField("Image", BlackAndWhiteImage, typeof(Texture2D), true) as Texture2D;
        DupType            = (DuplicationType)EditorGUILayout.EnumPopup("Duplicate Per", DupType);
        duplicateOn        = EditorGUILayout.ObjectField("Dupicate on Mesh", duplicateOn, typeof(MeshFilter), true) as MeshFilter;
        offset             = EditorGUILayout.FloatField("Offset From Surface", offset);

        if (DupType == DuplicationType.Pixel)
        {
            density = EditorGUILayout.IntField("Samples Per Textre (odd)", density);
            GUILayout.Label(Information);
        }

        if (GUILayout.Button("Duplicate"))
        {
            if (DupType == DuplicationType.Vertex)
            {
                DuplicateImage();
            }
            else
            {
                DuplicatePerPixel();
            }
        }
    }
Ejemplo n.º 3
0
 public Task <int[]> DuplicatePageAsync(int[] source, int count,
                                        DuplicationType type = DuplicationType.EachPage)
 {
     return(Task <int[]> .Factory.StartNew(() => DublicatePages(source, count, type)));
 }