Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LCMS2 Rust Wrapper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eduardo Trujillo
LCMS2 Rust Wrapper
Commits
0f051b62
Commit
0f051b62
authored
7 years ago
by
Kornel
Browse files
Options
Downloads
Patches
Plain Diff
Conversions
parent
ad68ff4f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ext.rs
+33
-0
33 additions, 0 deletions
src/ext.rs
with
33 additions
and
0 deletions
src/ext.rs
+
33
−
0
View file @
0f051b62
...
...
@@ -32,6 +32,9 @@ pub trait CIEXYZExt: Sized {
/// Colorimetric space conversion.
fn
to_lab
(
&
self
,
white_point
:
&
CIEXYZ
)
->
CIELab
;
/// Decodes a XYZ value, encoded on ICC convention
fn
from_encoded
(
icc
:
&
[
u16
;
3
])
->
Self
;
}
impl
CIEXYZExt
for
CIEXYZ
{
...
...
@@ -54,6 +57,14 @@ impl CIEXYZExt for CIEXYZ {
}
out
}
fn
from_encoded
(
icc
:
&
[
u16
;
3
])
->
Self
{
let
mut
out
=
Self
::
default
();
unsafe
{
ffi
::
cmsXYZEncoded2Float
(
&
mut
out
,
icc
.as_ptr
());
}
out
}
}
/// White point
...
...
@@ -121,6 +132,12 @@ pub trait CIELabExt: Sized {
/// Encodes a Lab value, from a CIELab value to ICC v2 convention.
fn
encoded_v2
(
&
self
)
->
[
u16
;
3
];
/// Decodes a Lab value, encoded on ICC v4 convention
fn
from_encoded
(
icc
:
&
[
u16
;
3
])
->
Self
;
/// Decodes a Lab value, encoded on ICC v2 convention
fn
from_encoded_v2
(
icc
:
&
[
u16
;
3
])
->
Self
;
/// Colorimetric space conversion.
fn
to_xyz
(
&
self
,
white_point
:
&
CIEXYZ
)
->
CIEXYZ
;
}
...
...
@@ -178,6 +195,22 @@ impl CIELabExt for CIELab {
out
}
fn
from_encoded
(
icc
:
&
[
u16
;
3
])
->
Self
{
let
mut
out
=
Self
::
default
();
unsafe
{
ffi
::
cmsLabEncoded2Float
(
&
mut
out
,
icc
.as_ptr
());
}
out
}
fn
from_encoded_v2
(
icc
:
&
[
u16
;
3
])
->
Self
{
let
mut
out
=
Self
::
default
();
unsafe
{
ffi
::
cmsLabEncoded2FloatV2
(
&
mut
out
,
icc
.as_ptr
());
}
out
}
fn
to_xyz
(
&
self
,
white_point
:
&
CIEXYZ
)
->
CIEXYZ
{
let
mut
out
=
CIEXYZ
::
default
();
unsafe
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment