Cosmos/source/Cosmos.System2/Graphics/Pen.cs
fanoI 376c0d2db6 Changed some classes of CGS to be struct as they should have been from the beginnning.
- Mode and Point are now structures
- The copy of System.Drawing.Color is not needed anymore the real System.DrawingColor is used instead
- Updated CGS Test Kernel
- Made SVGAII a little more faster (but this not the complete solution)
2018-05-13 20:17:20 +02:00

59 lines
1.4 KiB
C#

using System;
using System.Drawing;
namespace Cosmos.System.Graphics
{
/*
* This represents a Pen the same thing a drawer uses to paint.
* For now it is a very little abstraction it put together a color and the width of the Pen in future
* it could be more having maybe a concept of Style?
* It is a class because we want to permit to change the color of a Pen doing Pen.Color = <aColor> it could have been
* a struct but struct should be immutable so...
*/
public class Pen
{
Color color;
int width;
public Pen(Color color, int width = 1)
{
if (width < 1)
throw new ArgumentOutOfRangeException($"width ({width}) cannot be less than 1");
// Contract.Requires<ArgumentOutOfRangeException>(width >= 1, "thickness");
this.color = color;
this.width = width;
}
public Color Color
{
get
{
return color;
}
set
{
color = value;
}
}
public int Width
{
get
{
return width;
}
set
{
width = value;
}
}
public override string ToString()
{
return $"color: {color} width: {width}";
}
}
}