Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
c++, how to store ARGB in 1 int.
SUBMITTED BY:
Guest
DATE:
Nov. 21, 2013, 2:58 p.m.
FORMAT:
C++
SIZE:
521 Bytes
Raw
Download
Tweet
HITS:
996
Go to comments
Report
#include
<iostream>
using
namespace
std
;
int
main
(){
//Creating in with argb values from 0 to 255
int
argb
=
(
255
&
0xff
)
+
//ALPHA
((
200
&
0xff
)
<<
8
)
+
//RED
((
150
&
0xff
)
<<
16
)
+
//GREEN
((
100
&
0xff
)
<<
24
);
//BLUE
cout
<<
"ALPHA = "
<<
(
argb
&
0xff
)
<<
endl
;
cout
<<
"RED = "
<<
((
argb
>>
8
)
&
0xff
)
<<
endl
;
cout
<<
"GREEN = "
<<
((
argb
>>
16
)
&
0xff
)
<<
endl
;
cout
<<
"BLUE = "
<<
((
argb
>>
24
)
&
0xff
)
<<
endl
;
cin
.
get
();
return
0
;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus