blob: 32875fdc9975a1101076eeab07ff360d734eaf2b [file] [log] [blame]
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_GFX_SKIA_COLOR_SPACE_UTIL_H_
#define UI_GFX_SKIA_COLOR_SPACE_UTIL_H_
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkM44.h"
#if defined(STARBOARD)
#include "third_party/skia/include/third_party/skcms/skcms.h"
#else // defined(STARBOARD)
#include "third_party/skia/modules/skcms/skcms.h"
#endif // defined(STARBOARD)
#include "ui/gfx/color_space_export.h"
namespace gfx {
// Return the parameterized function in |fn|, evaluated at |x|. Note that this
// will clamp output values to the range [0, 1].
float COLOR_SPACE_EXPORT SkTransferFnEval(const skcms_TransferFunction& fn,
float x);
// Return the parameterized function in |fn|, evaluated at |x|. This will not
// clamp output values.
float COLOR_SPACE_EXPORT
SkTransferFnEvalUnclamped(const skcms_TransferFunction& fn, float x);
skcms_TransferFunction COLOR_SPACE_EXPORT
SkTransferFnInverse(const skcms_TransferFunction& fn);
skcms_TransferFunction COLOR_SPACE_EXPORT
SkTransferFnScaled(const skcms_TransferFunction& fn, float scale);
bool COLOR_SPACE_EXPORT
SkTransferFnsApproximatelyCancel(const skcms_TransferFunction& a,
const skcms_TransferFunction& b);
bool COLOR_SPACE_EXPORT
SkTransferFnIsApproximatelyIdentity(const skcms_TransferFunction& fn);
#if !defined(STARBOARD)
bool COLOR_SPACE_EXPORT SkM44IsApproximatelyIdentity(const SkM44& m);
#endif // !defined(STARBOARD)
SkM44 COLOR_SPACE_EXPORT SkM44FromRowMajor3x3(const float* scale);
} // namespace gfx
#endif // UI_GFX_SKIA_COLOR_SPACE_UTIL_H_