使用 HTML5 Canvas 绘制 CIE-1931 色度图

问题描述 投票:0回答:0

试图找出如何使用 CSS 和/或 Canvas 绘制 CIE-1931 图。一些想法

  1. 在光谱蝗虫上使用 svg 剪贴蒙版
  2. 用js和canvas手动绘制

css 中 xyz 颜色空间的主要问题,它似乎在 srgb 处裁剪,即使它应该覆盖甚至难以置信的颜色。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
<style>
.cie-diagram {
  position: relative;
  width: 300px;
  height: 300px;
  background: grey
}

.cie-square {
  position: relative;
  width: 100%;
  height: 100%;
  mix-blend-mode: color;
  background: linear-gradient(to top, color(xyz-d65, 0, 0, 1) 0%, color(xyz-d65, 0, 1, 1) 100%);
}

.cie-square::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: color;
  background: linear-gradient(to top, color(xyz-d65, 1, 0, 1) 0%, color(xyz-d65, 1, 1, 1) 100%);
  -webkit-mask: linear-gradient(to right, transparent 0, white 100%);
  mask: linear-gradient(to right, transparent 0, white 50%, transparent 100%);
}

</style>
</head>
  </head>
  <body>
    <div class="cie-diagram">
       <div class="cie-square"></div>
    </div>
  </body>
</html>

css html5-canvas
© www.soinside.com 2019 - 2024. All rights reserved.