Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nose
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Soren
nose
Commits
f88502a3
Verified
Commit
f88502a3
authored
Dec 04, 2018
by
Soren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New ColorImpl to help with generifying
parent
6138180a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
30 deletions
+42
-30
Color.scala
nose/src/main/scala/tf/bug/nose/Color.scala
+42
-0
ColorFormat.scala
nose/src/main/scala/tf/bug/nose/ColorFormat.scala
+0
-0
package.scala
nose/src/main/scala/tf/bug/nose/implicits/package.scala
+0
-0
package.scala
nose/src/main/scala/tf/bug/nose/package.scala
+0
-0
Color.scala
src/main/scala/tf/bug/nose/Color.scala
+0
-30
No files found.
nose/src/main/scala/tf/bug/nose/Color.scala
0 → 100644
View file @
f88502a3
package
tf.bug.nose
import
tf.bug.nose.implicits._
sealed
trait
Color
{
def
rgb
:
RGBFormat
def
hsv
:
HSVFormat
}
private
case
class
ColorImpl
[
C
](
c
:
C
)(
implicit
colorFormat
:
ColorFormat
[
C
])
extends
Color
{
override
def
rgb
:
RGBFormat
=
colorFormat
.
asRGB
(
c
)
override
def
hsv
:
HSVFormat
=
colorFormat
.
asHSV
(
c
)
}
object
Color
{
def
apply
[
C:
ColorFormat
](
c
:
C
)
:
Color
=
ColorImpl
(
c
)
def
unapply
[
C:
ColorFormat
](
arg
:
Color
)
:
Option
[
C
]
=
arg
match
{
case
ColorImpl
(
c
:
C
)
=>
Some
(
c
)
case
_
=>
None
}
def
rgb
(
red
:
Double
,
green
:
Double
,
blue
:
Double
)
:
Color
=
{
Color
(
RGBFormat
(
red
,
green
,
blue
))
}
def
rgb
(
red
:
Int
,
green
:
Int
,
blue
:
Int
)
:
Color
=
{
Color
(
RGBFormat
(
red
/
255.0
,
green
/
255.0
,
blue
/
255.0
))
}
def
rgb
(
rgb
:
Int
)
:
Color
=
{
val
red
=
(
rgb
>>
16
)
&
0xFF
val
green
=
(
rgb
>>
8
)
&
0xFF
val
blue
=
rgb
&
0xFF
Color
.
rgb
(
red
,
green
,
blue
)
}
}
src/main/scala/tf/bug/nose/ColorFormat.scala
→
nose/
src/main/scala/tf/bug/nose/ColorFormat.scala
View file @
f88502a3
File moved
src/main/scala/tf/bug/nose/implicits/package.scala
→
nose/
src/main/scala/tf/bug/nose/implicits/package.scala
View file @
f88502a3
File moved
src/main/scala/tf/bug/nose/package.scala
→
nose/
src/main/scala/tf/bug/nose/package.scala
View file @
f88502a3
File moved
src/main/scala/tf/bug/nose/Color.scala
deleted
100644 → 0
View file @
6138180a
package
tf.bug.nose
import
tf.bug.nose
import
tf.bug.nose.implicits._
case
class
Color
[
C
](
c
:
C
)(
implicit
colorFormat
:
ColorFormat
[
C
])
{
def
rgb
:
RGBFormat
=
colorFormat
.
asRGB
(
c
)
def
hsv
:
HSVFormat
=
colorFormat
.
asHSV
(
c
)
}
object
Color
{
def
rgb
(
red
:
Double
,
green
:
Double
,
blue
:
Double
)
:
Color
[
RGBFormat
]
=
{
Color
(
nose
.
RGBFormat
(
red
,
green
,
blue
))
}
def
rgb
(
red
:
Int
,
green
:
Int
,
blue
:
Int
)
:
Color
[
RGBFormat
]
=
{
Color
(
nose
.
RGBFormat
(
red
/
255.0
,
green
/
255.0
,
blue
/
255.0
))
}
def
rgb
(
rgb
:
Int
)
:
Color
[
RGBFormat
]
=
{
val
red
=
(
rgb
>>
16
)
&
0xFF
val
green
=
(
rgb
>>
8
)
&
0xFF
val
blue
=
rgb
&
0xFF
Color
.
rgb
(
red
,
green
,
blue
)
}
}
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