Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
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
liuqiang
skiko
Commits
d53b7857
Unverified
Commit
d53b7857
authored
Sep 22, 2021
by
alexander-gorshenev
Committed by
GitHub
Sep 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added basic color constants into Color object (#207)
parent
b8a4a399
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
App.kt
...ativeMain/kotlin/org.jetbrains.skiko.sample.native/App.kt
+2
-6
Color.kt
skiko/src/commonMain/kotlin/org/jetbrains/skia/Color.kt
+10
-0
No files found.
samples/SkiaNativeSample/src/nativeMain/kotlin/org.jetbrains.skiko.sample.native/App.kt
View file @
d53b7857
...
@@ -50,13 +50,9 @@ fun displayScene(renderer: Renderer, nanoTime: Long) {
...
@@ -50,13 +50,9 @@ fun displayScene(renderer: Renderer, nanoTime: Long) {
val
canvas
=
renderer
.
canvas
!!
val
canvas
=
renderer
.
canvas
!!
val
paint
=
Paint
()
val
paint
=
Paint
()
// TODO: make color constants.
paint
.
setColor
(
Color
.
GREEN
)
//paint.setColor(Color.GREEN)
paint
.
setColor
(
0
xFF00FF00
.
toInt
())
// TODO: make color constants.
canvas
.
clear
(
Color
.
RED
)
// canvas.clear(Color.RED)
canvas
.
clear
(
0
xFFFF0000
.
toInt
())
canvas
.
save
();
canvas
.
save
();
canvas
.
translate
(
128.0f
,
128.0f
)
canvas
.
translate
(
128.0f
,
128.0f
)
...
...
skiko/src/commonMain/kotlin/org/jetbrains/skia/Color.kt
View file @
d53b7857
...
@@ -59,4 +59,14 @@ object Color {
...
@@ -59,4 +59,14 @@ object Color {
require
(
0
<=
b
&&
b
<=
255
)
{
"Blue is out of 0..255 range: $b"
}
require
(
0
<=
b
&&
b
<=
255
)
{
"Blue is out of 0..255 range: $b"
}
return
b
and
0
xFF
or
(
color
and
-
0
x100
)
return
b
and
0
xFF
or
(
color
and
-
0
x100
)
}
}
const
val
TRANSPARENT
:
Int
=
0
x00_00_00_00
const
val
BLACK
:
Int
=
0
xFF_00_00_00
.
toInt
()
const
val
WHITE
:
Int
=
0
xFF_FF_FF_FF
.
toInt
()
const
val
RED
:
Int
=
0
xFF_FF_00_00
.
toInt
()
const
val
GREEN
:
Int
=
0
xFF_00_FF_00
.
toInt
()
const
val
BLUE
:
Int
=
0
xFF_00_00_FF
.
toInt
()
const
val
YELLOW
:
Int
=
0
xFF_FF_FF_00
.
toInt
()
const
val
CYAN
:
Int
=
0
xFF_00_FF_FF
.
toInt
()
const
val
MAGENTA
:
Int
=
0
xFF_FF_00_FF
.
toInt
()
}
}
\ No newline at end of file
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