Class WriteableBitmapExtensions
Contains utility methods to draw shapes using WritableBitmap API's.
Inheritance
Namespace: Syncfusion.UI.Xaml.Charts
Assembly: Syncfusion.SfChart.UWP.dll
Syntax
public static class WriteableBitmapExtensions : Object
Methods
Clear(WriteableBitmap, Stream, Byte[])
Method implementation for clear values.
Declaration
public static void Clear(this WriteableBitmap bmp, Stream stream, byte[] pixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | Used to specifiy the Windows.UI.Xaml.Media.Imaging.WriteableBitmap. |
System.IO.Stream | stream | Used to specify the stream. |
System.Byte[] | pixels | Used to specify the pixel. |
Clear(WriteableBitmap, Stream, List<Int32>)
Method implementation for Clear values
Declaration
public static void Clear(this WriteableBitmap bmp, Stream stream, List<int> pixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | |
System.IO.Stream | stream | |
System.Collections.Generic.List<System.Int32> | pixels |
DrawLine(Stream, Int32, Int32, Int32, Int32, Int32, Int32, Color)
Draws a colored line by connecting two points using an optimized DDA. Uses the pixels array and the width directly for best performance.
Declaration
public static void DrawLine(Stream stream, int pixelWidth, int pixelHeight, int x1, int y1, int x2, int y2, Color uiColor)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | |
System.Int32 | pixelWidth | The width of one scanline in the pixels array. |
System.Int32 | pixelHeight | The height of the bitmap. |
System.Int32 | x1 | The x-coordinate of the start point. |
System.Int32 | y1 | The y-coordinate of the start point. |
System.Int32 | x2 | The x-coordinate of the end point. |
System.Int32 | y2 | The y-coordinate of the end point. |
Windows.UI.Color | uiColor |
DrawLine(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Color)
Method implementation for drawLine
Declaration
public static void DrawLine(this WriteableBitmap bmp, byte[] buffer, int x1, int y1, int x2, int y2, Color uiColor)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | |
System.Byte[] | buffer | |
System.Int32 | x1 | |
System.Int32 | y1 | |
System.Int32 | x2 | |
System.Int32 | y2 | |
Windows.UI.Color | uiColor |
DrawLine(WriteableBitmap, Stream, Int32, Int32, Int32, Int32, Int32, Color)
Method implementation for Drawline
Declaration
public static void DrawLine(this WriteableBitmap bmp, Stream stream, int x1, int y1, int x2, int y2, int color, Color uiColor)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | |
System.IO.Stream | stream | |
System.Int32 | x1 | |
System.Int32 | y1 | |
System.Int32 | x2 | |
System.Int32 | y2 | |
System.Int32 | color | |
Windows.UI.Color | uiColor |
DrawLine(WriteableBitmap, Stream, Int32, Int32, Int32, Int32, Color)
Draws a colored line by connecting two points using an optimized DDA.
Declaration
public static void DrawLine(this WriteableBitmap bmp, Stream stream, int x1, int y1, int x2, int y2, Color color)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.IO.Stream | stream | |
System.Int32 | x1 | The x-coordinate of the start point. |
System.Int32 | y1 | The y-coordinate of the start point. |
System.Int32 | x2 | The x-coordinate of the end point. |
System.Int32 | y2 | The y-coordinate of the end point. |
Windows.UI.Color | color | The color for the line. |
DrawLineAa(Int32[], Int32, Int32, Int32, Int32, Int32, Int32, Int32)
Draws an anti-aliased line, using an optimized version of Gupta-Sproull algorithm From http://nokola.com/blog/post/2010/10/14/Anti-aliased-Lines-And-Optimizing-Code-for-Windows-Phone-7e28093First-Look.aspx
An array containing the pixels as int RGBA value. The width of one scanline in the pixels array. The height of the bitmap. The x-coordinate of the start point. The y-coordinate of the start point. The x-coordinate of the end point. The y-coordinate of the end point. The color for the line.Declaration
public static void DrawLineAa(int[] pixels, int pixelWidth, int pixelHeight, int x1, int y1, int x2, int y2, int color)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | pixels | |
System.Int32 | pixelWidth | |
System.Int32 | pixelHeight | |
System.Int32 | x1 | |
System.Int32 | y1 | |
System.Int32 | x2 | |
System.Int32 | y2 | |
System.Int32 | color |
DrawLineAa(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>)
Method implementation for DrawLine.
Declaration
public static void DrawLineAa(this WriteableBitmap bmp, byte[] pixels, int pixelWidth, int pixelHeight, int x1, int y1, int x2, int y2, Color uiColor, List<int> seriesPixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | Used to indicate Windows.UI.Xaml.Media.Imaging.WriteableBitmap. |
System.Byte[] | pixels | Used to specify buffer for bitmap. |
System.Int32 | pixelWidth | Used to specify the width. |
System.Int32 | pixelHeight | Used to specify the height. |
System.Int32 | x1 | Used to specify x1. |
System.Int32 | y1 | Used to specify y1. |
System.Int32 | x2 | Used to specify x2. |
System.Int32 | y2 | Used to specify y2. |
Windows.UI.Color | uiColor | Used to specify color for bitmap. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
DrawLineAa(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>, Rect)
Draws an anti-aliased line.
Declaration
public static void DrawLineAa(this WriteableBitmap bmp, byte[] pixels, int pixelWidth, int pixelHeight, int x1, int y1, int x2, int y2, Color uiColor, List<int> seriesPixels, Rect clip)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | Used to indicate Windows.UI.Xaml.Media.Imaging.WriteableBitmap. |
System.Byte[] | pixels | Used to specify buffer for bitmap. |
System.Int32 | pixelWidth | Used to specify the width. |
System.Int32 | pixelHeight | Used to specify the height. |
System.Int32 | x1 | Used to specify x1. |
System.Int32 | y1 | Used to specify y1. |
System.Int32 | x2 | Used to specify x2. |
System.Int32 | y2 | Used to specify y2. |
Windows.UI.Color | uiColor | Used to specify color for bitmap. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
Windows.Foundation.Rect | clip | Used to specify the series bounds. |
DrawLineAa(WriteableBitmap, Stream, Int32, Int32, Int32, Int32, Int32, List<Int32>, Color)
Draws an anti-aliased line, using an optimized version of Gupta-Sproull algorithm From http://nokola.com/blog/post/2010/10/14/Anti-aliased-Lines-And-Optimizing-Code-for-Windows-Phone-7e28093First-Look.aspx
The WriteableBitmap. The x-coordinate of the start point. The y-coordinate of the start point. The x-coordinate of the end point. The y-coordinate of the end point. The color for the line.Declaration
public static void DrawLineAa(this WriteableBitmap bmp, Stream stream, int x1, int y1, int x2, int y2, int color, List<int> pixels, Color uiColor)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | |
System.IO.Stream | stream | |
System.Int32 | x1 | |
System.Int32 | y1 | |
System.Int32 | x2 | |
System.Int32 | y2 | |
System.Int32 | color | |
System.Collections.Generic.List<System.Int32> | pixels | |
Windows.UI.Color | uiColor |
DrawLineAa(WriteableBitmap, Stream, Int32, Int32, Int32, Int32, Color, List<Int32>)
Draws an anti-aliased line, using an optimized version of Gupta-Sproull algorithm From http://nokola.com/blog/post/2010/10/14/Anti-aliased-Lines-And-Optimizing-Code-for-Windows-Phone-7e28093First-Look.aspx
The WriteableBitmap. The x-coordinate of the start point. The y-coordinate of the start point. The x-coordinate of the end point. The y-coordinate of the end point. The color for the line.Declaration
public static void DrawLineAa(this WriteableBitmap bmp, Stream stream, int x1, int y1, int x2, int y2, Color color, List<int> pixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | |
System.IO.Stream | stream | |
System.Int32 | x1 | |
System.Int32 | y1 | |
System.Int32 | x2 | |
System.Int32 | y2 | |
Windows.UI.Color | color | |
System.Collections.Generic.List<System.Int32> | pixels |
DrawLineBresenham(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>)
Method implementation for DrawLine.
Declaration
public static void DrawLineBresenham(this WriteableBitmap bmp, byte[] buffer, int width, int height, int x1, int y1, int x2, int y2, Color uiColor, List<int> seriesPixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | Used to indicate Windows.UI.Xaml.Media.Imaging.WriteableBitmap. |
System.Byte[] | buffer | Used to specify buffer for bitmap. |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
System.Int32 | x1 | Used to specify x1. |
System.Int32 | y1 | Used to specify y1. |
System.Int32 | x2 | Used to specify x2. |
System.Int32 | y2 | Used to specify y2. |
Windows.UI.Color | uiColor | Used to specify color for bitmap. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
DrawLineBresenham(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>, Rect)
Method implementation for DrawLine.
Declaration
public static void DrawLineBresenham(this WriteableBitmap bmp, byte[] buffer, int width, int height, int x1, int y1, int x2, int y2, Color uiColor, List<int> seriesPixels, Rect clip)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | Used to indicate Windows.UI.Xaml.Media.Imaging.WriteableBitmap. |
System.Byte[] | buffer | Used to specify buffer for bitmap. |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
System.Int32 | x1 | Used to specify x1. |
System.Int32 | y1 | Used to specify y1. |
System.Int32 | x2 | Used to specify x2. |
System.Int32 | y2 | Used to specify y2. |
Windows.UI.Color | uiColor | Used to specify color for bitmap. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
Windows.Foundation.Rect | clip | USed to specify the series bound. |
DrawLineBresenham(WriteableBitmap, Stream, Int32, Int32, Int32, Int32, Color, List<Int32>)
Draws a colored line by connecting two points using the Bresenham algorithm.
Declaration
public static void DrawLineBresenham(this WriteableBitmap bmp, Stream stream, int x1, int y1, int x2, int y2, Color uiColor, List<int> pixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.IO.Stream | stream | |
System.Int32 | x1 | The x-coordinate of the start point. |
System.Int32 | y1 | The y-coordinate of the start point. |
System.Int32 | x2 | The x-coordinate of the end point. |
System.Int32 | y2 | The y-coordinate of the end point. |
Windows.UI.Color | uiColor | The color for the line. |
System.Collections.Generic.List<System.Int32> | pixels |
DrawLineDDA(WriteableBitmap, Stream, Int32, Int32, Int32, Int32, Color)
Draws a colored line by connecting two points using a DDA algorithm (Digital Differential Analyzer).
Declaration
public static void DrawLineDDA(this WriteableBitmap bmp, Stream stream, int x1, int y1, int x2, int y2, Color uiColor)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.IO.Stream | stream | |
System.Int32 | x1 | The x-coordinate of the start point. |
System.Int32 | y1 | The y-coordinate of the start point. |
System.Int32 | x2 | The x-coordinate of the end point. |
System.Int32 | y2 | The y-coordinate of the end point. |
Windows.UI.Color | uiColor | The color for the line. |
DrawRectangle(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>)
Draws a rectangle. x2 has to be greater than x1 and y2 has to be greater than y1.
Declaration
public static void DrawRectangle(this WriteableBitmap bmp, byte[] buffer, int width, int height, int x1, int y1, int x2, int y2, Color color, List<int> seriesPixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Byte[] | buffer | Used to specify buffer value. |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
System.Int32 | x1 | The x-coordinate of the bounding rectangle's left side. |
System.Int32 | y1 | The y-coordinate of the bounding rectangle's top side. |
System.Int32 | x2 | The x-coordinate of the bounding rectangle's right side. |
System.Int32 | y2 | The y-coordinate of the bounding rectangle's bottom side. |
Windows.UI.Color | color | The color. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
FillEllipseCentered(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>)
Uses a different parameter representation than DrawEllipse().
Declaration
public static void FillEllipseCentered(this WriteableBitmap bmp, byte[] buffer, int height, int width, int xc, int yc, int xr, int yr, Color color, List<int> seriesPixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Byte[] | buffer | Used to specify the buffer value. |
System.Int32 | height | Used to specify the height. |
System.Int32 | width | Used to specify the width. |
System.Int32 | xc | The x-coordinate of the bounding rectangle's left side. |
System.Int32 | yc | The y-coordinate of the bounding rectangle's top side. |
System.Int32 | xr | The x-coordinate of the bounding rectangle's right side. |
System.Int32 | yr | The y-coordinate of the bounding rectangle's bottom side. |
Windows.UI.Color | color | The color. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
FillPolygon(WriteableBitmap, Byte[], Int32[], Int32, Int32, Color, List<Int32>)
Draws a filled polygon. Add the first point also at the end of the array if the line should be closed.
Declaration
public static void FillPolygon(this WriteableBitmap bmp, byte[] buffer, int[] points, int width, int height, Color color, List<int> seriesPixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Byte[] | buffer | Used to specify the collection of pixel buffer in byte. |
System.Int32[] | points | The points of the polygon in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn). |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
Windows.UI.Color | color | The color for the line. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
FillPolygon(WriteableBitmap, Byte[], Int32[], Int32, Int32, Color, List<Int32>, Rect)
Set background to the polygon.
Declaration
public static void FillPolygon(this WriteableBitmap bmp, byte[] buffer, int[] points, int width, int height, Color color, List<int> seriesPixels, Rect clip)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Byte[] | buffer | Used to specify the collection of pixel buffer in byte. |
System.Int32[] | points | The points of the polygon in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn). |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
Windows.UI.Color | color | The color for the line. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
Windows.Foundation.Rect | clip | Used to specify the series bounds. |
FillRectangle(WriteableBitmap, Byte[], Int32, Int32, Int32, Int32, Int32, Int32, Color, List<Int32>)
Draws a filled rectangle. x2 has to be greater than x1 and y2 has to be greater than y1.
Declaration
public static void FillRectangle(this WriteableBitmap bmp, byte[] buffer, int width, int height, int x1, int y1, int x2, int y2, Color color, List<int> seriesPixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Byte[] | buffer | Used to specify buffer value. |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
System.Int32 | x1 | The x-coordinate of the bounding rectangle's left side. |
System.Int32 | y1 | The y-coordinate of the bounding rectangle's top side. |
System.Int32 | x2 | The x-coordinate of the bounding rectangle's right side. |
System.Int32 | y2 | The y-coordinate of the bounding rectangle's bottom side. |
Windows.UI.Color | color | The color. |
System.Collections.Generic.List<System.Int32> | seriesPixels | Used to specify collection of pixels. |
GetEllipseCentered(WriteableBitmap, Int32, Int32, Int32, Int32, Int32, Int32, List<Int32>)
Uses a different parameter representation than GetEllipse().
Declaration
public static List<int> GetEllipseCentered(this WriteableBitmap bmp, int height, int width, int xc, int yc, int xr, int yr, List<int> pixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Int32 | height | Used to specify the height. |
System.Int32 | width | Used to specify the width. |
System.Int32 | xc | The x-coordinate of the bounding rectangle's left side. |
System.Int32 | yc | The y-coordinate of the bounding rectangle's top side. |
System.Int32 | xr | The x-coordinate of the bounding rectangle's right side. |
System.Int32 | yr | The y-coordinate of the bounding rectangle's bottom side. |
System.Collections.Generic.List<System.Int32> | pixels | Used to specify collection of pixels. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.Int32> | Returns the collection pixels. |
GetRectangle(WriteableBitmap, Int32, Int32, Int32, Int32, Int32, Int32, List<Int32>)
Uses a different parameter representation than GetRectangle().
Declaration
public static List<int> GetRectangle(this WriteableBitmap bmp, int width, int height, int x1, int y1, int x2, int y2, List<int> pixels)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Xaml.Media.Imaging.WriteableBitmap | bmp | The WriteableBitmap. |
System.Int32 | width | Used to specify the width. |
System.Int32 | height | Used to specify the height. |
System.Int32 | x1 | The x-coordinate of the bounding rectangle's left side. |
System.Int32 | y1 | The y-coordinate of the bounding rectangle's top side. |
System.Int32 | x2 | The x-coordinate of the bounding rectangle's right side. |
System.Int32 | y2 | The y-coordinate of the bounding rectangle's bottom side. |
System.Collections.Generic.List<System.Int32> | pixels | Used to specify collection of pixels. |
Returns
Type |
---|
System.Collections.Generic.List<System.Int32> |
Intersect(Double, Double, Double)
Intersect Calculation Method(c = y- mx)
Declaration
public static double Intersect(double x, double y, double slope)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x | |
System.Double | y | |
System.Double | slope |
Returns
Type |
---|
System.Double |
Slope(Double, Double, Double, Double)
Slope Calculation Method
Declaration
public static double Slope(double x1, double y1, double x2, double y2)
Parameters
Type | Name | Description |
---|---|---|
System.Double | x1 | |
System.Double | y1 | |
System.Double | x2 | |
System.Double | y2 |
Returns
Type |
---|
System.Double |