blob: e2db6c2396c538cd1dd68bdd1df097fe49c040e0 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.accessibility;
/// Specifies color correction mode.
enum ColorCorrectionMode {
/// No color correction.
DISABLED = 0;
/// Color correction for protanomaly (red-green -- reduced sensitivity to red light).
CORRECT_PROTANOMALY = 1;
/// Color correction for deuteranomaly (red-green -- reduced sensitivity to green light).
CORRECT_DEUTERANOMALY = 2;
/// Color correction for tritanomaly (blue-yellow -- reduced sensitivity to blue light).
CORRECT_TRITANOMALY = 3;
};
/// The current configuration for accessibility color transforms, which includes color inversion and
/// color correction. This always includes the matrix required to apply the appropriate transforms.
/// Color correction and color inversion may be active simultaneously.
///
/// For original RGB value (r, g, b) (each component ranged between 0 and 1), the RGB value of
/// corrected color (r', g', b') is
/// (r', g', b') = color_adjustment_post_offset
/// + color_adjustment_matrix . ((r, g, b) + color_adjustment_pre_offset).
table ColorTransformConfiguration {
/// When color_inversion_enabled is true, certain colors are inverted across the entire screen.
/// If this field is omitted behavior should remain unchanged.
1: bool color_inversion_enabled;
/// When color_correction is set to DISABLED, colors are displayed normally. When
/// color_correction has different value, colors are modified to correct for the specified type
/// of color blindness. If this field is omitted behavior should remain unchanged.
2: ColorCorrectionMode color_correction;
/// 3x3 Matrix in row-major form which will be used by root presenter to apply color correction
/// and color inversion, or a combination fo the two. This field should always be set.
3: array<float32>:9 color_adjustment_matrix;
/// 3x1 vector which is used by root presenter as an offset added to the original RGB color,
/// before it multiplies with the |color_adjustment_matrix|. This field should always be set.
4: array<float32>:3 color_adjustment_pre_offset;
/// 3x1 vector which is used by root presenter as an offset added to the multiplied result
/// of |color_adjustment_matrix| and original RGB color. This field should always be set.
5: array<float32>:3 color_adjustment_post_offset;
};
/// Handler implemented by the owner of the presentation. Accessibility manager uses this protocol
/// to make changes to the screen's color transform.
protocol ColorTransformHandler {
/// Called when the color transform configuration has changed.
SetColorTransformConfiguration(ColorTransformConfiguration configuration) -> ();
};
/// Allows a presentation owner to register a handler for color transforms. This API is implemented
/// by the Accessibility manager and called by Root Presenter.
[Discoverable]
protocol ColorTransform {
/// Registers a handler for changes in the color transform configuration.
RegisterColorTransformHandler(ColorTransformHandler handler);
};