rivalcoba

Acuarela Namespace

May 4th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2. namespace Acuarela.Primitives
  3. {
  4.     // Defining a Pixel
  5.     public class iPixel
  6.     {
  7.         // Fields | Attirbutes | Caracteristicas
  8.         int x, y;
  9.         // Properties
  10.         public int X
  11.         {
  12.             // Get
  13.             get{
  14.              return this.x;  
  15.             }
  16.             // Set
  17.             set{
  18.                 if(value < 0)
  19.                 {
  20.                     throw new Exception("> Chico malo las coordenadas no pueden ser menores que cero");
  21.                 }
  22.                 this.x = value;
  23.             }
  24.         }
  25.         public int Y
  26.         {
  27.             // Get
  28.             get{
  29.              return this.y;  
  30.             }
  31.             // Set
  32.             set{
  33.                 if(value < 0)
  34.                 {
  35.                     throw new Exception("> Chico malo las coordenadas no pueden ser menores que cero");
  36.                 }
  37.                 this.y = value;
  38.             }
  39.         }          
  40.         // Constructores
  41.         public iPixel(){}
  42.         public iPixel(int x, int y){
  43.             this.X = x;
  44.             this.Y = y;
  45.         }
  46.     }
  47.  
  48.     // Defining a rectangle class
  49.     public class iRectangle
  50.     {
  51.         // Fields
  52.         iPixel pixel1 = new iPixel(), pixel2 = new iPixel();
  53.         // Rectangle Properties
  54.         public iPixel Pixel1
  55.         {
  56.             get{
  57.                 return this.pixel1;
  58.             }
  59.             set{
  60.                 this.pixel1 = value;
  61.             }
  62.         }
  63.         public iPixel Pixel2
  64.         {
  65.             get{
  66.                 return this.pixel2;
  67.             }
  68.             set{
  69.                 this.pixel2 = value;
  70.             }
  71.         }
  72.     }
  73. }
Add Comment
Please, Sign In to add comment