Example #1
0
            /// <summary>
            /// Sets the layers pixel data in the ColorRgba format. Note that the specified data will be copied and thus modifying it
            /// outside won't affect the Layer it has been inserted into.
            /// </summary>
            /// <param name="pixelData"></param>
            /// <param name="width"></param>
            /// <param name="height"></param>
            public void SetPixelDataRgba(ColorRgba[] pixelData, int width = -1, int height = -1)
            {
                if (width < 0) width = this.width;
                if (height < 0) height = this.height;
                if (pixelData.Length != width * height) throw new ArgumentException("Data length doesn't match width * height", "pixelData");

                this.width = width;
                this.height = height;
                this.data = pixelData.Clone() as ColorRgba[];
            }