WriteableBitmap
Holds a mutable bitmap copy and exposes its pixel data through the diagram's bitmap compatibility API.
Definition
Namespace:Telerik.WinControls.UI.Diagrams
Assembly:Telerik.WinControls.RadDiagram.dll
Syntax:
public sealed class WriteableBitmap : BitmapSource
Inheritance: objectBitmapSourceWriteableBitmap
Constructors
Creates a copy from a supported diagram bitmap source.
public WriteableBitmap(BitmapSource image)
A WriteableBitmap or a BitmapImage with an assigned stream.
Other BitmapSource implementations are not handled and leave Bitmap null.
Creates an independent bitmap copy of the specified image.
Creates a blank bitmap with the specified dimensions and pixel format.
public WriteableBitmap(int width, int height, int dpiX, int dpiY, PixelFormat pixelFormat)
The bitmap width in pixels.
heightintThe bitmap height in pixels.
dpiXintAccepted for API compatibility; it does not set the bitmap resolution.
dpiYintAccepted for API compatibility; it does not set the bitmap resolution.
pixelFormatPixelFormatThe pixel format to use. Unsupported formats fall back to 32-bit ARGB.
Creates an independent copy of another writable bitmap.
public WriteableBitmap(WriteableBitmap writeableBitmap)
The bitmap to copy.
Properties
Gets the backing bitmap. Changes made to this object affect this WriteableBitmap.
public Bitmap Bitmap { get; }
Gets the color entries copied from the bitmap's palette during initialization.
public Color[] Colors { get; }
Gets the compatibility pixel format corresponding to the backing bitmap's format; unrecognized formats are reported as Bgra32.
public PixelFormat Format { get; }
Gets the backing bitmap height in pixels.
public int PixelHeight { get; }
Gets the backing bitmap bytes grouped into four-byte integer values.
public IEnumerable<int> Pixels { get; }
Gets the backing bitmap width in pixels.
public int PixelWidth { get; }
Methods
Copies the backing bitmap data into four-byte integer values.
public void CopyPixels(int[] pixels, int stride, int offset)
The destination array for packed pixel values.
strideintThe stride used while creating an intermediate byte copy; it does not determine the final integer grouping.
offsetintThe offset used for the intermediate byte copy. An out-of-range offset can cause an indexing exception.
The intermediate copy is discarded. The destination values are grouped from the start of the bitmap buffer, so valid stride and offset values do not change the final grouping.
Copies integer pixel data into the backing bitmap buffer.
public void WritePixels(Rect rect, int[] pixels, int stride, int offset)
Ignored by this implementation; the write starts at the beginning of the bitmap buffer.
pixelsint[]The source pixel values.
strideintThe number of bytes per row in the copied data.
offsetintThe starting byte offset in the source data.
The current implementation does not use
rectto limit the affected pixels.