Jypeli 10
The simple game programming library
Color.cs
Siirry tämän tiedoston dokumentaatioon.
1using System;
2
3using XnaColor = Microsoft.Xna.Framework.Color;
4using System.Globalization;
5
6namespace Jypeli
7{
11 [Save]
12 public struct Color
13 {
17 [Save]
18 public byte RedComponent;
19
23 [Save]
24 public byte GreenComponent;
25
29 [Save]
30 public byte BlueComponent;
31
35 [Save]
36 public byte AlphaComponent;
37
38 internal Color( XnaColor c )
39 {
40 RedComponent = c.R;
41 GreenComponent = c.G;
42 BlueComponent = c.B;
43 AlphaComponent = c.A;
44 }
45
47 {
48 return new XnaColor(
50 }
51
58 public Color( byte red, byte green, byte blue )
59 : this( red, green, blue, byte.MaxValue )
60 {
61 }
62
70 public Color( byte red, byte green, byte blue, byte alpha )
71 {
72 RedComponent = red;
73 GreenComponent = green;
74 BlueComponent = blue;
75 AlphaComponent = alpha;
76 }
77
85 public Color( int red, int green, int blue, int alpha )
86 : this( (byte)red, (byte)green, (byte)blue, (byte)alpha )
87 {
88 }
89
96 public Color( int red, int green, int blue )
97 : this( (byte)red, (byte)green, (byte)blue, byte.MaxValue )
98 {
99 }
100
106 public Color( Color rgb, byte alpha )
107 : this( rgb.RedComponent, rgb.GreenComponent, rgb.BlueComponent, alpha )
108 {
109 }
110
117 public Color( double red, double green, double blue )
118 : this( red, green, blue, 1.0 )
119 {
120 }
121
129 public Color( double red, double green, double blue, double alpha )
130 {
131 var xnaColor = new XnaColor(
132 (float)red,
133 (float)green,
134 (float)blue,
135 (float)alpha );
136 RedComponent = xnaColor.R;
137 GreenComponent = xnaColor.G;
138 BlueComponent = xnaColor.B;
139 AlphaComponent = xnaColor.A;
140 }
141
150 public static uint PackRGB( byte r, byte g, byte b, byte a = 255 )
151 {
152 return (uint)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b );
153 }
154
155
164 public static uint PackRGB( int r, int g, int b, int a = 255 )
165 {
166 return (uint)( ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b );
167 }
168
174 public static Color FromHexCode( string hexString )
175 {
176 if ( hexString.StartsWith( "#" ) )
177 hexString = hexString.Substring( 1 );
178
179 uint hex = uint.Parse( hexString, NumberStyles.HexNumber, CultureInfo.InvariantCulture );
180 Color color = Color.White;
181
182 if ( hexString.Length == 8 )
183 {
184 color.AlphaComponent = (byte)( hex >> 24 );
185 color.RedComponent = (byte)( hex >> 16 );
186 color.GreenComponent = (byte)( hex >> 8 );
187 color.BlueComponent = (byte)( hex );
188 }
189 else if ( hexString.Length == 6 )
190 {
191 color.RedComponent = (byte)( hex >> 16 );
192 color.GreenComponent = (byte)( hex >> 8 );
193 color.BlueComponent = (byte)( hex );
194 }
195 else
196 {
197 throw new InvalidOperationException( "Invald hex representation of an ARGB or RGB color value." );
198 }
199
200 return color;
201 }
202
209 public static Color FromPaintDotNet( int row, int col )
210 {
211 if ( row < 0 || row > 1 || col < 0 || col > 15 )
212 throw new ArgumentException( "Row must be between 0 and 1 and column between 0 and 15." );
213
214 Color[,] colors = {
215 {
220 },
221 {
226 }
227 };
228
229 return colors[row, col];
230 }
231
232
233
239 public static byte GetAlpha( uint c )
240 {
241 return (byte)( ( c >> 24 ) & 0xff );
242 }
243
244
250 public static byte GetAlpha( int c )
251 {
252 return (byte)( ( c >> 24 ) & 0xff );
253 }
254
255
261 public static byte GetRed( uint c )
262 {
263 return (byte)( ( c >> 16 ) & 0xff );
264 }
265
266
272 public static byte GetGreen( uint c )
273 {
274 return (byte)( ( c >> 8 ) & 0xff );
275 }
276
277
283 public static byte GetBlue( uint c )
284 {
285 return (byte)( ( c >> 0 ) & 0xff );
286 }
287
288
294 public static Color IntToColor( int c )
295 {
296 return new Color( (byte)( ( c >> 16 ) & 0xff ), (byte)( ( c >> 8 ) & 0xff ),
297 (byte)( ( c ) & 0xff ), (byte)( ( c >> 24 ) & 0xff ) );
298 }
299
300
306 public static Color UIntToColor( uint c )
307 {
308 return new Color( (byte)( ( c >> 16 ) & 0xff ), (byte)( ( c >> 8 ) & 0xff ),
309 (byte)( ( c ) & 0xff ), (byte)( ( c >> 24 ) & 0xff ) );
310 }
311
318 public static double Distance( Color a, Color b )
319 {
320 double rd = Math.Pow( a.RedComponent - b.RedComponent, 2 );
321 double gd = Math.Pow( a.GreenComponent - b.GreenComponent, 2 );
322 double bd = Math.Pow( a.BlueComponent - b.BlueComponent, 2 );
323 return Math.Sqrt( rd + gd + bd );
324 }
325
332 internal static double Distance( XnaColor a, XnaColor b )
333 {
334 double rd = Math.Pow( a.R - b.R, 2 );
335 double gd = Math.Pow( a.G - b.G, 2 );
336 double bd = Math.Pow( a.B - b.B, 2 );
337 return Math.Sqrt( rd + gd + bd );
338 }
339
344 public int ToInt()
345 {
346 return ( AlphaComponent << 24 ) + ( RedComponent << 16 ) + ( GreenComponent << 8 ) + BlueComponent;
347 }
348
353 public int ToIntRGB()
354 {
355 return ( RedComponent << 16 ) + ( GreenComponent << 8 ) + BlueComponent;
356 }
357
362 public uint ToUInt()
363 {
364 return (uint)ToInt();
365 }
366
371 public override string ToString()
372 {
373 return ToString( true );
374 }
375
381 public string ToString( bool alpha )
382 {
383 if ( alpha )
384 return ToInt().ToString( "X8" );
385
386 return ToIntRGB().ToString( "X6" );
387 }
388
389#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
390 public static bool operator ==( Color c1, Color c2 )
391 {
392 return c1.RedComponent == c2.RedComponent
394 && c1.BlueComponent == c2.BlueComponent
395 && c1.AlphaComponent == c2.AlphaComponent;
396 }
397
398
399 public static bool operator ==( Color c1, uint i2 )
400 {
401 return c1.ToUInt() == i2;
402 }
403
404 public static bool operator !=( Color c1, uint i2 )
405 {
406 return c1.ToUInt() != i2;
407 }
408
409 public static bool operator ==( Color c1, int i2 )
410 {
411 return c1.ToUInt() == (uint)i2;
412 }
413
414 public static bool operator !=( Color c1, int i2 )
415 {
416 return c1.ToUInt() != (uint)i2;
417 }
418
419 public override int GetHashCode()
420 {
421 return ToInt();
422 }
423
424 public override bool Equals( Object c2 )
425 {
426 if ( c2 is Color ) return this == (Color)c2;
427 if ( c2 is uint ) return this == (uint)c2;
428 if ( c2 is int ) return this == (uint)c2;
429 return false;
430 }
431
432 public static bool operator !=( Color c1, Color c2 )
433 {
434 return !( c1 == c2 );
435 }
436
437 public static explicit operator XnaColor( Color color )
438 {
439 return color.AsXnaColor();
440 }
441
442 public static explicit operator Color( XnaColor color )
443 {
444 return new Color( color );
445 }
446#pragma warning restore CS1591 // Missing XML comment for publicly visible type or member
447
455 public static Color Lerp( Color value1, Color value2, double amount )
456 {
457 return new Color( XnaColor.Lerp(
458 value1.AsXnaColor(),
459 value2.AsXnaColor(),
460 (float)amount ) );
461 }
462
470 public static Color Darker( Color c, int howMuch )
471 {
472 int r = (int)c.RedComponent - howMuch;
473 int g = (int)c.GreenComponent - howMuch;
474 int b = (int)c.BlueComponent - howMuch;
475 if ( r < 0 ) r = 0;
476 if ( g < 0 ) g = 0;
477 if ( b < 0 ) b = 0;
478 Microsoft.Xna.Framework.Color x = c.AsXnaColor();
479 return new Color( (byte)r, (byte)g, (byte)b, c.AlphaComponent );
480 }
481
489 public static Color Lighter( Color c, int howMuch )
490 {
491 int r = (int)c.RedComponent + howMuch;
492 int g = (int)c.GreenComponent + howMuch;
493 int b = (int)c.BlueComponent + howMuch;
494 if ( r > byte.MaxValue ) r = byte.MaxValue;
495 if ( g > byte.MaxValue ) g = byte.MaxValue;
496 if ( b > byte.MaxValue ) b = byte.MaxValue;
497 Microsoft.Xna.Framework.Color x = c.AsXnaColor();
498 return new Color( (byte)r, (byte)g, (byte)b, c.AlphaComponent );
499 }
505 public static Color Mix( params Color[] colors )
506 {
507 if (colors.Length == 0)
508 throw new ArgumentException("Color.Average needs at least one argument");
509
510 double[] sums = new double[4];
511
512 for (int i = 0; i < colors.Length; i++)
513 {
514 sums[0] += colors[i].RedComponent / 255.0;
515 sums[1] += colors[i].GreenComponent / 255.0;
516 sums[2] += colors[i].BlueComponent / 255.0;
517 sums[3] += colors[i].AlphaComponent / 255.0;
518 }
519
520 return new Color(
521 sums[0] / colors.Length,
522 sums[1] / colors.Length,
523 sums[2] / colors.Length,
524 sums[3] / colors.Length
525 );
526 }
527
531 public static readonly Color AshGray = new Color( 178, 190, 181, 255 );
532
536 public static readonly Color Aqua = new Color( 0, 255, 255, 255 );
537
541 public static readonly Color Aquamarine = new Color( 127, 255, 212, 255 );
542
546 public static readonly Color Azure = new Color( 0, 148, 255, 255 );
547
551 public static readonly Color Beige = new Color( 245, 245, 220, 255 );
552
556 public static readonly Color Black = new Color( 0, 0, 0, 255 );
557
561 public static readonly Color BloodRed = new Color( 127, 0, 55, 255 );
562
566 public static readonly Color Blue = new Color( 0, 0, 255, 255 );
567
571 public static readonly Color BlueGray = new Color( 102, 153, 204, 255 );
572
576 public static readonly Color BrightGreen = new Color( 0, 255, 33, 255 );
577
581 public static readonly Color Brown = new Color( 127, 51, 0, 255 );
582
586 public static readonly Color BrownGreen = new Color( 91, 127, 0, 255 );
587
591 public static readonly Color Crimson = new Color( 220, 20, 60, 255 );
592
596 public static readonly Color Cyan = new Color( 0, 255, 255, 255 );
597
601 public static readonly Color Charcoal = new Color( 54, 69, 79, 255 );
602
606 public static readonly Color DarkAzure = new Color( 0, 74, 127, 255 );
607
611 public static readonly Color DarkBrown = new Color( 92, 64, 51, 255 );
612
616 public static readonly Color DarkBlue = new Color( 0, 19, 127, 255 );
617
621 public static readonly Color DarkCyan = new Color( 0, 127, 127, 255 );
622
626 public static readonly Color DarkForestGreen = new Color( 0, 127, 14 );
627
631 public static readonly Color DarkGray = new Color( 64, 64, 64, 255 );
632
636 public static readonly Color DarkGreen = new Color( 0, 100, 0, 255 );
637
641 public static readonly Color DarkJungleGreen = new Color( 0, 127, 70, 255 );
642
646 public static readonly Color DarkOrange = Color.Brown;
647
651 public static readonly Color DarkRed = new Color( 127, 0, 0, 255 );
652
656 public static readonly Color DarkTurquoise = new Color( 0, 206, 209, 255 );
657
661 public static readonly Color DarkViolet = new Color( 87, 0, 127, 255 );
662
666 public static readonly Color DarkYellow = Color.Olive;
667
671 public static readonly Color DarkYellowGreen = Color.BrownGreen;
672
676 public static readonly Color Emerald = new Color( 80, 200, 120, 255 );
677
681 public static readonly Color ForestGreen = new Color( 38, 127, 0 );
682
686 public static readonly Color Fuchsia = new Color( 255, 0, 255, 255 );
687
691 public static readonly Color Gold = new Color( 255, 216, 0, 255 );
692
696 public static readonly Color Gray = new Color( 128, 128, 128, 255 );
697
701 public static readonly Color Green = new Color( 0, 128, 0, 255 );
702
706 public static readonly Color GreenYellow = new Color( 173, 255, 47, 255 );
707
711 public static readonly Color HanPurple = new Color( 72, 0, 255, 255 );
712
716 public static readonly Color Harlequin = new Color( 76, 255, 0, 255 );
717
721 public static readonly Color HotPink = new Color( 255, 105, 180, 255 );
722
726 public static readonly Color Ivory = new Color( 255, 255, 240, 255 );
727
731 public static readonly Color JungleGreen = new Color( 41, 171, 135, 255 );
732
736 public static readonly Color Lavender = new Color( 220, 208, 255, 255 );
737
741 public static readonly Color LightBlue = new Color( 173, 216, 230, 255 );
742
746 public static readonly Color LightCyan = new Color( 224, 255, 255, 255 );
747
751 public static readonly Color LightGray = new Color( 211, 211, 211, 255 );
752
756 public static readonly Color LightGreen = new Color( 144, 238, 144, 255 );
757
761 public static readonly Color LightPink = new Color( 255, 182, 193, 255 );
762
766 public static readonly Color LightYellow = new Color( 255, 255, 224, 255 );
767
771 public static readonly Color Lime = new Color( 0, 255, 0, 255 );
772
776 public static readonly Color LimeGreen = new Color( 50, 205, 50, 255 );
777
781 public static readonly Color Magenta = new Color( 255, 0, 255, 255 );
782
786 public static readonly Color Maroon = new Color( 128, 0, 0, 255 );
787
791 public static readonly Color MediumBlue = new Color( 0, 0, 205, 255 );
792
796 public static readonly Color MediumPurple = new Color( 147, 112, 219, 255 );
797
801 public static readonly Color MediumTurquoise = new Color( 72, 209, 204, 255 );
802
806 public static readonly Color MediumVioletRed = new Color( 199, 21, 133, 255 );
807
811 public static readonly Color MidnightBlue = new Color( 33, 0, 127, 255 );
812
816 public static readonly Color Mint = new Color( 62, 180, 137, 255 );
817
821 public static readonly Color Navy = new Color( 0, 0, 128, 255 );
822
826 public static readonly Color Olive = new Color( 127, 106, 0, 255 );
827
831 public static readonly Color Orange = new Color( 255, 106, 0, 255 );
832
836 public static readonly Color OrangeRed = new Color( 255, 69, 0, 255 );
837
841 public static readonly Color PaintDotNetBlue = new Color( 0, 38, 255, 255 );
842
846 public static readonly Color PaintDotNetMagenta = new Color( 255, 0, 220, 255 );
847
851 public static readonly Color Pink = new Color( 255, 192, 203, 255 );
852
856 public static readonly Color Purple = new Color( 127, 0, 110, 255 );
857
861 public static readonly Color DarkMagenta = Color.Purple;
862
866 public static readonly Color Red = new Color( 255, 0, 0, 255 );
867
871 public static readonly Color Rose = new Color( 255, 0, 110, 255 );
872
876 public static readonly Color RosePink = new Color( 251, 204, 231, 255 );
877
881 public static readonly Color Ruby = new Color( 224, 17, 95, 255 );
882
886 public static readonly Color Salmon = new Color( 250, 128, 114, 255 );
887
891 public static readonly Color SeaGreen = new Color( 46, 139, 87, 255 );
892
896 public static readonly Color Silver = new Color( 192, 192, 192, 255 );
897
901 public static readonly Color SkyBlue = new Color( 135, 206, 235, 255 );
902
906 public static readonly Color SlateBlue = new Color( 106, 90, 205, 255 );
907
911 public static readonly Color SlateGray = new Color( 112, 128, 144, 255 );
912
916 public static readonly Color Snow = new Color( 255, 250, 250, 255 );
917
921 public static readonly Color SpringGreen = new Color( 0, 255, 144, 255 );
922
926 public static readonly Color Teal = new Color( 0, 128, 128, 255 );
927
931 public static readonly Color Transparent = new Color( XnaColor.Transparent );
932
936 public static readonly Color Turquoise = new Color( 64, 224, 208, 255 );
937
941 public static readonly Color Ultramarine = new Color( 18, 10, 143, 255 );
942
946 public static readonly Color Violet = new Color( 178, 0, 255, 255 );
947
951 public static readonly Color Wheat = new Color( 245, 222, 179, 255 );
952
956 public static readonly Color White = new Color( 255, 255, 255, 255 );
957
961 public static readonly Color Yellow = new Color( 255, 255, 0, 255 );
962
966 public static readonly Color YellowGreen = new Color( 182, 255, 0, 255 );
967 }
968}
Microsoft.Xna.Framework.Color XnaColor
Definition: Color.cs:3
Microsoft.Xna.Framework.Color XnaColor
Väri.
Definition: Color.cs:13
static readonly Color LimeGreen
Limetinvihreä.
Definition: Color.cs:776
static readonly Color BrightGreen
Kirkkaan vihreä.
Definition: Color.cs:576
static uint PackRGB(int r, int g, int b, int a=255)
Pakkaa kolme kokonaislukua väriä vastaavaksi kokonaisluvuksi
Definition: Color.cs:164
static readonly Color LightYellow
Vaalea keltainen.
Definition: Color.cs:766
static bool operator==(Color c1, Color c2)
Definition: Color.cs:390
static readonly Color DarkOrange
Tumma oranssi / ruskea.
Definition: Color.cs:646
static readonly Color Olive
Oliivi (tumma keltainen).
Definition: Color.cs:826
static readonly Color Cyan
Syaani.
Definition: Color.cs:596
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:318
static Color IntToColor(int c)
Tekee kokonaisluvusta värin
Definition: Color.cs:294
static readonly Color Purple
Purppura.
Definition: Color.cs:856
static readonly Color JungleGreen
Viidakonvihreä.
Definition: Color.cs:731
static readonly Color Blue
Sininen.
Definition: Color.cs:566
static readonly Color Azure
Asuurinsininen.
Definition: Color.cs:546
static readonly Color MediumPurple
Tummahko purppura.
Definition: Color.cs:796
static readonly Color MediumBlue
Tummahko sininen.
Definition: Color.cs:791
static readonly Color ForestGreen
Metsänvihreä.
Definition: Color.cs:681
static readonly Color Charcoal
Hiilenmusta.
Definition: Color.cs:601
static readonly Color Ruby
Rubiininpunainen.
Definition: Color.cs:881
static byte GetRed(uint c)
Ottaa kokonaisluvusta punaisen värin
Definition: Color.cs:261
static readonly Color Crimson
Karmiininpunainen.
Definition: Color.cs:591
static readonly Color BloodRed
Verenpunainen.
Definition: Color.cs:561
static readonly Color Pink
Vaaleanpunainen.
Definition: Color.cs:851
static readonly Color White
Valkoinen.
Definition: Color.cs:956
uint ToUInt()
Muuttaa värin ARGB-kokonaisluvuksi
Definition: Color.cs:362
static readonly Color Yellow
Keltainen.
Definition: Color.cs:961
static readonly Color SpringGreen
Kevään vihreä.
Definition: Color.cs:921
static readonly Color BlueGray
Siniharmaa.
Definition: Color.cs:571
static readonly Color Turquoise
Turkoosi.
Definition: Color.cs:936
byte BlueComponent
Sininen värikomponentti välillä 0-255
Definition: Color.cs:30
static readonly Color PaintDotNetMagenta
Paint.NETin magenta (pinkki) väri.
Definition: Color.cs:846
static readonly Color Gold
Kulta.
Definition: Color.cs:691
Color(Color rgb, byte alpha)
Uusi väri aiemman pohjalta uudella läpinäkyvyydellä
Definition: Color.cs:106
static readonly Color SlateBlue
Saviliuskeensininen.
Definition: Color.cs:906
static byte GetGreen(uint c)
Ottaa kokonaisluvusta vihreän värin
Definition: Color.cs:272
byte RedComponent
Punainen värikomponentti välillä 0-255
Definition: Color.cs:18
static readonly Color Fuchsia
Fuksia (pinkki)
Definition: Color.cs:686
static readonly Color Emerald
Smaragdinvihreä.
Definition: Color.cs:676
static readonly Color DarkTurquoise
Tumma turkoosi.
Definition: Color.cs:656
Color(int red, int green, int blue)
Uusi väri
Definition: Color.cs:96
static byte GetAlpha(int c)
Ottaa kokonaisluvusta alpha-arvon
Definition: Color.cs:250
override string ToString()
Palautetaan väri heksamerkkijonona
Definition: Color.cs:371
static readonly Color DarkViolet
Tumma violetti.
Definition: Color.cs:661
static readonly Color PaintDotNetBlue
Paint.NETin sininen väri.
Definition: Color.cs:841
string ToString(bool alpha)
Palautetaan väri heksamerkkijonona.
Definition: Color.cs:381
Color(XnaColor c)
Definition: Color.cs:38
static readonly Color Lime
Limetti.
Definition: Color.cs:771
static Color UIntToColor(uint c)
Tekee kokonaisluvusta värin
Definition: Color.cs:306
static readonly Color Mint
Mintunvihreä.
Definition: Color.cs:816
static readonly Color Transparent
Läpinäkyvä väri.
Definition: Color.cs:931
static readonly Color Ultramarine
Ultramariini (tumma sininen).
Definition: Color.cs:941
static uint PackRGB(byte r, byte g, byte b, byte a=255)
Pakkaa kolme kokonaislukua väriä vastaavaksi kokonaisluvuksi
Definition: Color.cs:150
static readonly Color DarkMagenta
Tumma magenta (purppura).
Definition: Color.cs:861
static readonly Color Silver
Hopea.
Definition: Color.cs:896
static readonly Color Aqua
Vedensininen.
Definition: Color.cs:536
static readonly Color Rose
Rose (punainen).
Definition: Color.cs:871
static bool operator!=(Color c1, uint i2)
Definition: Color.cs:404
static Color FromHexCode(string hexString)
Palauttaa heksakoodia vastaavan värin.
Definition: Color.cs:174
Color(byte red, byte green, byte blue)
Uusi väri
Definition: Color.cs:58
static byte GetBlue(uint c)
Ottaa kokonaisluvusta sinisen värin
Definition: Color.cs:283
Color(int red, int green, int blue, int alpha)
Uusi väri
Definition: Color.cs:85
static readonly Color Magenta
Magenta (pinkki)
Definition: Color.cs:781
static readonly Color DarkGreen
Tumma vihreä.
Definition: Color.cs:636
static readonly Color Navy
Laivastonsininen.
Definition: Color.cs:821
static readonly Color Green
Vihreä.
Definition: Color.cs:701
static readonly Color BrownGreen
Ruskeanvihreä.
Definition: Color.cs:586
byte GreenComponent
Vihreä värikomponentti välillä 0-255
Definition: Color.cs:24
static readonly Color Lavender
Laventeli.
Definition: Color.cs:736
static readonly Color Black
Musta.
Definition: Color.cs:556
static readonly Color DarkRed
Tumma punainen.
Definition: Color.cs:651
static readonly Color MediumVioletRed
Tummahko punavioletti.
Definition: Color.cs:806
override int GetHashCode()
Definition: Color.cs:419
static readonly Color HanPurple
Sinipurppurainen väri Han-dynastian ajoilta.
Definition: Color.cs:711
int ToIntRGB()
Muuttaa värin RGB-kokonaisluvuksi
Definition: Color.cs:353
static readonly Color OrangeRed
Punaoranssi.
Definition: Color.cs:836
byte AlphaComponent
Läpinäkymättömyys välillä 0-255
Definition: Color.cs:36
static readonly Color DarkGray
Tumma harmaa.
Definition: Color.cs:631
override bool Equals(Object c2)
Definition: Color.cs:424
static readonly Color DarkCyan
Tumma syaani.
Definition: Color.cs:621
static readonly Color RosePink
Rose-pinkki.
Definition: Color.cs:876
static readonly Color LightGray
Vaalea harmaa.
Definition: Color.cs:751
static readonly Color Brown
Ruskea.
Definition: Color.cs:581
Color(double red, double green, double blue, double alpha)
Uusi väri
Definition: Color.cs:129
static readonly Color Teal
Sinivihreä.
Definition: Color.cs:926
static readonly Color Ivory
Norsunluu.
Definition: Color.cs:726
static readonly Color SeaGreen
Merensininen.
Definition: Color.cs:891
static readonly Color SkyBlue
Taivaansininen.
Definition: Color.cs:901
static readonly Color DarkJungleGreen
Tumma viidakonvihreä.
Definition: Color.cs:641
static readonly Color DarkForestGreen
Tumma metsänvihreä.
Definition: Color.cs:626
static readonly Color DarkBrown
Tumma ruskea.
Definition: Color.cs:611
static readonly Color AshGray
Tuhkanharmaa.
Definition: Color.cs:531
static Color Darker(Color c, int howMuch)
Antaa tummemman värin. Vähentaa jokaista kolmea osaväriä arvon howMuch verran.
Definition: Color.cs:470
Color(double red, double green, double blue)
Uusi väri
Definition: Color.cs:117
static readonly Color Red
Punainen.
Definition: Color.cs:866
int ToInt()
Muuttaa värin ARGB-kokonaisluvuksi
Definition: Color.cs:344
static readonly Color GreenYellow
Keltavihreä.
Definition: Color.cs:706
static readonly Color Orange
Oranssi.
Definition: Color.cs:831
static readonly Color Salmon
Lohenpunainen.
Definition: Color.cs:886
static Color Mix(params Color[] colors)
Sekoittaa kahta tai useampaa väriä.
Definition: Color.cs:505
static readonly Color Wheat
Luonnonvalkoinen.
Definition: Color.cs:951
static readonly Color Maroon
Viininpunainen.
Definition: Color.cs:786
static readonly Color MediumTurquoise
Tummahko turkoosi.
Definition: Color.cs:801
Color(byte red, byte green, byte blue, byte alpha)
Uusi väri
Definition: Color.cs:70
static Color FromPaintDotNet(int row, int col)
Antaa värin Paint.net -ohjelman paletista.
Definition: Color.cs:209
static readonly Color YellowGreen
Keltavihreä.
Definition: Color.cs:966
static readonly Color Beige
Beessi.
Definition: Color.cs:551
static readonly Color HotPink
Pinkki.
Definition: Color.cs:721
static Color Lerp(Color value1, Color value2, double amount)
Lineaarinen interpolaatio värien välillä
Definition: Color.cs:455
static readonly Color DarkYellowGreen
Tumma keltavihreä (ruskeanvihreä).
Definition: Color.cs:671
static readonly Color DarkBlue
Tumma sininen.
Definition: Color.cs:616
static readonly Color DarkYellow
Tumma keltainen (oliivi).
Definition: Color.cs:666
static double Distance(XnaColor a, XnaColor b)
Laskee kahden värin (euklidisen) etäisyyden RGB-väriavaruudessa. Värikomponentit ovat välillä 0-255 j...
Definition: Color.cs:332
static readonly Color LightGreen
Vaalea vihreä.
Definition: Color.cs:756
static byte GetAlpha(uint c)
Ottaa kokonaisluvusta alpha-arvon
Definition: Color.cs:239
static readonly Color DarkAzure
Tumma asuuri.
Definition: Color.cs:606
static readonly Color Violet
Violetti.
Definition: Color.cs:946
static readonly Color Harlequin
Harlekiini (hieman keltaisella sävytetty kirkas vihreä).
Definition: Color.cs:716
static readonly Color LightPink
Vaalea vaaleanpunainen.
Definition: Color.cs:761
XnaColor AsXnaColor()
Definition: Color.cs:46
static readonly Color LightCyan
Vaalea syaani.
Definition: Color.cs:746
static readonly Color Snow
Lumenvalkoinen.
Definition: Color.cs:916
static readonly Color SlateGray
Saviliuskeenharmaa.
Definition: Color.cs:911
static readonly Color LightBlue
Vaalea sininen.
Definition: Color.cs:741
static readonly Color Gray
Harmaa.
Definition: Color.cs:696
static Color Lighter(Color c, int howMuch)
Antaa kirkkaamman värin. Kasvattaa jokaista kolmea osaväriä arvon howMuch verran.
Definition: Color.cs:489
static readonly Color MidnightBlue
Keskiyön sininen.
Definition: Color.cs:811
static readonly Color Aquamarine
Akvamariini.
Definition: Color.cs:541