Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
b6166b4d
Commit
b6166b4d
authored
Mar 19, 2000
by
Warren Levy
Committed by
Warren Levy
Mar 19, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* java/awt/Color.java: Rewrote to be more memory efficient (& compile).
From-SVN: r32634
parent
b8086379
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
25 deletions
+55
-25
libjava/ChangeLog
+4
-0
libjava/java/awt/Color.java
+51
-25
No files found.
libjava/ChangeLog
View file @
b6166b4d
2000-03-19 Warren Levy <warrenl@cygnus.com>
* java/awt/Color.java: Rewrote to be more memory efficient (& compile).
2000-03-16 Warren Levy <warrenl@cygnus.com>
* java/awt/Color.java: New file.
...
...
libjava/java/awt/Color.java
View file @
b6166b4d
...
...
@@ -21,25 +21,24 @@ package java.awt;
public
class
Color
extends
Object
implements
Paint
,
Serializable
{
public
static
final
Color
white
=
new
Color
(
0x
ff
,
0xff
,
0xff
);
public
static
final
Color
lightGray
=
new
Color
(
0x
c0
,
0xc0
,
0xc0
);
public
static
final
Color
gray
=
new
Color
(
0x
80
,
0x80
,
0x80
);
public
static
final
Color
darkGray
=
new
Color
(
0x
40
,
0x40
,
0x40
);
public
static
final
Color
black
=
new
Color
(
0x
00
,
0x00
,
0x00
);
public
static
final
Color
red
=
new
Color
(
0x
ff
,
0x00
,
0x00
);
public
static
final
Color
pink
=
new
Color
(
0x
ff
,
0xaf
,
0xaf
);
public
static
final
Color
orange
=
new
Color
(
0x
ff
,
0xc8
,
0x00
);
public
static
final
Color
yellow
=
new
Color
(
0x
ff
,
0xff
,
0x00
);
public
static
final
Color
green
=
new
Color
(
0x
00
,
0xff
,
0x00
);
public
static
final
Color
magenta
=
new
Color
(
0x
ff
,
0x00
,
0xff
);
public
static
final
Color
cyan
=
new
Color
(
0x
00
,
0xff
,
0xff
);
public
static
final
Color
blue
=
new
Color
(
0x
00
,
0x00
,
0xff
);
public
static
final
Color
white
=
new
Color
(
0x
FFFFFFFF
,
true
);
public
static
final
Color
lightGray
=
new
Color
(
0x
FFC0C0C0
,
true
);
public
static
final
Color
gray
=
new
Color
(
0x
FF808080
,
true
);
public
static
final
Color
darkGray
=
new
Color
(
0x
FF404040
,
true
);
public
static
final
Color
black
=
new
Color
(
0x
FF000000
,
true
);
public
static
final
Color
red
=
new
Color
(
0x
FFFF0000
,
true
);
public
static
final
Color
pink
=
new
Color
(
0x
FFFFAFAF
,
true
);
public
static
final
Color
orange
=
new
Color
(
0x
FFFFC800
,
true
);
public
static
final
Color
yellow
=
new
Color
(
0x
FFFFFF00
,
true
);
public
static
final
Color
green
=
new
Color
(
0x
FF00FF00
,
true
);
public
static
final
Color
magenta
=
new
Color
(
0x
FFFF00FF
,
true
);
public
static
final
Color
cyan
=
new
Color
(
0x
FF00FFFF
,
true
);
public
static
final
Color
blue
=
new
Color
(
0x
FF0000FF
,
true
);
// The internal sRGB representation.
private
float
r
;
private
float
g
;
private
float
b
;
private
int
alpha
=
255
;
// Alpha is bits 24-31, if hasalpha is true.
// Red is bits 16-23; Green is bits 8-15; Blue is bits 0-7.
private
int
rgba
=
0xFFFFFFFF
;
public
Color
(
int
rgb
)
{
...
...
@@ -48,17 +47,44 @@ public class Color extends Object implements Paint, Serializable
public
Color
(
int
rgba
,
boolean
hasalpha
)
{
// Alpha is bits 24-31, if hasalpha is true.
// Red is bits 16-23; Green is bits 8-15; Blue is bits 0-7.
b
=
rgb
&
0xFF
;
g
=
(
rgb
>>=
8
)
&
0xFF
;
r
=
(
rgb
>>=
8
)
&
0xFF
;
if
(
hasalpha
)
alpha
=
(
rgb
>>=
8
)
&
0xFF
;
this
.
rgba
=
rgba
;
if
(!
hasalpha
)
rgba
|=
0xFF000000
;
}
public
Color
(
int
r
,
int
g
,
int
b
)
{
this
(
r
,
g
,
b
,
0xFF
);
}
public
Color
(
int
r
,
int
g
,
int
b
,
int
a
)
{
rgba
=
a
<<
24
|
((
r
<<
16
)
&
0x00FF0000
)
|
((
g
<<
8
)
&
0x0000FF00
)
|
(
b
&
0x000000FF
);
}
public
int
getRed
()
{
return
(
rgba
>>
16
)
&
0xFF
;
}
public
int
getGreen
()
{
return
(
rgba
>>
8
)
&
0xFF
;
}
public
int
getBlue
()
{
return
rgba
&
0xFF
;
}
public
int
getAlpha
()
{
return
(
rgba
>>
24
)
&
0xFF
;
}
public
int
getRGB
()
{
return
alpha
<<
24
|
r
<<
16
|
g
<<
8
|
b
;
return
rgba
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment