1// Copyright 2020 Google LLC.
2// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3#include "tools/fiddle/examples.h"
4REG_FIDDLE(DCIToXYZD50, 512, 256, true, 0) {
5void draw(SkCanvas* canvas) {
6    SkColorSpacePrimaries p;
7    // DCI-P3 Primaries from https://en.wikipedia.org/wiki/DCI-P3
8    p.fRX = 0.680f; p.fRY = 0.320f;
9    p.fGX = 0.265f; p.fGY = 0.690f;
10    p.fBX = 0.150f; p.fBY = 0.060f;
11
12    // DCI-P3 D65
13    p.fWX = 0.3127f; p.fWY = 0.3290f;
14
15    // DCI-P3 Theater
16    // p.fWX = 0.314; p.fWY = 0.351;
17
18    skcms_Matrix3x3 toXYZ;
19    p.toXYZD50(&toXYZ);
20
21    for (int i = 0; i < 3; ++i) {
22        SkDebugf("%f %f %f\n", toXYZ.vals[i][0], toXYZ.vals[i][1], toXYZ.vals[i][2]);
23    }
24}
25}  // END FIDDLE
26