Allow color conversions using static arrays instead of just vectors (e71fa7f8) · 提交 · Martin Owens / inkscape · GitLab
Martin Owens
·
2026-05-06
·
via Martin Owens activity
| 原始行号 |
差异行号 |
差异行 |
|
@@ -15,7 +15,6 @@ set(colors_unit_SRC |
|
|
spaces/cmyk.cpp
|
|
|
spaces/components.cpp
|
|
|
spaces/gamut.cpp
|
|
|
spaces/gray.cpp
|
|
|
spaces/hsl.cpp
|
|
|
spaces/hsluv.cpp
|
|
|
spaces/hsv.cpp
|
|
@@ -24,8 +23,6 @@ set(colors_unit_SRC |
|
|
spaces/linear-rgb.cpp
|
|
|
spaces/luv.cpp
|
|
|
spaces/ok-color.cpp
|
|
|
spaces/okhsl.cpp
|
|
|
spaces/okhsv.cpp
|
|
|
spaces/oklab.cpp
|
|
|
spaces/oklch.cpp
|
|
|
spaces/named.cpp
|
|
@@ -49,6 +46,7 @@ set(colors_unit_SRC |
|
|
spaces/cms.h
|
|
|
spaces/cmyk.h
|
|
|
spaces/components.h
|
|
|
spaces/convert-static.h
|
|
|
spaces/enum.h
|
|
|
spaces/gamut.h
|
|
|
spaces/gray.h
|
|
|
| 原始行号 |
差异行号 |
差异行 |
|
@@ -26,6 +26,14 @@ public: |
|
|
|
|
|
bool do_transform(std::vector<double> &io) const;
|
|
|
|
|
|
template <typename In, typename Out>
|
|
|
bool do_transform(In const &i, Out &o)
|
|
|
{
|
|
|
assert(i.size() >= _channels_in && o.size() >= _channels_out);
|
|
|
cmsDoTransform(_handle, &i.front(), &o.front(), 1);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
private:
|
|
|
|
|
|
int _channels_in;
|
|
|
| 原始行号 |
差异行号 |
差异行 |
|
@@ -159,7 +159,7 @@ bool Color::convert(Color const &other) |
|
|
*/
|
|
|
bool Color::convert(std::shared_ptr<Space::AnySpace> to_space)
|
|
|
{
|
|
|
if (!to_space || !to_space->isValid()) {
|
|
|
if (!to_space || !to_space->hasValidCmsProfile()) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
| 原始行号 |
差异行号 |
差异行 |
|
@@ -147,7 +147,7 @@ std::optional<Color> DocumentCMS::parse(std::string const &value) const |
|
|
}
|
|
|
auto space = _spaces.find(cms_name)->second;
|
|
|
|
|
|
if (!space->isValid()) {
|
|
|
if (!space->hasValidCmsProfile()) {
|
|
|
for (int i = 2; i >= 0; i--) {
|
|
|
// Assume RGB fallback data if three doubles. Else black.
|
|
|
values.insert(values.begin(), fallback.size() == 3 ? fallback[i] : 0.0);
|
|
|
| 原始行号 |
差异行号 |
差异行 |
|
@@ -20,18 +20,16 @@ namespace Inkscape::Colors::Space { |
|
|
* be used in color pickers or store data in a color field. Instead it's purely used
|
|
|
* for converting a surface of pixels into a luminosity mask while rendering.
|
|
|
*/
|
|
|
class Alpha : public AnySpace
|
|
|
class Alpha : public ProfileSpace<true>
|
|
|
{
|
|
|
public:
|
|
|
Alpha(): AnySpace(Type::Alpha, 0, "Alpha", "Alpha", "") {}
|
|
|
Alpha()
|
|
|
: ProfileSpace(Type::Alpha, 0, "Alpha", "Alpha", "")
|
|
|
{}
|
|
|
|
|
|
bool isDirect() const override { return true; }
|
|
|
std::shared_ptr<Colors::CMS::Profile> const getProfile() const override;
|
|
|
|
|
|
std::string toString(std::vector<double> const &values, bool opacity) const override
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
std::string toString(std::vector<double> const &values, bool opacity) const override { return ""; }
|
|
|
};
|
|
|
|
|
|
} // namespace Inkscape::Colors::Space
|
|
|
加载中
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。