C# Класс System.Windows.Media.Imaging.WriteableBitmapExtensions

Collection of draw extension methods for the Silverlight WriteableBitmap class.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Blit ( BitmapContext destContext, int dpw, int dph, Rect destRect, BitmapContext srcContext, Rect sourceRect, int sourceWidth ) : void
Blit ( this bmp, Point destPosition, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect, Color color, BlendMode blendMode ) : void

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).

Blit ( this bmp, Rect destRect, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect ) : void

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).

Blit ( this bmp, Rect destRect, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect, BlendMode blendMode ) : void

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).

BlitRender ( this bmp, System.Windows.Media.Imaging.WriteableBitmap source, bool shouldClear = true, float opacity = 1f, GeneralTransform transform = null ) : void

Renders a bitmap using any affine transformation and transparency into this bitmap Unlike Silverlight's Render() method, this one uses 2-3 times less memory, and is the same or better quality The algorithm is simple dx/dy (bresenham-like) step by step painting, optimized with fixed point and fast bilinear filtering It's used in Fantasia Painter for drawing stickers and 3D objects on screen

DrawEllipse ( this bmp, int x1, int y1, int x2, int y2, Color color ) : void

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf x2 has to be greater than x1 and y2 has to be greater than y1.

DrawEllipse ( this bmp, int x1, int y1, int x2, int y2, int color ) : void

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf x2 has to be greater than x1 and y2 has to be greater than y1.

DrawEllipseCentered ( this bmp, int xc, int yc, int xr, int yr, Color color ) : void

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf Uses a different parameter representation than DrawEllipse().

DrawEllipseCentered ( this bmp, int xc, int yc, int xr, int yr, int color ) : void

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf Uses a different parameter representation than DrawEllipse().

DrawPolyline ( this bmp, int points, Color color ) : void

Draws a polyline. Add the first point also at the end of the array if the line should be closed.

DrawPolyline ( this bmp, int points, int color ) : void

Draws a polyline anti-aliased. Add the first point also at the end of the array if the line should be closed.

DrawPolylineAa ( this bmp, int points, Color color ) : void

Draws a polyline. Add the first point also at the end of the array if the line should be closed.

DrawPolylineAa ( this bmp, int points, int color ) : void

Draws a polyline anti-aliased. Add the first point also at the end of the array if the line should be closed.

DrawQuad ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, Color color ) : void

Draws a quad.

DrawQuad ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int color ) : void

Draws a quad.

DrawRectangle ( this bmp, int x1, int y1, int x2, int y2, Color color ) : void

Draws a rectangle. x2 has to be greater than x1 and y2 has to be greater than y1.

DrawRectangle ( this bmp, int x1, int y1, int x2, int y2, int color ) : void

Draws a rectangle. x2 has to be greater than x1 and y2 has to be greater than y1.

DrawTriangle ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, Color color ) : void

Draws a triangle.

DrawTriangle ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, int color ) : void

Draws a triangle.

Приватные методы

Метод Описание
Blit ( this bmp, Rect destRect, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect, Color color, BlendMode blendMode ) : void

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).

Описание методов

Blit() публичный статический Метод

public static Blit ( BitmapContext destContext, int dpw, int dph, Rect destRect, BitmapContext srcContext, Rect sourceRect, int sourceWidth ) : void
destContext BitmapContext
dpw int
dph int
destRect Rect
srcContext BitmapContext
sourceRect Rect
sourceWidth int
Результат void

Blit() публичный статический Метод

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).
public static Blit ( this bmp, Point destPosition, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect, Color color, BlendMode blendMode ) : void
bmp this The destination WriteableBitmap.
destPosition Point The destination position in the destination bitmap.
source System.Windows.Media.Imaging.WriteableBitmap The source WriteableBitmap.
sourceRect Rect The rectangle that will be copied from the source to the destination.
color Color If not Colors.White, will tint the source image. A partially transparent color and the image will be drawn partially transparent.
blendMode BlendMode The blending mode .
Результат void

Blit() публичный статический Метод

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).
public static Blit ( this bmp, Rect destRect, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect ) : void
bmp this The destination WriteableBitmap.
destRect Rect The rectangle that defines the destination region.
source System.Windows.Media.Imaging.WriteableBitmap The source WriteableBitmap.
sourceRect Rect The rectangle that will be copied from the source to the destination.
Результат void

Blit() публичный статический Метод

Copies (blits) the pixels from the WriteableBitmap source to the destination WriteableBitmap (this).
public static Blit ( this bmp, Rect destRect, System.Windows.Media.Imaging.WriteableBitmap source, Rect sourceRect, BlendMode blendMode ) : void
bmp this The destination WriteableBitmap.
destRect Rect The rectangle that defines the destination region.
source System.Windows.Media.Imaging.WriteableBitmap The source WriteableBitmap.
sourceRect Rect The rectangle that will be copied from the source to the destination.
blendMode BlendMode The blending mode .
Результат void

BlitRender() публичный статический Метод

Renders a bitmap using any affine transformation and transparency into this bitmap Unlike Silverlight's Render() method, this one uses 2-3 times less memory, and is the same or better quality The algorithm is simple dx/dy (bresenham-like) step by step painting, optimized with fixed point and fast bilinear filtering It's used in Fantasia Painter for drawing stickers and 3D objects on screen
public static BlitRender ( this bmp, System.Windows.Media.Imaging.WriteableBitmap source, bool shouldClear = true, float opacity = 1f, GeneralTransform transform = null ) : void
bmp this Destination bitmap.
source System.Windows.Media.Imaging.WriteableBitmap The source WriteableBitmap.
shouldClear bool If true, the the destination bitmap will be set to all clear (0) before rendering.
opacity float opacity of the source bitmap to render, between 0 and 1 inclusive
transform GeneralTransform Transformation to apply
Результат void

DrawEllipse() публичный статический Метод

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf x2 has to be greater than x1 and y2 has to be greater than y1.
public static DrawEllipse ( this bmp, int x1, int y1, int x2, int y2, Color color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the bounding rectangle's left side.
y1 int The y-coordinate of the bounding rectangle's top side.
x2 int The x-coordinate of the bounding rectangle's right side.
y2 int The y-coordinate of the bounding rectangle's bottom side.
color Color The color for the line.
Результат void

DrawEllipse() публичный статический Метод

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf x2 has to be greater than x1 and y2 has to be greater than y1.
public static DrawEllipse ( this bmp, int x1, int y1, int x2, int y2, int color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the bounding rectangle's left side.
y1 int The y-coordinate of the bounding rectangle's top side.
x2 int The x-coordinate of the bounding rectangle's right side.
y2 int The y-coordinate of the bounding rectangle's bottom side.
color int The color for the line.
Результат void

DrawEllipseCentered() публичный статический Метод

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf Uses a different parameter representation than DrawEllipse().
public static DrawEllipseCentered ( this bmp, int xc, int yc, int xr, int yr, Color color ) : void
bmp this The WriteableBitmap.
xc int The x-coordinate of the ellipses center.
yc int The y-coordinate of the ellipses center.
xr int The radius of the ellipse in x-direction.
yr int The radius of the ellipse in y-direction.
color Color The color for the line.
Результат void

DrawEllipseCentered() публичный статический Метод

A Fast Bresenham Type Algorithm For Drawing Ellipses http://homepage.smc.edu/kennedy_john/belipse.pdf Uses a different parameter representation than DrawEllipse().
public static DrawEllipseCentered ( this bmp, int xc, int yc, int xr, int yr, int color ) : void
bmp this The WriteableBitmap.
xc int The x-coordinate of the ellipses center.
yc int The y-coordinate of the ellipses center.
xr int The radius of the ellipse in x-direction.
yr int The radius of the ellipse in y-direction.
color int The color for the line.
Результат void

DrawPolyline() публичный статический Метод

Draws a polyline. Add the first point also at the end of the array if the line should be closed.
public static DrawPolyline ( this bmp, int points, Color color ) : void
bmp this The WriteableBitmap.
points int The points of the polyline in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn).
color Color The color for the line.
Результат void

DrawPolyline() публичный статический Метод

Draws a polyline anti-aliased. Add the first point also at the end of the array if the line should be closed.
public static DrawPolyline ( this bmp, int points, int color ) : void
bmp this The WriteableBitmap.
points int The points of the polyline in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn).
color int The color for the line.
Результат void

DrawPolylineAa() публичный статический Метод

Draws a polyline. Add the first point also at the end of the array if the line should be closed.
public static DrawPolylineAa ( this bmp, int points, Color color ) : void
bmp this The WriteableBitmap.
points int The points of the polyline in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn).
color Color The color for the line.
Результат void

DrawPolylineAa() публичный статический Метод

Draws a polyline anti-aliased. Add the first point also at the end of the array if the line should be closed.
public static DrawPolylineAa ( this bmp, int points, int color ) : void
bmp this The WriteableBitmap.
points int The points of the polyline in x and y pairs, therefore the array is interpreted as (x1, y1, x2, y2, ..., xn, yn).
color int The color for the line.
Результат void

DrawQuad() публичный статический Метод

Draws a quad.
public static DrawQuad ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, Color color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the 1st point.
y1 int The y-coordinate of the 1st point.
x2 int The x-coordinate of the 2nd point.
y2 int The y-coordinate of the 2nd point.
x3 int The x-coordinate of the 3rd point.
y3 int The y-coordinate of the 3rd point.
x4 int The x-coordinate of the 4th point.
y4 int The y-coordinate of the 4th point.
color Color The color.
Результат void

DrawQuad() публичный статический Метод

Draws a quad.
public static DrawQuad ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the 1st point.
y1 int The y-coordinate of the 1st point.
x2 int The x-coordinate of the 2nd point.
y2 int The y-coordinate of the 2nd point.
x3 int The x-coordinate of the 3rd point.
y3 int The y-coordinate of the 3rd point.
x4 int The x-coordinate of the 4th point.
y4 int The y-coordinate of the 4th point.
color int The color.
Результат void

DrawRectangle() публичный статический Метод

Draws a rectangle. x2 has to be greater than x1 and y2 has to be greater than y1.
public static DrawRectangle ( this bmp, int x1, int y1, int x2, int y2, Color color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the bounding rectangle's left side.
y1 int The y-coordinate of the bounding rectangle's top side.
x2 int The x-coordinate of the bounding rectangle's right side.
y2 int The y-coordinate of the bounding rectangle's bottom side.
color Color The color.
Результат void

DrawRectangle() публичный статический Метод

Draws a rectangle. x2 has to be greater than x1 and y2 has to be greater than y1.
public static DrawRectangle ( this bmp, int x1, int y1, int x2, int y2, int color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the bounding rectangle's left side.
y1 int The y-coordinate of the bounding rectangle's top side.
x2 int The x-coordinate of the bounding rectangle's right side.
y2 int The y-coordinate of the bounding rectangle's bottom side.
color int The color.
Результат void

DrawTriangle() публичный статический Метод

Draws a triangle.
public static DrawTriangle ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, Color color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the 1st point.
y1 int The y-coordinate of the 1st point.
x2 int The x-coordinate of the 2nd point.
y2 int The y-coordinate of the 2nd point.
x3 int The x-coordinate of the 3rd point.
y3 int The y-coordinate of the 3rd point.
color Color The color.
Результат void

DrawTriangle() публичный статический Метод

Draws a triangle.
public static DrawTriangle ( this bmp, int x1, int y1, int x2, int y2, int x3, int y3, int color ) : void
bmp this The WriteableBitmap.
x1 int The x-coordinate of the 1st point.
y1 int The y-coordinate of the 1st point.
x2 int The x-coordinate of the 2nd point.
y2 int The y-coordinate of the 2nd point.
x3 int The x-coordinate of the 3rd point.
y3 int The y-coordinate of the 3rd point.
color int The color.
Результат void