// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module skia.mojom;
// Mirror of SkColorType. Unsupported values and `UNKNOWN` will raise
// serialization and deserialization errors.
[Stable, Extensible]
enum ColorType {
[Default] UNKNOWN,
ALPHA_8,
RGB_565,
ARGB_4444,
RGBA_8888,
BGRA_8888,
// Note: this will fail traits deserialization.
DEPRECATED_INDEX_8,
GRAY_8,
};
// Mirror of SkAlphaType. Unsupported values and `UNKNOWN` will raise
// serialization and deserialization errors.
[Stable, Extensible]
enum AlphaType {
[Default] UNKNOWN,
ALPHA_TYPE_OPAQUE,
PREMUL,
UNPREMUL,
};
// Mirror of SkImageInfo.
[Stable]
struct ImageInfo {
ColorType color_type;
AlphaType alpha_type;
uint32 width;
uint32 height;
// Note that both `color_transfer_function` and `color_to_xyz_matrix` must
// either both be set or both be unset. Unfortunately, this struct is marked
// Stable so it's no longer possible to fix this...
// Color transfer function mapping encoded values to linear values,
// represented by this 7-parameter piecewise function:
// linear = sign(encoded) * (c*|encoded| + f) , 0 <= |encoded| < d
// = sign(encoded) * ((a*|encoded| + b)^g + e), d <= |encoded|
// (A simple gamma transfer function sets g to gamma and a to 1.)
// See SkColorSpace and skcms_TransferFunction. Null if the image has no
// explicit color space. Parameters are serialized as: g, a, b, c, d, e, f.
array<float, 7>? color_transfer_function;
// Color transformation matrix to convert colors to XYZ D50, represented as
// a row-major 3x3 matrix. See SkColorSpace::MakeRGB(). Null if the image has
// no explicit color space.
array<float, 9>? color_to_xyz_matrix;
};
// Similar to ImageInfo, but is used when only N32 ColorType is allowed. As such
// the ColorType is not transmitted over the wire at all.
struct BitmapN32ImageInfo {
AlphaType alpha_type;
uint32 width;
uint32 height;
// Color transfer function mapping encoded values to linear values,
// represented by this 7-parameter piecewise function:
// linear = sign(encoded) * (c*|encoded| + f) , 0 <= |encoded| < d
// = sign(encoded) * ((a*|encoded| + b)^g + e), d <= |encoded|
// (A simple gamma transfer function sets g to gamma and a to 1.)
// See SkColorSpace and skcms_TransferFunction. Null if the image has no
// explicit color space. Parameters are serialized as: g, a, b, c, d, e, f.
array<float, 7>? color_transfer_function;
// Color transformation matrix to convert colors to XYZ D50, represented as
// a row-major 3x3 matrix. See SkColorSpace::MakeRGB(). Null if the image has
// no explicit color space.
array<float, 9>? color_to_xyz_matrix;
};