Class Canvas
Canvas abstract class.
Inherited Members
Namespace: Cosmos.System.Graphics
Assembly: Cosmos.System2.dll
Syntax
public abstract class Canvas
Properties
| Improve this Doc View SourceAvailableModes
Available graphics modes.
Declaration
public abstract List<Mode> AvailableModes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.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 |
---|---|---|
System.Drawing.Color | to | Color to calculate. |
System.Drawing.Color | from | Color used to calculate. |
System.Byte | alpha | Alpha amount. |
Returns
Type | Description |
---|---|
System.Drawing.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()
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error. |
System.Exception | Thrown on memory access violation. |
Clear(Color)
Clear all the Canvas with the specified color.
Declaration
public virtual void Clear(Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error. |
System.Exception | Thrown on memory access violation. |
Clear(Int32)
Clear all the Canvas with the specified color.
Declaration
public abstract void Clear(int color)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | color | Color in ARGB. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown on fatal error. |
System.Exception | Thrown on memory access violation. |
Disable()
Display graphic mode
Declaration
public abstract void Disable()
Display()
Display screen
Declaration
public abstract void Display()
DrawArc(Int32, Int32, Int32, Int32, Color, Int32, Int32)
Draws an arc.
Declaration
public virtual void DrawArc(int x, int y, int width, int height, Color color, int StartAngle = 0, int EndAngle = 360)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | x | |
System.Int32 | y | |
System.Int32 | width | |
System.Int32 | height | |
System.Drawing.Color | color | |
System.Int32 | StartAngle | |
System.Int32 | EndAngle |
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 |
---|---|---|
System.Drawing.Color[] | colors | Colors array. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | width | Width. |
System.Int32 | height | unused. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if coordinates are invalid, or width is less than 0. |
System.NotImplementedException | Thrown if color depth is not supported. |
DrawChar(Char, Font, Color, Int32, Int32)
Draw char.
Declaration
public virtual void DrawChar(char c, Font aFont, Color color, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Char | c | |
Font | aFont | Font used. |
System.Drawing.Color | color | Color. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawCircle(Color, Int32, Int32, Int32)
Draw Circle.
Declaration
public virtual void DrawCircle(Color color, int x_center, int y_center, int radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color to draw with. |
System.Int32 | x_center | X center coordinate. |
System.Int32 | y_center | Y center coordinate. |
System.Int32 | radius | Radius. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if coorinates invalid. |
System.Exception | Thrown on memory access violation. |
DrawEllipse(Color, Int32, Int32, Int32, Int32)
Draw ellipse.
Declaration
public virtual void DrawEllipse(Color color, int x_center, int y_center, int x_radius, int y_radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color 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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if color is null. |
System.ArgumentOutOfRangeException | Thrown if coorinates invalid. |
System.Exception | Thrown on memory access violation. |
DrawFilledCircle(Color, Int32, Int32, Int32)
Draw Filled Circle.
Declaration
public virtual void DrawFilledCircle(Color color, int x0, int y0, int radius)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color to draw with. |
System.Int32 | x0 | |
System.Int32 | y0 | |
System.Int32 | radius | Radius. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if color is null. |
System.ArgumentOutOfRangeException | Thrown if coorinates invalid. |
System.Exception | Thrown on memory access violation. |
DrawFilledEllipse(Color, Int32, Int32, Int32, Int32)
Draw Filled Ellipse.
Declaration
public virtual void DrawFilledEllipse(Color color, int xx, int yy, int height, int width)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color to draw with. |
System.Int32 | xx | |
System.Int32 | yy | |
System.Int32 | height | Height. |
System.Int32 | width | Width. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if color is null. |
System.ArgumentOutOfRangeException | Thrown if coorinates invalid. |
System.Exception | Thrown on memory access violation. |
DrawFilledRectangle(Color, Int32, Int32, Int32, Int32)
Draw filled rectangle.
Declaration
public virtual void DrawFilledRectangle(Color color, int x_start, int y_start, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color 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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.Exception | Thrown on memory access violation. |
System.OverflowException | Thrown if lines length are invalid. |
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. |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown on memory access violation. |
System.ArgumentOutOfRangeException | Thrown on fatal error. |
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, 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. |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown on memory access violation. |
System.ArgumentOutOfRangeException | Thrown on fatal error. |
DrawLine(Color, Int32, Int32, Int32, Int32)
Draw line.
Declaration
public virtual void DrawLine(Color color, int x1, int y1, int x2, int y2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color 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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.Exception | Thrown on memory access violation. |
System.OverflowException | Thrown if x1-x2 or y1-y2 equal to Int32.MinValue. |
DrawLine(Color, Single, Single, Single, Single)
Draw line. Not implemented.
Declaration
public void DrawLine(Color color, float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color 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. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Thrown always. |
DrawPoint(Color, Int32, Int32)
Draw point.
Declaration
public abstract void DrawPoint(Color color, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color to draw with. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown on memory access violation. |
DrawPoint(Color, Single, Single)
Draw point to the screen. Not implemented.
Declaration
public abstract void DrawPoint(Color color, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | Color to draw the point with. |
System.Single | x | X coordinate. |
System.Single | y | Y coordinate. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Thrown always (only int coordinats supported). |
DrawPolygon(Color, Point[])
Draw polygon.
Declaration
public virtual void DrawPolygon(Color color, params Point[] points)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color to draw with. |
System.Drawing.Point[] | points | Points array. |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown if point array is smaller then 3. |
System.ArgumentNullException | Thrown if color is null. |
System.ArgumentOutOfRangeException |
|
System.Exception | Thrown on memory access violation. |
System.OverflowException | Thrown if lines length are invalid. |
DrawRectangle(Color, Int32, Int32, Int32, Int32)
Draw rectangle.
Declaration
public virtual void DrawRectangle(Color color, int x, int y, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color to draw with. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | width | Width. |
System.Int32 | height | Height. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if color is null. |
System.ArgumentOutOfRangeException |
|
System.Exception | Thrown on memory access violation. |
System.OverflowException | Thrown if lines length are invalid. |
DrawRectangle(Color, Single, Single, Single, Single)
Draw rectangle. Not implemented.
Declaration
public virtual void DrawRectangle(Color color, float x_start, float y_start, float width, float height)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color 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. |
Exceptions
Type | Condition |
---|---|
System.NotImplementedException | Thrown always. |
DrawSquare(Color, Int32, Int32, Int32)
Draw square.
Declaration
public virtual void DrawSquare(Color color, int x, int y, int size)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color to draw with. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
System.Int32 | size | size. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if color is null. |
System.ArgumentOutOfRangeException |
|
System.Exception | Thrown on memory access violation. |
System.OverflowException | Thrown if lines length are invalid. |
DrawString(String, Font, Color, Int32, Int32)
Draw string.
Declaration
public virtual void DrawString(string str, Font aFont, Color color, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | string to draw. |
Font | aFont | Font used. |
System.Drawing.Color | color | Color. |
System.Int32 | x | X coordinate. |
System.Int32 | y | Y coordinate. |
DrawTriangle(Color, Int32, Int32, Int32, Int32, Int32, Int32)
Draw triangle.
Declaration
public virtual void DrawTriangle(Color color, int v1x, int v1y, int v2x, int v2y, int v3x, int v3y)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Color | color | color 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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
System.Exception | Thrown on memory access violation. |
System.OverflowException | Thrown if lines lengths are invalid. |
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 |
---|---|
System.Drawing.Color | Color value. |
Exceptions
Type | Condition |
---|---|
System.Exception | Thrown on memory access violation. |
Name()
Name of the backend
Declaration
public abstract string Name()
Returns
Type | Description |
---|---|
System.String |
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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if coordinates are invalid. |
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. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException | Thrown if mode is not suppoted. |
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. |