Created
June 1, 2014 21:26
-
-
Save Fhernd/818fbf33fe28051bdfc0 to your computer and use it in GitHub Desktop.
Estructura que representa la entidad `Color` del modelo.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ===++=== | |
// | |
// OrtizOL | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase: Color.cs | |
// | |
// Original en: http://goo.gl/cB3zpy | |
// | |
// Propósito: Representar la estructura de Color. | |
// | |
============================================================*/ | |
using System; | |
namespace ElTriangulo.Modelo | |
{ | |
/// <summary> | |
/// Estructura que representa la entidad Color. | |
/// </summary> | |
public struct Color | |
{ | |
#region Campos | |
/// <summary> | |
/// Color rojo. | |
/// </summary> | |
private int rojo; | |
/// <summary> | |
/// Color verde. | |
/// </summary> | |
private int verde; | |
/// <summary> | |
/// Color azul. | |
/// </summary> | |
private int azul; | |
#endregion | |
#region Propiedades | |
/// <summary> | |
/// Modifica y recupera el color rojo. | |
/// </summary> | |
public int Rojo | |
{ | |
get | |
{ | |
return rojo; | |
} | |
set | |
{ | |
if (value >= 0 && value <= 255) | |
rojo = value; | |
else | |
rojo = 0; | |
} | |
} | |
/// <summary> | |
/// Modifica y recupera el color verde. | |
/// </summary> | |
public int Verde | |
{ | |
get | |
{ | |
return verde; | |
} | |
set | |
{ | |
if (value >= 0 && value <= 255) | |
verde = value; | |
else | |
verde = 0; | |
} | |
} | |
/// <summary> | |
/// Modifica y recupera el color azul. | |
/// </summary> | |
public int Azul | |
{ | |
get | |
{ | |
return azul; | |
} | |
set | |
{ | |
if (value >= 0 && value <= 255) | |
azul = value; | |
else | |
azul = 0; | |
} | |
} | |
#endregion | |
#region Constructores | |
/// <summary> | |
/// Inicializa una instancia de Color. | |
/// </summary> | |
/// <param name="rojo">Intensidad de color rojo.</param> | |
/// <param name="verde">Intensidad de color verde.</param> | |
/// <param name="azul">Intensidad de color azul.</param> | |
public Color(int rojo, int verde, int azul) | |
{ | |
this.rojo = rojo; | |
this.verde = verde; | |
this.azul = azul; | |
} | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment