/// <summary> /// Load texture data from a raw byte array (BGRA 32bit format) /// </summary> public override void SetData(byte[] data, int level = 0, PixelFormat format = PixelFormat.Rgba) { Debug.Assert(!isDisposed); lock (this) { formatToBeUploaded = format; levelToBeUploaded = level; dataToBeUploaded = data; } }
public void SetData(byte[] data, Rectangle bounds, int level = 0, PixelFormat format = PixelFormat.Rgba) { Debug.Assert(!isDisposed); lock (this) { if (dataToBeUploaded != null) { FreeBuffer(dataToBeUploaded); } formatToBeUploaded = format; levelToBeUploaded = level; boundsToBeUploaded = bounds; dataToBeUploaded = data; IsTransparent = false; QueueForUpload(); } }
/// <summary> /// Load texture data from a raw IntPtr location (BGRA 32bit format) /// </summary> public void SetData(IntPtr dataPointer, int level = 0, PixelFormat format = 0) { Debug.Assert(!isDisposed); if (format == 0) { format = PixelFormat.Rgba; } byte[] data; if (dataPointer == IntPtr.Zero) { data = new byte[0]; } else { data = ReserveBuffer(Width * Height * 4); Marshal.Copy(dataPointer, data, 0, data.Length); } SetData(data, level, format); }
/// <summary> /// Load texture data from a raw byte array (BGRA 32bit format) /// </summary> public override void SetData(byte[] data, int level = 0, PixelFormat format = PixelFormat.Rgba) { Debug.Assert(!isDisposed); SetData(data, new Rectangle(0, 0, width, height), level, format); }
/// <summary> /// Load texture data from a raw byte array (BGRA 32bit format) /// </summary> public abstract void SetData(byte[] data, int level = 0, PixelFormat format = PixelFormat.Rgba);