/// <summary>
 /// Gets or sets the data at the requested co-ordinates.
 /// </summary>
 /// <remarks>
 /// For reading/writing single elements, using the this member is recommended, but may be slow when attempting
 /// to copy large sections of the data. In these circumstances, consider using something like
 /// <see cref="UnsafeUtils.CopyGenericArray{T}(Ophidian.Losgap.ArraySlice{T},System.IntPtr,uint)"/> /
 /// <see cref="UnsafeUtils.CopyGenericArray{T}(System.IntPtr,Ophidian.Losgap.ArraySlice{T},uint)"/> in combination with the
 /// <see cref="Data"/> member.
 /// </remarks>
 /// <param name="u">The u-coordinate to copy.</param>
 /// <returns>A copy of the data at the requested co-ordinate.</returns>
 public T this[uint u] {
     get {
         Assure.LessThan(u, Width, "Index out of bounds: u");
         return(UnsafeUtils.ReadGenericFromPtr <T>(Data + (int)(sizeOfT * u), sizeOfT));
     }
     set {
         Assure.LessThan(u, Width, "Index out of bounds: u");
         UnsafeUtils.WriteGenericToPtr(Data + (int)(sizeOfT * u), value, sizeOfT);
     }
 }
 /// <summary>
 /// Gets or sets the data at the requested co-ordinates.
 /// </summary>
 /// <remarks>
 /// For reading/writing single elements, using this member is recommended, but may be slow when attempting
 /// to copy large sections of the data. In these circumstances, consider using something like
 /// <see cref="UnsafeUtils.CopyGenericArray{T}(Ophidian.Losgap.ArraySlice{T},System.IntPtr,uint)"/> /
 /// <see cref="UnsafeUtils.CopyGenericArray{T}(System.IntPtr,Ophidian.Losgap.ArraySlice{T},uint)"/> in combination with the
 /// <see cref="Data"/> member.
 /// </remarks>
 /// <param name="u">The u-coordinate to copy.</param>
 /// <param name="v">The v-coordinate to copy.</param>
 /// <returns>A copy of the data at the requested co-ordinate.</returns>
 public T this[uint u, uint v] {
     get {
         Assure.LessThan(u, Width, "Index out of bounds: u");
         Assure.LessThan(v, Height, "Index out of bounds: v");
         return(UnsafeUtils.ReadGenericFromPtr <T>(Data + (int)(u * sizeOfT + v * rowStrideBytes), sizeOfT));
     }
     set {
         Assure.LessThan(u, Width, "Index out of bounds: u");
         Assure.LessThan(v, Height, "Index out of bounds: v");
         UnsafeUtils.WriteGenericToPtr(Data + (int)(u * sizeOfT + v * rowStrideBytes), value, sizeOfT);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Read the current value from the <see cref="AlignedPointer"/>.
 /// </summary>
 /// <returns>The value currently stored in this allocation.</returns>
 public T Read()
 {
     Assure.NotEqual(AlignedPointer, IntPtr.Zero);
     return(UnsafeUtils.ReadGenericFromPtr <T>(AlignedPointer, sizeOfT));
 }