BrawlCrate v0.41
Wii File Editor
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
BrawlLib.Imaging.RGBAPixel Struct Reference
Inheritance diagram for BrawlLib.Imaging.RGBAPixel:

Public Member Functions

 RGBAPixel (byte r, byte g, byte b, byte a)
 
 RGBAPixel (uint u)
 
override string ToString ()
 
override int GetHashCode ()
 
override bool Equals (object obj)
 
int CompareTo (object obj)
 

Static Public Member Functions

static implicit operator RGBAPixel (ARGBPixel p)
 
static implicit operator ARGBPixel (RGBAPixel p)
 
static operator Color (RGBAPixel p)
 
static implicit operator RGBAPixel (Vector4 p)
 
static implicit operator Vector4 (RGBAPixel p)
 
static implicit operator Vector3 (RGBAPixel p)
 
static implicit operator RGBAPixel (uint u)
 
static implicit operator uint (RGBAPixel p)
 
static RGBAPixel operator& (RGBAPixel p1, RGBAPixel p2)
 
static RGBAPixel operator| (RGBAPixel p1, RGBAPixel p2)
 
static bool operator== (RGBAPixel p1, RGBAPixel p2)
 
static bool operator!= (RGBAPixel p1, RGBAPixel p2)
 
static int Compare (RGBAPixel p1, RGBAPixel p2)
 
static RGBAPixel Parse (string s)
 

Public Attributes

byte R
 
byte G
 
byte B
 
byte A
 

Static Public Attributes

const float ColorFactor = 1.0f / 255.0f
 

Properties

byte Red [get, set]
 
byte Green [get, set]
 
byte Blue [get, set]
 
byte Alpha [get, set]
 
VoidPtr Address [get]
 

Constructor & Destructor Documentation

◆ RGBAPixel() [1/2]

BrawlLib.Imaging.RGBAPixel.RGBAPixel ( byte  r,
byte  g,
byte  b,
byte  a 
)
inline
375 {
376 R = r;
377 G = g;
378 B = b;
379 A = a;
380 }
byte R
Definition: PixelTypes.cs:330
byte G
Definition: PixelTypes.cs:330
byte A
Definition: PixelTypes.cs:330
byte B
Definition: PixelTypes.cs:330

◆ RGBAPixel() [2/2]

BrawlLib.Imaging.RGBAPixel.RGBAPixel ( uint  u)
inline
383 {
384 string temp = u.ToString("X8");
385 R = Convert.ToByte(temp.Substring(0, 2), 16);
386 G = Convert.ToByte(temp.Substring(2, 2), 16);
387 B = Convert.ToByte(temp.Substring(4, 2), 16);
388 A = Convert.ToByte(temp.Substring(6, 2), 16);
389 }

Member Function Documentation

◆ Compare()

static int BrawlLib.Imaging.RGBAPixel.Compare ( RGBAPixel  p1,
RGBAPixel  p2 
)
inlinestatic
519 {
520 int v1 = *(int*) &p1;
521 int v2 = *(int*) &p2;
522
523 if (v1 > v2)
524 {
525 return 1;
526 }
527
528 if (v1 < v2)
529 {
530 return -1;
531 }
532
533 return 1;
534 }

◆ CompareTo()

int BrawlLib.Imaging.RGBAPixel.CompareTo ( object  obj)
inline
446 {
447 if (obj is RGBAPixel)
448 {
449 RGBAPixel o = (RGBAPixel) obj;
450 if (A > o.A)
451 {
452 return 1;
453 }
454
455 if (A < o.A)
456 {
457 return -1;
458 }
459
460 if (R > o.R)
461 {
462 return 1;
463 }
464
465 if (R < o.R)
466 {
467 return -1;
468 }
469
470 if (G > o.G)
471 {
472 return 1;
473 }
474
475 if (G < o.G)
476 {
477 return -1;
478 }
479
480 if (B > o.B)
481 {
482 return 1;
483 }
484
485 if (B < o.B)
486 {
487 return -1;
488 }
489
490 return 0;
491 }
492
493 return 1;
494 }

◆ Equals()

override bool BrawlLib.Imaging.RGBAPixel.Equals ( object  obj)
inline
436 {
437 if (obj is RGBAPixel)
438 {
439 return this == (RGBAPixel) obj;
440 }
441
442 return false;
443 }

◆ GetHashCode()

override int BrawlLib.Imaging.RGBAPixel.GetHashCode ( )
inline
428 {
429 fixed (RGBAPixel* p = &this)
430 {
431 return *(int*) p;
432 }
433 }

◆ operator ARGBPixel()

static implicit BrawlLib.Imaging.RGBAPixel.operator ARGBPixel ( RGBAPixel  p)
inlinestatic
338 {
339 return new ARGBPixel {A = p.A, B = p.B, G = p.G, R = p.R};
340 }

◆ operator Color()

static BrawlLib.Imaging.RGBAPixel.operator Color ( RGBAPixel  p)
inlineexplicitstatic
343 {
344 ARGBPixel a = p;
345 return Color.FromArgb((int) a);
346 }

◆ operator RGBAPixel() [1/3]

static implicit BrawlLib.Imaging.RGBAPixel.operator RGBAPixel ( ARGBPixel  p)
inlinestatic
333 {
334 return new RGBAPixel {A = p.A, B = p.B, G = p.G, R = p.R};
335 }
RGBAPixel(byte r, byte g, byte b, byte a)
Definition: PixelTypes.cs:374

◆ operator RGBAPixel() [2/3]

static implicit BrawlLib.Imaging.RGBAPixel.operator RGBAPixel ( uint  u)
inlinestatic
365 {
366 return new RGBAPixel(u);
367 }

◆ operator RGBAPixel() [3/3]

static implicit BrawlLib.Imaging.RGBAPixel.operator RGBAPixel ( Vector4  p)
inlinestatic
349 {
350 return new RGBAPixel((byte) (p._x * 255.0f), (byte) (p._y * 255.0f), (byte) (p._z * 255.0f),
351 (byte) (p._w * 255.0f));
352 }
float _x
Definition: Vector4.cs:13
float _z
Definition: Vector4.cs:13
float _y
Definition: Vector4.cs:13
float _w
Definition: Vector4.cs:13

◆ operator uint()

static implicit BrawlLib.Imaging.RGBAPixel.operator uint ( RGBAPixel  p)
inlinestatic
370 {
371 return BitConverter.ToUInt32(new byte[] {p.R, p.G, p.B, p.A}, 0);
372 }

◆ operator Vector3()

static implicit BrawlLib.Imaging.RGBAPixel.operator Vector3 ( RGBAPixel  p)
inlinestatic
360 {
361 return new Vector3(p.R / 255.0f, p.G / 255.0f, p.B / 255.0f);
362 }
Definition: Vector3.cs:40

◆ operator Vector4()

static implicit BrawlLib.Imaging.RGBAPixel.operator Vector4 ( RGBAPixel  p)
inlinestatic
355 {
356 return new Vector4(p.R / 255.0f, p.G / 255.0f, p.B / 255.0f, p.A / 255.0f);
357 }
Definition: Vector4.cs:12

◆ operator!=()

static bool BrawlLib.Imaging.RGBAPixel.operator!= ( RGBAPixel  p1,
RGBAPixel  p2 
)
inlinestatic
514 {
515 return *(int*) &p1 != *(int*) &p2;
516 }

◆ operator&()

static RGBAPixel BrawlLib.Imaging.RGBAPixel.operator& ( RGBAPixel  p1,
RGBAPixel  p2 
)
inlinestatic
497 {
498 return new RGBAPixel((byte) (p1.R & p2.R), (byte) (p1.G & p2.G), (byte) (p1.B & p2.B),
499 (byte) (p1.A & p2.A));
500 }

◆ operator==()

static bool BrawlLib.Imaging.RGBAPixel.operator== ( RGBAPixel  p1,
RGBAPixel  p2 
)
inlinestatic
509 {
510 return *(int*) &p1 == *(int*) &p2;
511 }

◆ operator|()

static RGBAPixel BrawlLib.Imaging.RGBAPixel.operator| ( RGBAPixel  p1,
RGBAPixel  p2 
)
inlinestatic
503 {
504 return new RGBAPixel((byte) (p1.R | p2.R), (byte) (p1.G | p2.G), (byte) (p1.B | p2.B),
505 (byte) (p1.A | p2.A));
506 }

◆ Parse()

static RGBAPixel BrawlLib.Imaging.RGBAPixel.Parse ( string  s)
inlinestatic
549 {
550 RGBAPixel p;
551 byte* ptr = (byte*) &p;
552 for (int i = 0; i < 8; i += 2)
553 {
554 *ptr++ = s.Length >= i + 2
555 ? byte.Parse(s.Substring(i, 2), System.Globalization.NumberStyles.HexNumber)
556 : (byte) (i == 6 ? 0xFF : 0);
557 }
558
559 return p;
560 }

◆ ToString()

override string BrawlLib.Imaging.RGBAPixel.ToString ( )
inline
422 {
423 //return String.Format("R:{0:X2} G:{1:X2} B:{2:X2} A:{3:X2}", R, G, B, A);
424 return $"R:{R} G:{G} B:{B} A:{A}";
425 }

Member Data Documentation

◆ A

byte BrawlLib.Imaging.RGBAPixel.A

◆ B

byte BrawlLib.Imaging.RGBAPixel.B

◆ ColorFactor

const float BrawlLib.Imaging.RGBAPixel.ColorFactor = 1.0f / 255.0f
static

◆ G

byte BrawlLib.Imaging.RGBAPixel.G

◆ R

byte BrawlLib.Imaging.RGBAPixel.R

Property Documentation

◆ Address

VoidPtr BrawlLib.Imaging.RGBAPixel.Address
get
538 {
539 get
540 {
541 fixed (void* p = &this)
542 {
543 return p;
544 }
545 }
546 }

◆ Alpha

byte BrawlLib.Imaging.RGBAPixel.Alpha
getset
414 {
415 get => A;
416 set => A = value;
417 }

◆ Blue

byte BrawlLib.Imaging.RGBAPixel.Blue
getset
407 {
408 get => B;
409 set => B = value;
410 }

◆ Green

byte BrawlLib.Imaging.RGBAPixel.Green
getset
400 {
401 get => G;
402 set => G = value;
403 }

◆ Red

byte BrawlLib.Imaging.RGBAPixel.Red
getset
393 {
394 get => R;
395 set => R = value;
396 }

The documentation for this struct was generated from the following file: