mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:27:35 +00:00
LibGfx: Add a XYZ->XYZNumber conversion constructor
This is useful for converting XYZs back to the on-disk format.
This commit is contained in:
parent
0ca620a286
commit
0ab3f45135
1 changed files with 10 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <LibGfx/ICC/DistinctFourCC.h>
|
||||
#include <LibGfx/ICC/Profile.h>
|
||||
#include <LibGfx/ICC/TagTypes.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace Gfx::ICC {
|
||||
|
||||
|
@ -36,6 +37,15 @@ struct XYZNumber {
|
|||
BigEndian<s15Fixed16Number> y;
|
||||
BigEndian<s15Fixed16Number> z;
|
||||
|
||||
XYZNumber() = default;
|
||||
|
||||
XYZNumber(XYZ const& xyz)
|
||||
: x(round(xyz.x * 0x1'0000))
|
||||
, y(round(xyz.y * 0x1'0000))
|
||||
, z(round(xyz.z * 0x1'0000))
|
||||
{
|
||||
}
|
||||
|
||||
operator XYZ() const
|
||||
{
|
||||
return XYZ { x / (double)0x1'0000, y / (double)0x1'0000, z / (double)0x1'0000 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue