mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 20:39:01 +00:00
- 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)
59 lines
1.4 KiB
C#
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}";
|
|
}
|
|
}
|
|
}
|