Class Canvas
Canvas abstract class.
Namespace: Cosmos.System.Graphics
Assembly: Cosmos.System2.dll
Syntax
public abstract class Canvas : object
Properties
| Improve this Doc View SourceAvailableModes
Available graphics modes.
Declaration
public abstract List<Mode> AvailableModes { get; }
Property Value
Type | Description |
---|---|
List<Mode> |
DefaultGraphicMode
Get default graphics mode.
Declaration
public abstract Mode DefaultGraphicMode { get; }
Property Value
Type | Description |
---|---|
Mode |
Mode
Get and set graphics mode.
Declaration
public abstract Mode Mode { get; set; }
Property Value
Type | Description |
---|---|
Mode |
Methods
| Improve this Doc View SourceAlphaBlend(Color, Color, Byte)
Calculate new Color from back Color with alpha
Declaration
public Color AlphaBlend(Color to, Color from, byte alpha)
Parameters
Type | Name | Description |
---|---|---|
Color | to | Color to calculate. |
Color | from | Color used to calculate. |
System.Byte | alpha | Alpha amount. |
Returns
Type | Description |
---|---|
Color |
CheckIfModeIsValid(Mode)
Check if video mode is valid.
Declaration
protected bool CheckIfModeIsValid(Mode mode)
Parameters
Type | Name | Description |
---|---|---|
Mode | mode | Video mode. |
Returns
Type | Description |
---|---|
System.Boolean | bool value. |
Clear()
Clear all the Canvas with the Black color.
Declaration
public void Clear()
Clear(Color)
Clear all the Canvas with the specified color.
Declaration
public virtual void Clear(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | Color. |
Disable()
Display graphic mode
Declaration
public abstract void Disable()
Display()
Display screen
Declaration
public abstract void Display()
DrawArray(Color[], Point, Int32, Int32)
Draw array of colors.
Declaration
public virtual void DrawArray(Color[] colors, Point point, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | Colors array. |
Point | point | Starting point. |
System.Int32 | width | Width. |
System.Int32 | height | unused. |
DrawArray(Color[], Int32, Int32, Int32, Int32)
Draw array of colors.
Declaration
public abstract void DrawArray(Color[] colors, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color[] | colors | Colors array. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | width | Width. |
System.Int32 | height | unused. |
DrawChar(Char, Font, Pen, Point)
Draw string.
Declaration
public void DrawChar(char c, Font aFont, Pen pen, Point point)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | |
Font | aFont | Font used. |
Pen | pen | Color. |
Point | point | Point of the top left corner of the char. |
DrawChar(Char, Font, Pen, Int32, Int32)
Draw char.
Declaration
public void DrawChar(char c, Font aFont, Pen pen, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | |
Font | aFont | Font used. |
Pen | pen | Color. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawCircle(Pen, Point, Int32)
Draw Circle.
Declaration
public virtual void DrawCircle(Pen pen, Point point, int radius)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | center point. |
System.Int32 | radius | Radius. |
DrawCircle(Pen, Int32, Int32, Int32)
Draw Circle.
Declaration
public virtual void DrawCircle(Pen pen, int x_center, int y_center, int radius)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x_center | X center coordinate. |
System.Int32 | y_center | Y center coordinate. |
System.Int32 | radius | Radius. |
DrawEllipse(Pen, Point, Int32, Int32)
Draw ellipse.
Declaration
public virtual void DrawEllipse(Pen pen, Point point, int x_radius, int y_radius)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | Center point. |
System.Int32 | x_radius | X radius. |
System.Int32 | y_radius | Y radius. |
DrawEllipse(Pen, Int32, Int32, Int32, Int32)
Draw ellipse.
Declaration
public virtual void DrawEllipse(Pen pen, int x_center, int y_center, int x_radius, int y_radius)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x_center | X center coordinate. |
System.Int32 | y_center | Y center coordinate. |
System.Int32 | x_radius | X radius. |
System.Int32 | y_radius | Y radius. |
DrawFilledCircle(Pen, Point, Int32)
Draw Filled Circle.
Declaration
public virtual void DrawFilledCircle(Pen pen, Point point, int radius)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | center point. |
System.Int32 | radius | Radius. |
DrawFilledCircle(Pen, Int32, Int32, Int32)
Draw Filled Circle.
Declaration
public virtual void DrawFilledCircle(Pen pen, int x0, int y0, int radius)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x0 | |
System.Int32 | y0 | |
System.Int32 | radius | Radius. |
DrawFilledEllipse(Pen, Point, Int32, Int32)
Draw Filled Ellipse.
Declaration
public virtual void DrawFilledEllipse(Pen pen, Point point, int height, int width)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | Center point. |
System.Int32 | height | Height. |
System.Int32 | width | Width. |
DrawFilledEllipse(Pen, Int32, Int32, Int32, Int32)
Draw Filled Ellipse.
Declaration
public virtual void DrawFilledEllipse(Pen pen, int x, int y, int height, int width)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x | X Position. |
System.Int32 | y | Y Position. |
System.Int32 | height | Height. |
System.Int32 | width | Width. |
DrawFilledRectangle(Pen, Point, Int32, Int32)
Draw filled rectangle.
Declaration
public virtual void DrawFilledRectangle(Pen pen, Point point, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | Starting point. |
System.Int32 | width | Width. |
System.Int32 | height | Height. |
DrawFilledRectangle(Pen, Int32, Int32, Int32, Int32)
Draw filled rectangle.
Declaration
public virtual void DrawFilledRectangle(Pen pen, int x_start, int y_start, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x_start | Starting point X coordinate. |
System.Int32 | y_start | Starting point Y coordinate. |
System.Int32 | width | Width. |
System.Int32 | height | Height. |
DrawImage(Image, Point)
Draw image.
Declaration
public void DrawImage(Image image, Point point)
Parameters
Type | Name | Description |
---|---|---|
Image | image | Image to draw. |
Point | point | Point of the top left corner of the image. |
DrawImage(Image, Int32, Int32)
Draw image.
Declaration
public virtual void DrawImage(Image image, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
Image | image | Image to draw. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawImage(Image, Int32, Int32, Int32, Int32)
Draw a Scaled Bitmap.
Declaration
public virtual void DrawImage(Image image, int x, int y, int w, int h)
Parameters
Type | Name | Description |
---|---|---|
Image | image | Image to Scale. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | w | Desired Width. |
System.Int32 | h | Desired Height. |
DrawImageAlpha(Image, Point)
Draw image with alpha channel.
Declaration
public void DrawImageAlpha(Image image, Point point)
Parameters
Type | Name | Description |
---|---|---|
Image | image | Image to draw. |
Point | point | Point of the top left corner of the image. |
DrawImageAlpha(Image, Int32, Int32)
Draw image with alpha channel.
Declaration
public void DrawImageAlpha(Image image, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
Image | image | Image to draw. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawLine(Pen, Point, Point)
Draw line.
Declaration
public void DrawLine(Pen pen, Point p1, Point p2)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | p1 | Staring point. |
Point | p2 | End point. |
DrawLine(Pen, Int32, Int32, Int32, Int32)
Draw line.
Declaration
public virtual void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x1 | Staring point X coordinate. |
System.Int32 | y1 | Staring point Y coordinate. |
System.Int32 | x2 | End point X coordinate. |
System.Int32 | y2 | End point Y coordinate. |
DrawLine(Pen, Single, Single, Single, Single)
Draw line. Not implemented.
Declaration
public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Single | x1 | Staring point X coordinate. |
System.Single | y1 | Staring point Y coordinate. |
System.Single | x2 | End point X coordinate. |
System.Single | y2 | End point Y coordinate. |
DrawPoint(Pen, Point)
Draw point.
Declaration
public void DrawPoint(Pen pen, Point point)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | Point. |
DrawPoint(Pen, Int32, Int32)
Draw point.
Declaration
public abstract void DrawPoint(Pen pen, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawPoint(Pen, Single, Single)
Draw point to the screen. Not implemented.
Declaration
public abstract void DrawPoint(Pen pen, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw the point with. |
System.Single | x | X coordinate. |
System.Single | y | Y coordinate. |
DrawPolygon(Pen, Point[])
Draw polygon.
Declaration
public virtual void DrawPolygon(Pen pen, params Point[] points)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point[] | points | Points array. |
DrawRectangle(Pen, Point, Int32, Int32)
Draw rectangle.
Declaration
public virtual void DrawRectangle(Pen pen, Point point, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | Staring point. |
System.Int32 | width | Width. |
System.Int32 | height | Height. |
DrawRectangle(Pen, Int32, Int32, Int32, Int32)
Draw rectangle.
Declaration
public virtual void DrawRectangle(Pen pen, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | width | Width. |
System.Int32 | height | Height. |
DrawRectangle(Pen, Single, Single, Single, Single)
Draw rectangle. Not implemented.
Declaration
public virtual void DrawRectangle(Pen pen, float x_start, float y_start, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Single | x_start | starting X coordinate. |
System.Single | y_start | starting Y coordinate. |
System.Single | width | Width. |
System.Single | height | Height. |
DrawSquare(Pen, Point, Int32)
Draw square.
Declaration
public virtual void DrawSquare(Pen pen, Point point, int size)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point | Starting point. |
System.Int32 | size | size. |
DrawSquare(Pen, Int32, Int32, Int32)
Draw square.
Declaration
public virtual void DrawSquare(Pen pen, int x, int y, int size)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | size | size. |
DrawString(String, Font, Pen, Point)
Draw string.
Declaration
public void DrawString(string str, Font aFont, Pen pen, Point point)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | string to draw. |
Font | aFont | Font used. |
Pen | pen | Color. |
Point | point | Point of the top left corner of the string. |
DrawString(String, Font, Pen, Int32, Int32)
Draw string.
Declaration
public void DrawString(string str, Font aFont, Pen pen, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | string to draw. |
Font | aFont | Font used. |
Pen | pen | Color. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawTriangle(Pen, Point, Point, Point)
Draw triangle.
Declaration
public virtual void DrawTriangle(Pen pen, Point point0, Point point1, Point point2)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
Point | point0 | First point. |
Point | point1 | Second point. |
Point | point2 | Third point. |
DrawTriangle(Pen, Int32, Int32, Int32, Int32, Int32, Int32)
Draw triangle.
Declaration
public virtual void DrawTriangle(Pen pen, int v1x, int v1y, int v2x, int v2y, int v3x, int v3y)
Parameters
Type | Name | Description |
---|---|---|
Pen | pen | Pen to draw with. |
System.Int32 | v1x | First point X coordinate. |
System.Int32 | v1y | First point Y coordinate. |
System.Int32 | v2x | Second point X coordinate. |
System.Int32 | v2y | Second point Y coordinate. |
System.Int32 | v3x | Third point X coordinate. |
System.Int32 | v3y | Third point Y coordinate. |
GetPointColor(Int32, Int32)
Get point color.
Declaration
public abstract Color GetPointColor(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
Returns
Type | Description |
---|---|
Color | Color value. |
ThrowIfCoordNotValid(Point)
Check if coordinats are valid. Throw exception if not.
Declaration
protected void ThrowIfCoordNotValid(Point point)
Parameters
Type | Name | Description |
---|---|---|
Point | point | Point on the convas. |
ThrowIfCoordNotValid(Int32, Int32)
Check if coordinats are valid. Throw exception if not.
Declaration
protected void ThrowIfCoordNotValid(int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
ThrowIfModeIsNotValid(Mode)
Check if video mode is valid. Throw exception if not.
Declaration
protected void ThrowIfModeIsNotValid(Mode mode)
Parameters
Type | Name | Description |
---|---|---|
Mode | mode | Video mode. |
TrimLine(ref Int32, ref Int32, ref Int32, ref Int32)
TrimLine
Declaration
protected void TrimLine(ref int x1, ref int y1, ref int x2, ref int y2)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x1 | X coordinate. |
System.Int32 | y1 | Y coordinate. |
System.Int32 | x2 | X coordinate. |
System.Int32 | y2 | Y coordinate. |