// %BANNER_BEGIN% // --------------------------------------------------------------------- // %COPYRIGHT_BEGIN% // Copyright (c) (2018-2022) Magic Leap, Inc. All Rights Reserved. // Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2 // Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein. // %COPYRIGHT_END% // --------------------------------------------------------------------- // %BANNER_END% namespace UnityEngine.XR.MagicLeap { using System; using UnityEngine.XR.MagicLeap.Native; /// /// MLMediaTTML Summary placeholder. /// public partial class MLMediaTTML { /// /// An unset position, width, or size. /// public const float MLTTMLDimen_Unset = -3.402823466e+38F; /// /// The cue default text size type; public enum MLTTMLTextSizeType { /// /// An unset text size type value. /// Unset = 0x7FFFFFFF, /// /// Text size is measured as a fraction of the viewport size minus the view padding. /// Fractional = 0, /// /// Text size is measured as a fraction of the viewport size, ignoring the view padding /// FractionalIgnorePadding = 1, /// /// Text size is measured in number of pixels. /// Absolute = 2, }; /// /// The cue box anchor in the direction of position. /// public enum MLTTMLAnchorType { /// /// An unset anchor type value. /// Unset = 0x7FFFFFFF, /// /// Anchors the left (for horizontal positions) or top (for vertical positions) edge of the cue box. /// Start = 0, /// /// Anchors the middle of the cue box. /// Middle = 1, /// /// Anchors the right (for horizontal positions) or bottom (for vertical positions) edge of the cue box. /// End = 2 }; /// /// The alignment of the cue text within the cue box. /// public enum MLTTMLLayoutAlignment { /// /// An unspecified alignment value. /// Unspecified = 0x7FFFFFFF, /// /// Normal alignment relative to text direction. /// Normal = 0, /// /// Centered alignment. /// Center = 1, /// /// Opposite alignment relative to text direction. /// Opposite = 2, }; /// /// The cue line type. /// public enum MLTTMLLineType { /// /// An unset line type value. /// Unset = 0x7FFFFFFF, /// /// Line position is fractional position within the viewport. /// Fraction = 0, /// /// Line position is number of lines, interpretation also depends on the line anchor type. /// Number = 1, }; /// /// TTML data structure. /// public struct MLTTMLData { /// /// Track cue start time in milliseconds. /// public long StartTimeMs { get; internal set; } /// /// Track cue end time in milliseconds. /// public long EndTimeMs { get; internal set; } /// /// The cue text encoded as UTF-8. Or null if this is an image cue. /// public string Text { get; internal set; } /// /// The alignment of the cue text within the cue box. /// public MLTTMLLayoutAlignment TextAlignment { get; internal set; } /// /// The cue image if this is an image cue, an empty image otherwise. /// public MLTTMLImage Bitmap { get; internal set; } /// /// The position of the #line_anchor of the cue box within the viewport in the direction orthogonal to the writing direction, /// or . When set, the interpretation of the value depends on the value of #line_type. /// For horizontal text and equal to , /// this is the fractional vertical position relative to the top of the viewport. /// public float Line { get; internal set; } /// /// The cue line type. indicates that #line is a fractional position within the viewport. /// indicates that #line is a line number, where the size of each line is taken to be the size /// of the first line of the cue. When #line is greater than or equal to 0 lines count from the start of the viewport, with 0 /// indicating zero offset from the start edge. When #line is negative lines count from the end of the viewport, with -1 indicating /// zero offset from the end edge. For horizontal text the line spacing is the height of the first line of the cue, and the /// start and end of the viewport are the top and bottom respectively. Note that it's particularly important to consider /// the effect of when using . /// public MLTTMLLineType LineType { get; internal set; } /// /// The cue box anchor in the direction of line. /// public MLTTMLAnchorType LineAnchor { get; internal set; } /// /// The fractional position of the #position_anchor of the cue box within the viewport in the direction orthogonal to #line, /// or . /// For horizontal text, this is the horizontal position relative to the left of the viewport. /// Note that positioning is relative to the left of the viewport even in the case of right-to-left text. /// public float Position { get; internal set; } /// /// The cue box anchor in the direction of position. /// public MLTTMLAnchorType PositionAnchor { get; internal set; } /// /// The cue box size in the writing direction, as a fraction of the viewport size or . /// public float Size { get; internal set; } /// /// The cue bitmap height as a fraction of the viewport size or /// if the bitmap should be displayed at its natural height given the bitmap dimensions and the specified #size. /// public float BitmapHeight { get; internal set; } /// /// Specifies whether or not the property is set. /// public bool WindowColorSet { get; internal set; } /// /// The cue window fill color in ARGB format. /// public uint WindowColor { get; internal set; } /// /// The cue default text size type, or or if this cue has no default text size. /// public MLTTMLTextSizeType TextSizeType { get; internal set; } /// /// The cue default text size, or if this cue has no default. /// public float TextSize { get; internal set; } /// /// Create and return an initialized version of this struct. /// /// A new instance of this struct. public static MLTTMLData Create() { return new MLTTMLData() { }; } }; /// /// Byte data for TTML image cues. /// public struct MLTTMLImage { /// /// Image size in bytes. /// public uint Size { get; private set; } /// /// Byte data of the image. /// public byte[] Data { get; private set; } /// /// Create and return an initialized version of this struct. /// public static MLTTMLImage Create() { return new MLTTMLImage() { Size = 0, Data = Array.Empty(), }; } public static MLTTMLImage Create(byte[] outBuffer, uint imageSize) { return new MLTTMLImage() { Size = imageSize, Data = outBuffer, }; } }; } }