Guest User

Color.cs

a guest
Jun 2nd, 2016
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace TryItOutClasses
  8. {
  9.     public class Color
  10.     {
  11.         public int red;
  12.         public int green;
  13.         public int blue;
  14.         public int transparency;
  15.  
  16.         public Color(int red, int green, int blue, int transparency)
  17.         {
  18.             this.red = red;
  19.             this.green = green;
  20.             this.blue = blue;
  21.             this.transparency = transparency;
  22.         }
  23.         public Color(int red, int green, int blue)
  24.         {
  25.             this.red = red;
  26.             this.green = green;
  27.             this.blue = blue;
  28.             transparency = 255;
  29.         }
  30.  
  31.         public int RetriveRed()
  32.         {
  33.             return red;
  34.         }
  35.         public int RetriveGreen()
  36.         {
  37.             return green;
  38.         }
  39.         public int RetriveBlue()
  40.         {
  41.             return blue;
  42.         }
  43.         public int RetriveTransparency()
  44.         {
  45.             return transparency;
  46.         }
  47.         public float RetriveGrayscale()
  48.         {
  49.             float grayscale = (red + green + blue) / 3;
  50.             return grayscale;
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment