Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.81 KB | None | 0 0
  1. /*
  2.  * Created by SharpDevelop.
  3.  * User: da
  4.  * Date: 3/27/2016
  5.  * Time: 5:01 PM
  6.  *
  7.  * To change this template use Tools | Options | Coding | Edit Standard Headers.
  8.  */
  9. using System;
  10.  
  11. namespace Page_131
  12. {
  13.     /// <summary>
  14.     /// Gets and sets the color, returns grayscale.
  15.     /// </summary>
  16.     public class Color
  17.     {
  18.        
  19.         public byte Red {get; set;}
  20.         public byte Green {get; set;}
  21.         public byte Blue {get; set;}
  22.         public byte Alpha {get; set;}
  23.        
  24.         public Color(byte red, byte green, byte blue, byte alpha)
  25.         {
  26.             Red = red;
  27.             Green = green;
  28.             Blue = blue;
  29.             Alpha = alpha;
  30.         }
  31.        
  32.         public Color(byte red, byte green, byte blue)
  33.         {
  34.             Red = red;
  35.             Green = green;
  36.             Blue = blue;
  37.             Alpha = 255;
  38.         }
  39.        
  40.         public byte GetGrayscale()
  41.         {
  42.             return (byte)((Red + Green + Blue)/3);
  43.         }
  44.    
  45.        
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement