Struct FrameSpan
Value representation of a span of frames
public readonly struct FrameSpan : IComparable<FrameSpan>, IUtf8SpanFormattable, IFormattable, IComparisonOperators<FrameSpan, FrameSpan, bool>, IEqualityOperators<FrameSpan, FrameSpan, bool>, IAdditionOperators<FrameSpan, FrameSpan, FrameSpan>, ISubtractionOperators<FrameSpan, FrameSpan, FrameSpan>, IModulusOperators<FrameSpan, int, FrameSpan>, IAdditionOperators<FrameSpan, int, FrameSpan>, IMultiplyOperators<FrameSpan, int, FrameSpan>, ISubtractionOperators<FrameSpan, int, FrameSpan>, IAdditionOperators<FrameSpan, Frame, FrameSpan>, ISubtractionOperators<FrameSpan, Frame, FrameSpan>, IEquatable<FrameSpan>
- Implements
- Inherited Members
Constructors
FrameSpan(int)
Initialize new FrameSpan for frame frameCount
.
public FrameSpan(int frameCount)
Parameters
frameCount
int
Fields
DefaultFramesPerSecond
Default FPS(frames per second)
public const short DefaultFramesPerSecond = 60
Field Value
FrameCount
public readonly int FrameCount
Field Value
MaxValue
Returns max frame span value
public static readonly FrameSpan MaxValue
Field Value
One
Return frame span of 1
frame
public static readonly FrameSpan One
Field Value
Zero
Return frame span of 0
frames
public static readonly FrameSpan Zero
Field Value
Properties
FrameValue
Returns the value for the current frame span as a Frame.
public Frame FrameValue { get; }
Property Value
Methods
Abs(in FrameSpan)
Returns the absolute value of a Frame.
public static FrameSpan Abs(in FrameSpan frame)
Parameters
frame
FrameSpan
Returns
Clamp(in FrameSpan, in Frame, in Frame)
Clamps frame value to a range
public static FrameSpan Clamp(in FrameSpan frame, in Frame min, in Frame max)
Parameters
Returns
Clamp(in FrameSpan, in FrameSpan, in FrameSpan)
Clamps frame value to a range
public static FrameSpan Clamp(in FrameSpan frame, in FrameSpan min, in FrameSpan max)
Parameters
Returns
Clamp(in FrameSpan, int, int)
Clamps frame value to a range
public static FrameSpan Clamp(in FrameSpan frame, int min, int max)
Parameters
Returns
CompareTo(FrameSpan)
public int CompareTo(FrameSpan other)
Parameters
other
FrameSpan
Returns
Duration(short)
Returns the time value for the current frame span in TimeSpan.
public TimeSpan Duration(short fps = 60)
Parameters
fps
short
Returns
Equals(FrameSpan)
public bool Equals(FrameSpan other)
Parameters
other
FrameSpan
Returns
Equals(object)
public override bool Equals(object obj)
Parameters
obj
object
Returns
FromMilliseconds(double, short)
Returns new FrameSpan for milliseconds
at specified fps
.
public static FrameSpan FromMilliseconds(double milliseconds, short fps = 60)
Parameters
Returns
FromSeconds(double, short)
Returns new FrameSpan for seconds
at specified fps
.
public static FrameSpan FromSeconds(double seconds, short fps = 60)
Parameters
Returns
FromTimeSpan(TimeSpan, short)
Returns new FrameSpan for time
at specified fps
.
public static FrameSpan FromTimeSpan(TimeSpan time, short fps = 60)
Parameters
Returns
GetDuration(int, short)
Returns TimeSpan for frameCount
at specified fps
.
public static TimeSpan GetDuration(int frameCount, short fps = 60)
Parameters
Returns
GetFrameAt(TimeSpan, short)
Returns frame at the timespan position
public Frame GetFrameAt(TimeSpan duration, short fps = 60)
Parameters
Returns
GetFrameAtMilliSecond(double, short)
Returns frame at the time position in milliseconds
public Frame GetFrameAtMilliSecond(double millis, short fps = 60)
Parameters
Returns
GetFrameAtSecond(double, short)
Returns frame at the time position in seconds
public Frame GetFrameAtSecond(double seconds, short fps = 60)
Parameters
Returns
GetHashCode()
public override int GetHashCode()
Returns
InSeconds(int, short)
Returns double seconds for frameCount
at specified fps
.
public static double InSeconds(int frameCount, short fps = 60)
Parameters
Returns
Max(in FrameSpan, in FrameSpan)
Returns the larger of two FrameSpan.
public static FrameSpan Max(in FrameSpan left, in FrameSpan right)
Parameters
Returns
Min(in FrameSpan, in FrameSpan)
Returns the smaller of two FrameSpan.
public static FrameSpan Min(in FrameSpan left, in FrameSpan right)
Parameters
Returns
Of(int)
Initialize new FrameSpan for frame frameCount
.
public static FrameSpan Of(int frameCount)
Parameters
frameCount
int
Returns
Seconds(short)
Returns the time value for the current frame span in seconds
public double Seconds(short fps = 60)
Parameters
fps
short
Returns
ToString()
public override string ToString()
Returns
ToString(string?, IFormatProvider?)
public string ToString(string? format, IFormatProvider? formatProvider)
Parameters
format
stringformatProvider
IFormatProvider
Returns
TryFormat(Span<byte>, out int, ReadOnlySpan<char>, IFormatProvider?)
public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
Parameters
utf8Destination
Span<byte>bytesWritten
intformat
ReadOnlySpan<char>provider
IFormatProvider
Returns
Operators
operator *(int, FrameSpan)
public static FrameSpan operator *(int left, FrameSpan right)
Parameters
Returns
Explicit Interface Implementations
operator +(FrameSpan, Frame)
static FrameSpan operator +(FrameSpan left, Frame right)
Parameters
Returns
operator +(FrameSpan, FrameSpan)
static FrameSpan operator +(FrameSpan left, FrameSpan right)
Parameters
Returns
operator +(FrameSpan, int)
static FrameSpan operator +(FrameSpan left, int right)
Parameters
Returns
operator ==(FrameSpan, FrameSpan)
static bool operator ==(FrameSpan left, FrameSpan right)
Parameters
Returns
operator >(FrameSpan, FrameSpan)
static bool operator >(FrameSpan left, FrameSpan right)
Parameters
Returns
operator >=(FrameSpan, FrameSpan)
static bool operator >=(FrameSpan left, FrameSpan right)
Parameters
Returns
operator !=(FrameSpan, FrameSpan)
static bool operator !=(FrameSpan left, FrameSpan right)
Parameters
Returns
operator <(FrameSpan, FrameSpan)
static bool operator <(FrameSpan left, FrameSpan right)
Parameters
Returns
operator <=(FrameSpan, FrameSpan)
static bool operator <=(FrameSpan left, FrameSpan right)
Parameters
Returns
operator %(FrameSpan, int)
static FrameSpan operator %(FrameSpan left, int right)
Parameters
Returns
operator *(FrameSpan, int)
static FrameSpan operator *(FrameSpan left, int right)
Parameters
Returns
operator -(FrameSpan, Frame)
static FrameSpan operator -(FrameSpan left, Frame right)
Parameters
Returns
operator -(FrameSpan, FrameSpan)
static FrameSpan operator -(FrameSpan left, FrameSpan right)
Parameters
Returns
operator -(FrameSpan, int)
static FrameSpan operator -(FrameSpan left, int right)