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

Public Member Functions

 ARGBPixel (byte a, byte r, byte g, byte b)
 
 ARGBPixel (byte intensity)
 
 ARGBPixel (SerializationInfo info, StreamingContext context)
 
int DistanceTo (Color c)
 
int DistanceTo (ARGBPixel p)
 
float Luminance ()
 
bool IsGreyscale ()
 
int Greyscale ()
 
ARGBPixel Min (ARGBPixel p)
 
ARGBPixel Max (ARGBPixel p)
 
override string ToString ()
 
string ToHexString ()
 
string ToPaddedString ()
 
string ToARGBColorCode ()
 
string ToRGBAColorCode ()
 
override int GetHashCode ()
 
override bool Equals (object obj)
 
void GetObjectData (SerializationInfo info, StreamingContext context)
 

Static Public Member Functions

static operator ARGBPixel (int val)
 
static operator int (ARGBPixel p)
 
static operator ARGBPixel (uint val)
 
static operator uint (ARGBPixel p)
 
static operator ARGBPixel (Color val)
 
static operator Color (ARGBPixel p)
 
static operator Vector3 (ARGBPixel p)
 
static implicit operator Vector4 (ARGBPixel p)
 
static bool operator== (ARGBPixel p1, ARGBPixel p2)
 
static bool operator!= (ARGBPixel p1, ARGBPixel p2)
 

Public Attributes

byte B
 
byte G
 
byte R
 
byte A
 

Constructor & Destructor Documentation

◆ ARGBPixel() [1/3]

BrawlLib.Imaging.ARGBPixel.ARGBPixel ( byte  a,
byte  r,
byte  g,
byte  b 
)
inline
23 {
24 A = a;
25 R = r;
26 G = g;
27 B = b;
28 }
byte B
Definition: PixelTypes.cs:20
byte A
Definition: PixelTypes.cs:20
byte G
Definition: PixelTypes.cs:20
byte R
Definition: PixelTypes.cs:20

◆ ARGBPixel() [2/3]

BrawlLib.Imaging.ARGBPixel.ARGBPixel ( byte  intensity)
inline
31 {
32 A = 255;
33 R = intensity;
34 G = intensity;
35 B = intensity;
36 }

◆ ARGBPixel() [3/3]

BrawlLib.Imaging.ARGBPixel.ARGBPixel ( SerializationInfo  info,
StreamingContext  context 
)
inline
39 {
40 B = info.GetByte("B");
41 G = info.GetByte("G");
42 R = info.GetByte("R");
43 A = info.GetByte("A");
44 }

Member Function Documentation

◆ DistanceTo() [1/2]

int BrawlLib.Imaging.ARGBPixel.DistanceTo ( ARGBPixel  p)
inline
60 {
61 int val = A - p.A;
62 int dist = val * val;
63 val = R - p.R;
64 dist += val * val;
65 val = G - p.G;
66 dist += val * val;
67 val = B - p.B;
68 return dist + val;
69 }

◆ DistanceTo() [2/2]

int BrawlLib.Imaging.ARGBPixel.DistanceTo ( Color  c)
inline
47 {
48 int val = A - c.A;
49 int dist = val * val;
50 val = R - c.R;
51 dist += val * val;
52 val = G - c.G;
53 dist += val * val;
54 val = B - c.B;
55 dist += val * val;
56 return dist;
57 }

◆ Equals()

override bool BrawlLib.Imaging.ARGBPixel.Equals ( object  obj)
inline
177 {
178 if (obj is ARGBPixel)
179 {
180 return (ARGBPixel) obj == this;
181 }
182
183 return false;
184 }

◆ GetHashCode()

override int BrawlLib.Imaging.ARGBPixel.GetHashCode ( )
inline
172 {
173 return (int) this;
174 }

◆ GetObjectData()

void BrawlLib.Imaging.ARGBPixel.GetObjectData ( SerializationInfo  info,
StreamingContext  context 
)
inline
204 {
205 info.AddValue("B", B);
206 info.AddValue("G", G);
207 info.AddValue("R", R);
208 info.AddValue("A", A);
209 }

◆ Greyscale()

int BrawlLib.Imaging.ARGBPixel.Greyscale ( )
inline
82 {
83 return (R + G + B) / 3;
84 }

◆ IsGreyscale()

bool BrawlLib.Imaging.ARGBPixel.IsGreyscale ( )
inline
77 {
78 return R == G && G == B;
79 }

◆ Luminance()

float BrawlLib.Imaging.ARGBPixel.Luminance ( )
inline
72 {
73 return 0.299f * R + 0.587f * G + 0.114f * B;
74 }

◆ Max()

ARGBPixel BrawlLib.Imaging.ARGBPixel.Max ( ARGBPixel  p)
inline
132 {
133 return new ARGBPixel(Math.Max(A, p.A), Math.Max(R, p.R), Math.Max(G, p.G), Math.Max(B, p.B));
134 }
ARGBPixel(byte a, byte r, byte g, byte b)
Definition: PixelTypes.cs:22

◆ Min()

ARGBPixel BrawlLib.Imaging.ARGBPixel.Min ( ARGBPixel  p)
inline
127 {
128 return new ARGBPixel(Math.Min(A, p.A), Math.Min(R, p.R), Math.Min(G, p.G), Math.Min(B, p.B));
129 }

◆ operator ARGBPixel() [1/3]

static BrawlLib.Imaging.ARGBPixel.operator ARGBPixel ( Color  val)
inlineexplicitstatic
107 {
108 return (ARGBPixel) val.ToArgb();
109 }

◆ operator ARGBPixel() [2/3]

static BrawlLib.Imaging.ARGBPixel.operator ARGBPixel ( int  val)
inlineexplicitstatic
87 {
88 return *(ARGBPixel*) &val;
89 }

◆ operator ARGBPixel() [3/3]

static BrawlLib.Imaging.ARGBPixel.operator ARGBPixel ( uint  val)
inlineexplicitstatic
97 {
98 return *(ARGBPixel*) &val;
99 }

◆ operator Color()

static BrawlLib.Imaging.ARGBPixel.operator Color ( ARGBPixel  p)
inlineexplicitstatic
112 {
113 return Color.FromArgb((int) p);
114 }

◆ operator int()

static BrawlLib.Imaging.ARGBPixel.operator int ( ARGBPixel  p)
inlineexplicitstatic
92 {
93 return *(int*) &p;
94 }

◆ operator uint()

static BrawlLib.Imaging.ARGBPixel.operator uint ( ARGBPixel  p)
inlineexplicitstatic
102 {
103 return *(uint*) &p;
104 }

◆ operator Vector3()

static BrawlLib.Imaging.ARGBPixel.operator Vector3 ( ARGBPixel  p)
inlineexplicitstatic
117 {
118 return new Vector3(p.R * ColorFactor, p.G * ColorFactor, p.B * ColorFactor);
119 }
Definition: Vector3.cs:40

◆ operator Vector4()

static implicit BrawlLib.Imaging.ARGBPixel.operator Vector4 ( ARGBPixel  p)
inlinestatic
122 {
123 return new Vector4(p.R * ColorFactor, p.G * ColorFactor, p.B * ColorFactor, p.A * ColorFactor);
124 }
Definition: Vector4.cs:12

◆ operator!=()

static bool BrawlLib.Imaging.ARGBPixel.operator!= ( ARGBPixel  p1,
ARGBPixel  p2 
)
inlinestatic
142 {
143 return *(uint*) &p1 != *(uint*) &p2;
144 }

◆ operator==()

static bool BrawlLib.Imaging.ARGBPixel.operator== ( ARGBPixel  p1,
ARGBPixel  p2 
)
inlinestatic
137 {
138 return *(uint*) &p1 == *(uint*) &p2;
139 }

◆ ToARGBColorCode()

string BrawlLib.Imaging.ARGBPixel.ToARGBColorCode ( )
inline
162 {
163 return $"{A:X2}{R:X2}{G:X2}{B:X2}";
164 }

◆ ToHexString()

string BrawlLib.Imaging.ARGBPixel.ToHexString ( )
inline
152 {
153 return $"A:{A:X2} R:{R:X2} G:{G:X2} B:{B:X2}";
154 }

◆ ToPaddedString()

string BrawlLib.Imaging.ARGBPixel.ToPaddedString ( )
inline
157 {
158 return $"A:{A,3} R:{R,3} G:{G,3} B:{B,3}";
159 }

◆ ToRGBAColorCode()

string BrawlLib.Imaging.ARGBPixel.ToRGBAColorCode ( )
inline
167 {
168 return $"{R:X2}{G:X2}{B:X2}{A:X2}";
169 }

◆ ToString()

override string BrawlLib.Imaging.ARGBPixel.ToString ( )
inline
147 {
148 return $"A:{A} R:{R} G:{G} B:{B}";
149 }

Member Data Documentation

◆ A

byte BrawlLib.Imaging.ARGBPixel.A

◆ B

byte BrawlLib.Imaging.ARGBPixel.B

◆ G

byte BrawlLib.Imaging.ARGBPixel.G

◆ R

byte BrawlLib.Imaging.ARGBPixel.R

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