using PixiEditorDotNetCore3.Models.Tools; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; namespace PixiEditorDotNetCore3.Models { public static class LayerGenerator { /// /// Generating useable layer with image and bitmap /// /// Width of layer. /// Height of layer. /// public static Layer Generate(int imageWidth, int imageHeight) { return new Layer(GenerateBitmap(imageWidth, imageHeight)); } public static LightLayer GenerateWithByteArray(int width, int height) { WriteableBitmap bitmap = GenerateBitmap(width, height); return new LightLayer(bitmap.ToByteArray(), height, width); } /// /// Generates bitmap ready to work with /// /// Width of bitmap. /// Height of bitmap. /// private static WriteableBitmap GenerateBitmap(int bitmapWidth, int imageHeight) { WriteableBitmap bitmap = BitmapFactory.New(bitmapWidth, imageHeight); bitmap.Clear(Colors.Transparent); return bitmap; } } }