C# Class Accord.Imaging.Drawing

Drawing primitives.

The class allows to do drawing of some primitives directly on locked image data or unmanaged image.

All methods of this class support drawing only on color 24/32 bpp images and on grayscale 8 bpp indexed images.

When it comes to alpha blending for 24/32 bpp images, all calculations are done as described on Wikipeadia (see "over" operator).

Show file Open project: accord-net/framework

Public Methods

Method Description
FillRectangle ( BitmapData imageData, Rectangle rectangle, Color color ) : void

Fill rectangle on the specified image.

FillRectangle ( UnmanagedImage image, Rectangle rectangle, Color color ) : void

Fill rectangle on the specified image.

Line ( BitmapData imageData, IntPoint point1, IntPoint point2, Color color ) : void

Draw a line on the specified image.

Line ( UnmanagedImage image, IntPoint point1, IntPoint point2, Color color ) : void

Draw a line on the specified image.

Polygon ( BitmapData imageData, List points, Color color ) : void

Draw a polygon on the specified image.

The method draws a polygon by connecting all points from the first one to the last one and then connecting the last point with the first one.

Polygon ( UnmanagedImage image, List points, Color color ) : void

Draw a polygon on the specified image.

The method draws a polygon by connecting all points from the first one to the last one and then connecting the last point with the first one.

Polyline ( BitmapData imageData, List points, Color color ) : void

Draw a polyline on the specified image.

The method draws a polyline by connecting all points from the first one to the last one. Unlike Polygon( BitmapData, List{IntPoint}, Color ) method, this method does not connect the last point with the first one.

Polyline ( UnmanagedImage image, List points, Color color ) : void

Draw a polyline on the specified image.

The method draws a polyline by connecting all points from the first one to the last one. Unlike Polygon( UnmanagedImage, List{IntPoint}, Color ) method, this method does not connect the last point with the first one.

Rectangle ( BitmapData imageData, Rectangle rectangle, Color color ) : void

Draw rectangle on the specified image.

Rectangle ( UnmanagedImage image, Rectangle rectangle, Color color ) : void

Draw rectangle on the specified image.

Private Methods

Method Description
CheckEndPoint ( int width, int height, IntPoint start, IntPoint &end ) : void
CheckPixelFormat ( PixelFormat format ) : void

Method Details

FillRectangle() public static method

Fill rectangle on the specified image.
The source image has incorrect pixel format.
public static FillRectangle ( BitmapData imageData, Rectangle rectangle, Color color ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to draw on.
rectangle System.Drawing.Rectangle Rectangle's coordinates to fill.
color Color Rectangle's color.
return void

FillRectangle() public static method

Fill rectangle on the specified image.
The source image has incorrect pixel format.
public static FillRectangle ( UnmanagedImage image, Rectangle rectangle, Color color ) : void
image UnmanagedImage Source image to draw on.
rectangle System.Drawing.Rectangle Rectangle's coordinates to fill.
color Color Rectangle's color.
return void

Line() public static method

Draw a line on the specified image.
The source image has incorrect pixel format.
public static Line ( BitmapData imageData, IntPoint point1, IntPoint point2, Color color ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to draw on.
point1 IntPoint The first point to connect.
point2 IntPoint The second point to connect.
color Color Line's color.
return void

Line() public static method

Draw a line on the specified image.
The source image has incorrect pixel format.
public static Line ( UnmanagedImage image, IntPoint point1, IntPoint point2, Color color ) : void
image UnmanagedImage Source image to draw on.
point1 IntPoint The first point to connect.
point2 IntPoint The second point to connect.
color Color Line's color.
return void

Polygon() public static method

Draw a polygon on the specified image.

The method draws a polygon by connecting all points from the first one to the last one and then connecting the last point with the first one.

public static Polygon ( BitmapData imageData, List points, Color color ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to draw on.
points List Points of the polygon to draw.
color Color Polygon's color.
return void

Polygon() public static method

Draw a polygon on the specified image.

The method draws a polygon by connecting all points from the first one to the last one and then connecting the last point with the first one.

public static Polygon ( UnmanagedImage image, List points, Color color ) : void
image UnmanagedImage Source image to draw on.
points List Points of the polygon to draw.
color Color Polygon's color.
return void

Polyline() public static method

Draw a polyline on the specified image.

The method draws a polyline by connecting all points from the first one to the last one. Unlike Polygon( BitmapData, List{IntPoint}, Color ) method, this method does not connect the last point with the first one.

public static Polyline ( BitmapData imageData, List points, Color color ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to draw on.
points List Points of the polyline to draw.
color Color polyline's color.
return void

Polyline() public static method

Draw a polyline on the specified image.

The method draws a polyline by connecting all points from the first one to the last one. Unlike Polygon( UnmanagedImage, List{IntPoint}, Color ) method, this method does not connect the last point with the first one.

public static Polyline ( UnmanagedImage image, List points, Color color ) : void
image UnmanagedImage Source image to draw on.
points List Points of the polyline to draw.
color Color polyline's color.
return void

Rectangle() public static method

Draw rectangle on the specified image.
The source image has incorrect pixel format.
public static Rectangle ( BitmapData imageData, Rectangle rectangle, Color color ) : void
imageData System.Drawing.Imaging.BitmapData Source image data to draw on.
rectangle System.Drawing.Rectangle Rectangle's coordinates to draw.
color Color Rectangle's color.
return void

Rectangle() public static method

Draw rectangle on the specified image.
The source image has incorrect pixel format.
public static Rectangle ( UnmanagedImage image, Rectangle rectangle, Color color ) : void
image UnmanagedImage Source image to draw on.
rectangle System.Drawing.Rectangle Rectangle's coordinates to draw.
color Color Rectangle's color.
return void