mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:27:45 +00:00
LibGfx/ICC: Implement conversion between different connection spaces
If one profile uses PCSXYZ and the other PCSLAB as connection space, we now do the necessary XYZ/LAB conversion. With this and the previous commits, we can now convert from profiles that use PCSLAB with mAB, such as stress.jpeg from https://littlecms.com/blog/2020/09/09/browser-check/ : % Build/lagom/icc --name sRGB --reencode-to serenity-sRGB.icc % Build/lagom/bin/image -o out.png \ --convert-to-color-profile serenity-sRGB.icc \ ~/src/jpegfiles/stress.jpeg
This commit is contained in:
parent
9f7b33c31f
commit
b2a1130556
4 changed files with 40 additions and 10 deletions
|
@ -184,7 +184,10 @@ TEST_CASE(from_pcs)
|
|||
|
||||
auto sRGB_from_xyz = [&sRGB](FloatVector3 const& XYZ) {
|
||||
u8 rgb[3];
|
||||
MUST(sRGB->from_pcs(XYZ, rgb));
|
||||
// The first parameter, the source profile, is used to check if the PCS data is XYZ or LAB,
|
||||
// and what the source whitepoint is. We just need any profile with an XYZ PCS space,
|
||||
// so passing sRGB as source profile too is fine.
|
||||
MUST(sRGB->from_pcs(sRGB, XYZ, rgb));
|
||||
return Color(rgb[0], rgb[1], rgb[2]);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue