Jypeli  5
The simple game programming library
Color.cs
Siirry tämän tiedoston dokumentaatioon.
1 using System;
2 
3 using XnaColor = Microsoft.Xna.Framework.Color;
4 using System.Globalization;
5 using System.Text;
6 
7 namespace Jypeli
8 {
12  [Save]
13  public struct Color
14  {
18  [Save]
19  public byte RedComponent;
20 
24  [Save]
25  public byte GreenComponent;
26 
30  [Save]
31  public byte BlueComponent;
32 
36  [Save]
37  public byte AlphaComponent;
38 
39  internal Color( XnaColor c )
40  {
41  RedComponent = c.R;
42  GreenComponent = c.G;
43  BlueComponent = c.B;
44  AlphaComponent = c.A;
45  }
46 
47  internal XnaColor AsXnaColor()
48  {
49  return new XnaColor(
50  RedComponent, GreenComponent, BlueComponent, AlphaComponent );
51  }
52 
53  public Color( byte red, byte green, byte blue )
54  : this( red, green, blue, byte.MaxValue )
55  {
56  }
57 
58  public Color( byte red, byte green, byte blue, byte alpha )
59  {
60  RedComponent = red;
61  GreenComponent = green;
62  BlueComponent = blue;
63  AlphaComponent = alpha;
64  }
65 
66  public Color( int red, int green, int blue, int alpha )
67  : this( (byte)red, (byte)green, (byte)blue, (byte)alpha )
68  {
69  }
70 
71  public Color( int red, int green, int blue )
72  : this( (byte)red, (byte)green, (byte)blue, byte.MaxValue )
73  {
74  }
75 
76  public Color( Color rgb, byte alpha )
77  : this( rgb.RedComponent, rgb.GreenComponent, rgb.BlueComponent, alpha )
78  {
79  }
80 
81  public Color( double red, double green, double blue )
82  : this( red, green, blue, 1.0 )
83  {
84  }
85 
86  public Color( double red, double green, double blue, double alpha )
87  {
88  var xnaColor = new XnaColor(
89  (float)red,
90  (float)green,
91  (float)blue,
92  (float)alpha );
93  RedComponent = xnaColor.R;
94  GreenComponent = xnaColor.G;
95  BlueComponent = xnaColor.B;
96  AlphaComponent = xnaColor.A;
97  }
98 
107  public static uint PackRGB( byte r, byte g, byte b, byte a = 255 )
108  {
109  return (uint)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b );
110  }
111 
112 
121  public static uint PackRGB( int r, int g, int b, int a = 255 )
122  {
123  return (uint)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b );
124  }
125 
131  public static Color FromHexCode( string hexString )
132  {
133  if ( hexString.StartsWith( "#" ) )
134  hexString = hexString.Substring( 1 );
135 
136  uint hex = uint.Parse( hexString, NumberStyles.HexNumber, CultureInfo.InvariantCulture );
137  Color color = Color.White;
138 
139  if ( hexString.Length == 8 )
140  {
141  color.AlphaComponent = (byte)( hex >> 24 );
142  color.RedComponent = (byte)( hex >> 16 );
143  color.GreenComponent = (byte)( hex >> 8 );
144  color.BlueComponent = (byte)( hex );
145  }
146  else if ( hexString.Length == 6 )
147  {
148  color.RedComponent = (byte)( hex >> 16 );
149  color.GreenComponent = (byte)( hex >> 8 );
150  color.BlueComponent = (byte)( hex );
151  }
152  else
153  {
154  throw new InvalidOperationException( "Invald hex representation of an ARGB or RGB color value." );
155  }
156 
157  return color;
158  }
159 
166  public static Color FromPaintDotNet( int row, int col )
167  {
168  if ( row < 0 || row > 1 || col < 0 || col > 15 )
169  throw new ArgumentException( "Row must be between 0 and 1 and column between 0 and 15." );
170 
171  Color[,] colors = {
172  {
177  },
178  {
183  }
184  };
185 
186  return colors[row, col];
187  }
188 
194  public static byte GetAlpha( uint c )
195  {
196  return (byte)( ( c >> 24 ) & 0xff );
197  }
198 
199 
205  public static byte GetAlpha( int c )
206  {
207  return (byte)( ( c >> 24 ) & 0xff );
208  }
209 
210 
216  public static byte GetRed( uint c )
217  {
218  return (byte)( ( c >> 16 ) & 0xff );
219  }
220 
221 
227  public static byte GetGreen( uint c )
228  {
229  return (byte)( ( c >> 8 ) & 0xff );
230  }
231 
232 
238  public static byte GetBlue( uint c )
239  {
240  return (byte)( ( c >> 0 ) & 0xff );
241  }
242 
243 
249  public static Color IntToColor( int c )
250  {
251  return new Color( (byte)( ( c >> 16 ) & 0xff ), (byte)( ( c >> 8 ) & 0xff ),
252  (byte)( ( c ) & 0xff ), (byte)( ( c >> 24 ) & 0xff ) );
253  }
254 
255 
261  public static Color UIntToColor( uint c )
262  {
263  return new Color( (byte)( ( c >> 16 ) & 0xff ), (byte)( ( c >> 8 ) & 0xff ),
264  (byte)( ( c ) & 0xff ), (byte)( ( c >> 24 ) & 0xff ) );
265  }
266 
273  public static double Distance( Color a, Color b )
274  {
275  double rd = Math.Pow( a.RedComponent - b.RedComponent, 2 );
276  double gd = Math.Pow( a.GreenComponent - b.GreenComponent, 2 );
277  double bd = Math.Pow( a.BlueComponent - b.BlueComponent, 2 );
278  return Math.Sqrt( rd + gd + bd );
279  }
280 
287  internal static double Distance( XnaColor a, XnaColor b )
288  {
289  double rd = Math.Pow( a.R - b.R, 2 );
290  double gd = Math.Pow( a.G - b.G, 2 );
291  double bd = Math.Pow( a.B - b.B, 2 );
292  return Math.Sqrt( rd + gd + bd );
293  }
294 
299  public int ToInt()
300  {
301  return ( AlphaComponent << 24 ) + ( RedComponent << 16 ) + ( GreenComponent << 8 ) + BlueComponent;
302  }
303 
308  public int ToIntRGB()
309  {
310  return ( RedComponent << 16 ) + ( GreenComponent << 8 ) + BlueComponent;
311  }
312 
317  public uint ToUInt()
318  {
319  return (uint)ToInt();
320  }
321 
326  public override string ToString()
327  {
328  return ToString( true );
329  }
330 
336  public string ToString( bool alpha )
337  {
338  if ( alpha )
339  return ToInt().ToString( "X8" );
340 
341  return ToIntRGB().ToString( "X6" );
342  }
343 
344  public static bool operator ==( Color c1, Color c2 )
345  {
346  return c1.RedComponent == c2.RedComponent
347  && c1.GreenComponent == c2.GreenComponent
348  && c1.BlueComponent == c2.BlueComponent
349  && c1.AlphaComponent == c2.AlphaComponent;
350  }
351 
352 
353  public static bool operator ==( Color c1, uint i2 )
354  {
355  return c1.ToUInt() == i2;
356  }
357 
358  public static bool operator !=( Color c1, uint i2 )
359  {
360  return c1.ToUInt() != i2;
361  }
362 
363  public static bool operator ==( Color c1, int i2 )
364  {
365  return c1.ToUInt() == (uint)i2;
366  }
367 
368  public static bool operator !=( Color c1, int i2 )
369  {
370  return c1.ToUInt() != (uint)i2;
371  }
372 
373  public override int GetHashCode()
374  {
375  return ToInt();
376  }
377 
378  public override bool Equals( Object c2 )
379  {
380  if ( c2 is Color ) return this == (Color)c2;
381  if ( c2 is uint ) return this == (uint)c2;
382  if ( c2 is int ) return this == (uint)c2;
383  return false;
384  }
385 
386 
387  public static bool operator !=( Color c1, Color c2 )
388  {
389  return !( c1 == c2 );
390  }
391 
392  public static Color Lerp( Color value1, Color value2, double amount )
393  {
394  return new Color( XnaColor.Lerp(
395  value1.AsXnaColor(),
396  value2.AsXnaColor(),
397  (float)amount ) );
398  }
399 
407  public static Color Darker( Color c, int howMuch )
408  {
409  int r = (int)c.RedComponent - howMuch;
410  int g = (int)c.GreenComponent - howMuch;
411  int b = (int)c.BlueComponent - howMuch;
412  if ( r < 0 ) r = 0;
413  if ( g < 0 ) g = 0;
414  if ( b < 0 ) b = 0;
415  Microsoft.Xna.Framework.Color x = c.AsXnaColor();
416  return new Color( (byte)r, (byte)g, (byte)b, c.AlphaComponent );
417  }
418 
426  public static Color Lighter( Color c, int howMuch )
427  {
428  int r = (int)c.RedComponent + howMuch;
429  int g = (int)c.GreenComponent + howMuch;
430  int b = (int)c.BlueComponent + howMuch;
431  if ( r > byte.MaxValue ) r = byte.MaxValue;
432  if ( g > byte.MaxValue ) g = byte.MaxValue;
433  if ( b > byte.MaxValue ) b = byte.MaxValue;
434  Microsoft.Xna.Framework.Color x = c.AsXnaColor();
435  return new Color( (byte)r, (byte)g, (byte)b, c.AlphaComponent );
436  }
437 
443  public static Color Mix( params Color[] colors )
444  {
445  if (colors.Length == 0)
446  throw new ArgumentException("Color.Average needs at least one argument");
447 
448  double[] sums = new double[4];
449 
450  for (int i = 0; i < colors.Length; i++)
451  {
452  sums[0] += colors[i].RedComponent / 255.0;
453  sums[1] += colors[i].GreenComponent / 255.0;
454  sums[2] += colors[i].BlueComponent / 255.0;
455  sums[3] += colors[i].AlphaComponent / 255.0;
456  }
457 
458  return new Color(
459  sums[0] / colors.Length,
460  sums[1] / colors.Length,
461  sums[2] / colors.Length,
462  sums[3] / colors.Length
463  );
464  }
465 
469  public static readonly Color AshGray = new Color( 178, 190, 181, 255 );
470 
474  public static readonly Color Aqua = new Color( 0, 255, 255, 255 );
475 
479  public static readonly Color Aquamarine = new Color( 127, 255, 212, 255 );
480 
484  public static readonly Color Azure = new Color( 0, 148, 255, 255 );
485 
489  public static readonly Color Beige = new Color( 245, 245, 220, 255 );
490 
494  public static readonly Color Black = new Color( 0, 0, 0, 255 );
495 
499  public static readonly Color BloodRed = new Color( 127, 0, 55, 255 );
500 
504  public static readonly Color Blue = new Color( 0, 0, 255, 255 );
505 
509  public static readonly Color BlueGray = new Color( 102, 153, 204, 255 );
510 
514  public static readonly Color BrightGreen = new Color( 0, 255, 33, 255 );
515 
519  public static readonly Color Brown = new Color( 127, 51, 0, 255 );
520 
524  public static readonly Color BrownGreen = new Color( 91, 127, 0, 255 );
525 
529  public static readonly Color Crimson = new Color( 220, 20, 60, 255 );
530 
534  public static readonly Color Cyan = new Color( 0, 255, 255, 255 );
535 
539  public static readonly Color Charcoal = new Color( 54, 69, 79, 255 );
540 
544  public static readonly Color DarkAzure = new Color( 0, 74, 127, 255 );
545 
549  public static readonly Color DarkBrown = new Color( 92, 64, 51, 255 );
550 
554  public static readonly Color DarkBlue = new Color( 0, 19, 127, 255 );
555 
559  public static readonly Color DarkCyan = new Color( 0, 127, 127, 255 );
560 
564  public static readonly Color DarkForestGreen = new Color( 0, 127, 14 );
565 
569  public static readonly Color DarkGray = new Color( 64, 64, 64, 255 );
570 
574  public static readonly Color DarkGreen = new Color( 0, 100, 0, 255 );
575 
579  public static readonly Color DarkJungleGreen = new Color( 0, 127, 70, 255 );
580 
584  public static readonly Color DarkMagenta = Color.Purple;
585 
589  public static readonly Color DarkOrange = Color.Brown;
590 
594  public static readonly Color DarkRed = new Color( 127, 0, 0, 255 );
595 
599  public static readonly Color DarkTurquoise = new Color( 0, 206, 209, 255 );
600 
604  public static readonly Color DarkViolet = new Color( 87, 0, 127, 255 );
605 
609  public static readonly Color DarkYellow = Color.Olive;
610 
614  public static readonly Color DarkYellowGreen = Color.BrownGreen;
615 
619  public static readonly Color Emerald = new Color( 80, 200, 120, 255 );
620 
624  public static readonly Color ForestGreen = new Color( 38, 127, 0 );
625 
629  public static readonly Color Fuchsia = new Color( 255, 0, 255, 255 );
630 
634  public static readonly Color Gold = new Color( 255, 216, 0, 255 );
635 
639  public static readonly Color Gray = new Color( 128, 128, 128, 255 );
640 
644  public static readonly Color Green = new Color( 0, 128, 0, 255 );
645 
649  public static readonly Color GreenYellow = new Color( 173, 255, 47, 255 );
650 
654  public static readonly Color HanPurple = new Color( 72, 0, 255, 255 );
655 
659  public static readonly Color Harlequin = new Color( 76, 255, 0, 255 );
660 
664  public static readonly Color HotPink = new Color( 255, 105, 180, 255 );
665 
669  public static readonly Color Ivory = new Color( 255, 255, 240, 255 );
670 
674  public static readonly Color JungleGreen = new Color( 41, 171, 135, 255 );
675 
679  public static readonly Color Lavender = new Color( 220, 208, 255, 255 );
680 
684  public static readonly Color LightBlue = new Color( 173, 216, 230, 255 );
685 
689  public static readonly Color LightCyan = new Color( 224, 255, 255, 255 );
690 
694  public static readonly Color LightGray = new Color( 211, 211, 211, 255 );
695 
699  public static readonly Color LightGreen = new Color( 144, 238, 144, 255 );
700 
704  public static readonly Color LightPink = new Color( 255, 182, 193, 255 );
705 
709  public static readonly Color LightYellow = new Color( 255, 255, 224, 255 );
710 
714  public static readonly Color Lime = new Color( 0, 255, 0, 255 );
715 
719  public static readonly Color LimeGreen = new Color( 50, 205, 50, 255 );
720 
724  public static readonly Color Magenta = new Color( 255, 0, 255, 255 );
725 
729  public static readonly Color Maroon = new Color( 128, 0, 0, 255 );
730 
734  public static readonly Color MediumBlue = new Color( 0, 0, 205, 255 );
735 
739  public static readonly Color MediumPurple = new Color( 147, 112, 219, 255 );
740 
744  public static readonly Color MediumTurquoise = new Color( 72, 209, 204, 255 );
745 
749  public static readonly Color MediumVioletRed = new Color( 199, 21, 133, 255 );
750 
754  public static readonly Color MidnightBlue = new Color( 33, 0, 127, 255 );
755 
759  public static readonly Color Mint = new Color( 62, 180, 137, 255 );
760 
764  public static readonly Color Navy = new Color( 0, 0, 128, 255 );
765 
769  public static readonly Color Olive = new Color( 127, 106, 0, 255 );
770 
774  public static readonly Color Orange = new Color( 255, 106, 0, 255 );
775 
779  public static readonly Color OrangeRed = new Color( 255, 69, 0, 255 );
780 
784  public static readonly Color PaintDotNetBlue = new Color( 0, 38, 255, 255 );
785 
789  public static readonly Color PaintDotNetMagenta = new Color( 255, 0, 220, 255 );
790 
794  public static readonly Color Pink = new Color( 255, 192, 203, 255 );
795 
799  public static readonly Color Purple = new Color( 127, 0, 110, 255 );
800 
804  public static readonly Color Red = new Color( 255, 0, 0, 255 );
805 
809  public static readonly Color Rose = new Color( 255, 0, 110, 255 );
810 
814  public static readonly Color RosePink = new Color( 251, 204, 231, 255 );
815 
819  public static readonly Color Ruby = new Color( 224, 17, 95, 255 );
820 
824  public static readonly Color Salmon = new Color( 250, 128, 114, 255 );
825 
829  public static readonly Color SeaGreen = new Color( 46, 139, 87, 255 );
830 
834  public static readonly Color Silver = new Color( 192, 192, 192, 255 );
835 
839  public static readonly Color SkyBlue = new Color( 135, 206, 235, 255 );
840 
844  public static readonly Color SlateBlue = new Color( 106, 90, 205, 255 );
845 
849  public static readonly Color SlateGray = new Color( 112, 128, 144, 255 );
850 
854  public static readonly Color Snow = new Color( 255, 250, 250, 255 );
855 
859  public static readonly Color SpringGreen = new Color( 0, 255, 144, 255 );
860 
864  public static readonly Color Teal = new Color( 0, 128, 128, 255 );
865 
869  public static readonly Color Transparent = new Color( XnaColor.Transparent );
870 
874  public static readonly Color Turquoise = new Color( 64, 224, 208, 255 );
875 
879  public static readonly Color Ultramarine = new Color( 18, 10, 143, 255 );
880 
884  public static readonly Color Violet = new Color( 178, 0, 255, 255 );
885 
889  public static readonly Color Wheat = new Color( 245, 222, 179, 255 );
890 
894  public static readonly Color White = new Color( 255, 255, 255, 255 );
895 
899  public static readonly Color Yellow = new Color( 255, 255, 0, 255 );
900 
904  public static readonly Color YellowGreen = new Color( 182, 255, 0, 255 );
905  }
906 }
static Color UIntToColor(uint c)
Tekee kokonaisluvusta värin
Definition: Color.cs:261
static readonly Color HanPurple
Sinipurppurainen väri Han-dynastian ajoilta.
Definition: Color.cs:654
static byte GetGreen(uint c)
Ottaa kokonaisluvusta vihreän värin
Definition: Color.cs:227
byte BlueComponent
Sininen värikomponentti välillä 0-255
Definition: Color.cs:31
static readonly Color Silver
Hopea.
Definition: Color.cs:834
static Color Mix(params Color[] colors)
Sekoittaa kahta tai useampaa väriä.
Definition: Color.cs:443
static readonly Color LightPink
Vaalea vaaleanpunainen.
Definition: Color.cs:704
static readonly Color Beige
Beessi.
Definition: Color.cs:489
static readonly Color LightYellow
Vaalea keltainen.
Definition: Color.cs:709
static readonly Color Green
Vihreä.
Definition: Color.cs:644
int ToInt()
Muuttaa värin ARGB-kokonaisluvuksi
Definition: Color.cs:299
static readonly Color SkyBlue
Taivaansininen.
Definition: Color.cs:839
static readonly Color DarkAzure
Tumma asuuri.
Definition: Color.cs:544
Color(double red, double green, double blue, double alpha)
Definition: Color.cs:86
static readonly Color Black
Musta.
Definition: Color.cs:494
static readonly Color Crimson
Karmiininpunainen.
Definition: Color.cs:529
static readonly Color Teal
Sinivihreä.
Definition: Color.cs:864
static readonly Color Aquamarine
Akvamariini.
Definition: Color.cs:479
static readonly Color DarkMagenta
Tumma magenta (purppura).
Definition: Color.cs:584
Color(int red, int green, int blue, int alpha)
Definition: Color.cs:66
static readonly Color LightGray
Vaalea harmaa.
Definition: Color.cs:694
byte GreenComponent
Vihreä värikomponentti välillä 0-255
Definition: Color.cs:25
static readonly Color Red
Punainen.
Definition: Color.cs:804
static double Distance(Color a, Color b)
Laskee kahden värin (euklidisen) etäisyyden RGB-väriavaruudessa. Värikomponentit ovat välillä 0-255 j...
Definition: Color.cs:273
static readonly Color Cyan
Syaani.
Definition: Color.cs:534
static readonly Color DarkOrange
Tumma oranssi / ruskea.
Definition: Color.cs:589
static readonly Color Purple
Purppura.
Definition: Color.cs:799
static readonly Color DarkBlue
Tumma sininen.
Definition: Color.cs:554
static readonly Color DarkYellowGreen
Tumma keltavihreä (ruskeanvihreä).
Definition: Color.cs:614
static readonly Color LightBlue
Vaalea sininen.
Definition: Color.cs:684
static readonly Color SlateBlue
Saviliuskeensininen.
Definition: Color.cs:844
static Color Darker(Color c, int howMuch)
Antaa tummemman värin. Vähentaa jokaista kolmea osaväriä arvon howMuch verran.
Definition: Color.cs:407
static readonly Color Fuchsia
Fuksia (pinkki)
Definition: Color.cs:629
static readonly Color DarkTurquoise
Tumma turkoosi.
Definition: Color.cs:599
static readonly Color LimeGreen
Limetinvihreä.
Definition: Color.cs:719
static bool operator!=(Color c1, uint i2)
Definition: Color.cs:358
Color(int red, int green, int blue)
Definition: Color.cs:71
static readonly Color Brown
Ruskea.
Definition: Color.cs:519
static readonly Color Violet
Violetti.
Definition: Color.cs:884
static readonly Color Lime
Limetti.
Definition: Color.cs:714
static readonly Color MidnightBlue
Keskiyön sininen.
Definition: Color.cs:754
static readonly Color Rose
Rose (punainen).
Definition: Color.cs:809
Color(double red, double green, double blue)
Definition: Color.cs:81
byte RedComponent
Punainen värikomponentti välillä 0-255
Definition: Color.cs:19
static readonly Color Snow
Lumenvalkoinen.
Definition: Color.cs:854
static Color FromHexCode(string hexString)
Palauttaa heksakoodia vastaavan värin.
Definition: Color.cs:131
static readonly Color Lavender
Laventeli.
Definition: Color.cs:679
static readonly Color OrangeRed
Punaoranssi.
Definition: Color.cs:779
static readonly Color Orange
Oranssi.
Definition: Color.cs:774
static readonly Color Mint
Mintunvihreä.
Definition: Color.cs:759
static readonly Color MediumPurple
Tummahko purppura.
Definition: Color.cs:739
Color(byte red, byte green, byte blue)
Definition: Color.cs:53
static Color FromPaintDotNet(int row, int col)
Antaa värin Paint.net -ohjelman paletista.
Definition: Color.cs:166
static readonly Color SlateGray
Saviliuskeenharmaa.
Definition: Color.cs:849
static readonly Color Yellow
Keltainen.
Definition: Color.cs:899
static byte GetBlue(uint c)
Ottaa kokonaisluvusta sinisen värin
Definition: Color.cs:238
static readonly Color Ultramarine
Ultramariini (tumma sininen).
Definition: Color.cs:879
static readonly Color RosePink
Rose-pinkki.
Definition: Color.cs:814
uint ToUInt()
Muuttaa värin ARGB-kokonaisluvuksi
Definition: Color.cs:317
static Color IntToColor(int c)
Tekee kokonaisluvusta värin
Definition: Color.cs:249
static readonly Color MediumVioletRed
Tummahko punavioletti.
Definition: Color.cs:749
static Color Lerp(Color value1, Color value2, double amount)
Definition: Color.cs:392
static readonly Color DarkViolet
Tumma violetti.
Definition: Color.cs:604
Color(byte red, byte green, byte blue, byte alpha)
Definition: Color.cs:58
static byte GetAlpha(uint c)
Ottaa kokonaisluvusta alpha-arvon
Definition: Color.cs:194
static readonly Color Gray
Harmaa.
Definition: Color.cs:639
static readonly Color DarkJungleGreen
Tumma viidakonvihreä.
Definition: Color.cs:579
Microsoft.Xna.Framework.Color XnaColor
Definition: Color.cs:3
static readonly Color MediumTurquoise
Tummahko turkoosi.
Definition: Color.cs:744
static readonly Color DarkCyan
Tumma syaani.
Definition: Color.cs:559
static readonly Color Magenta
Magenta (pinkki)
Definition: Color.cs:724
static readonly Color Ivory
Norsunluu.
Definition: Color.cs:669
string ToString(bool alpha)
Palautetaan väri heksamerkkijonona.
Definition: Color.cs:336
static readonly Color Transparent
Läpinäkyvä väri.
Definition: Color.cs:869
static readonly Color LightGreen
Vaalea vihreä.
Definition: Color.cs:699
static readonly Color Wheat
Luonnonvalkoinen.
Definition: Color.cs:889
static readonly Color Pink
Vaaleanpunainen.
Definition: Color.cs:794
static readonly Color SeaGreen
Merensininen.
Definition: Color.cs:829
static readonly Color Aqua
Vedensininen.
Definition: Color.cs:474
static readonly Color Olive
Oliivi (tumma keltainen).
Definition: Color.cs:769
static readonly Color PaintDotNetMagenta
Paint.NETin magenta (pinkki) väri.
Definition: Color.cs:789
static readonly Color DarkBrown
Tumma ruskea.
Definition: Color.cs:549
override bool Equals(Object c2)
Definition: Color.cs:378
static readonly Color GreenYellow
Keltavihreä.
Definition: Color.cs:649
static readonly Color BloodRed
Verenpunainen.
Definition: Color.cs:499
static readonly Color SpringGreen
Kevään vihreä.
Definition: Color.cs:859
static readonly Color Azure
Asuurinsininen.
Definition: Color.cs:484
static uint PackRGB(int r, int g, int b, int a=255)
Pakkaa kolme kokonaislukua väriä vastaavaksi kokonaisluvuksi
Definition: Color.cs:121
static readonly Color HotPink
Pinkki.
Definition: Color.cs:664
static readonly Color DarkForestGreen
Tumma metsänvihreä.
Definition: Color.cs:564
static readonly Color BrownGreen
Ruskeanvihreä.
Definition: Color.cs:524
static readonly Color DarkGreen
Tumma vihreä.
Definition: Color.cs:574
static readonly Color Turquoise
Turkoosi.
Definition: Color.cs:874
static byte GetAlpha(int c)
Ottaa kokonaisluvusta alpha-arvon
Definition: Color.cs:205
static readonly Color Maroon
Viininpunainen.
Definition: Color.cs:729
static readonly Color Emerald
Smaragdinvihreä.
Definition: Color.cs:619
static readonly Color Blue
Sininen.
Definition: Color.cs:504
static readonly Color Gold
Kulta.
Definition: Color.cs:634
static readonly Color BrightGreen
Kirkkaan vihreä.
Definition: Color.cs:514
byte AlphaComponent
Läpinäkymättömyys välillä 0-255
Definition: Color.cs:37
override string ToString()
Palautetaan väri heksamerkkijonona
Definition: Color.cs:326
Väri.
Definition: Color.cs:13
static bool operator==(Color c1, Color c2)
Definition: Color.cs:344
static readonly Color AshGray
Tuhkanharmaa.
Definition: Color.cs:469
static uint PackRGB(byte r, byte g, byte b, byte a=255)
Pakkaa kolme kokonaislukua väriä vastaavaksi kokonaisluvuksi
Definition: Color.cs:107
Color(Color rgb, byte alpha)
Definition: Color.cs:76
static readonly Color LightCyan
Vaalea syaani.
Definition: Color.cs:689
static readonly Color Harlequin
Harlekiini (hieman keltaisella sävytetty kirkas vihreä).
Definition: Color.cs:659
static byte GetRed(uint c)
Ottaa kokonaisluvusta punaisen värin
Definition: Color.cs:216
static readonly Color BlueGray
Siniharmaa.
Definition: Color.cs:509
static readonly Color PaintDotNetBlue
Paint.NETin sininen väri.
Definition: Color.cs:784
static readonly Color DarkGray
Tumma harmaa.
Definition: Color.cs:569
static readonly Color DarkRed
Tumma punainen.
Definition: Color.cs:594
static readonly Color ForestGreen
Metsänvihreä.
Definition: Color.cs:624
static readonly Color MediumBlue
Tummahko sininen.
Definition: Color.cs:734
static readonly Color Salmon
Lohenpunainen.
Definition: Color.cs:824
static readonly Color DarkYellow
Tumma keltainen (oliivi).
Definition: Color.cs:609
static readonly Color White
Valkoinen.
Definition: Color.cs:894
static readonly Color JungleGreen
Viidakonvihreä.
Definition: Color.cs:674
static readonly Color Navy
Laivastonsininen.
Definition: Color.cs:764
static Color Lighter(Color c, int howMuch)
Antaa kirkkaamman värin. Kasvattaa jokaista kolmea osaväriä arvon howMuch verran. ...
Definition: Color.cs:426
override int GetHashCode()
Definition: Color.cs:373
static readonly Color YellowGreen
Keltavihreä.
Definition: Color.cs:904
static readonly Color Ruby
Rubiininpunainen.
Definition: Color.cs:819
int ToIntRGB()
Muuttaa värin RGB-kokonaisluvuksi
Definition: Color.cs:308
static readonly Color Charcoal
Hiilenmusta.
Definition: Color.cs:539