@@ -78,84 +78,6 @@ public static IMemoryGroup<TPixel> GetPixelMemoryGroup<TPixel>(this Image<TPixel
7878 where TPixel : unmanaged, IPixel < TPixel >
7979 => source ? . Frames . RootFrame . GetPixelMemoryGroup ( ) ?? throw new ArgumentNullException ( nameof ( source ) ) ;
8080
81- /// <summary>
82- /// Gets the representation of the pixels as a <see cref="Span{T}"/> in the source image's pixel format
83- /// stored in row major order, if the backing buffer is contiguous.
84- /// </summary>
85- /// <typeparam name="TPixel">The type of the pixel.</typeparam>
86- /// <param name="source">The source image.</param>
87- /// <returns>The <see cref="Span{TPixel}"/></returns>
88- /// <exception cref="InvalidOperationException">Thrown when the backing buffer is discontiguous.</exception>
89- [ Obsolete (
90- @"GetPixelSpan might fail, because the backing buffer could be discontiguous for large images. Use GetPixelMemoryGroup or GetPixelRowSpan instead!" ) ]
91- public static Span < TPixel > GetPixelSpan < TPixel > ( this ImageFrame < TPixel > source )
92- where TPixel : unmanaged, IPixel < TPixel >
93- {
94- Guard . NotNull ( source , nameof ( source ) ) ;
95-
96- IMemoryGroup < TPixel > mg = source . GetPixelMemoryGroup ( ) ;
97- if ( mg . Count > 1 )
98- {
99- throw new InvalidOperationException ( $ "GetPixelSpan is invalid, since the backing buffer of this { source . Width } x{ source . Height } sized image is discontiguous!") ;
100- }
101-
102- return mg . Single ( ) . Span ;
103- }
104-
105- /// <summary>
106- /// Gets the representation of the pixels as a <see cref="Span{T}"/> of contiguous memory in the source image's pixel format
107- /// stored in row major order.
108- /// </summary>
109- /// <typeparam name="TPixel">The type of the pixel.</typeparam>
110- /// <param name="source">The source.</param>
111- /// <returns>The <see cref="Span{TPixel}"/></returns>
112- /// <exception cref="InvalidOperationException">Thrown when the backing buffer is discontiguous.</exception>
113- [ Obsolete (
114- @"GetPixelSpan might fail, because the backing buffer could be discontiguous for large images. Use GetPixelMemoryGroup or GetPixelRowSpan instead!" ) ]
115- public static Span < TPixel > GetPixelSpan < TPixel > ( this Image < TPixel > source )
116- where TPixel : unmanaged, IPixel < TPixel >
117- {
118- Guard . NotNull ( source , nameof ( source ) ) ;
119-
120- return source . Frames . RootFrame . GetPixelSpan ( ) ;
121- }
122-
123- /// <summary>
124- /// Gets the representation of the pixels as a <see cref="Span{T}"/> of contiguous memory
125- /// at row <paramref name="rowIndex"/> beginning from the the first pixel on that row.
126- /// </summary>
127- /// <typeparam name="TPixel">The type of the pixel.</typeparam>
128- /// <param name="source">The source.</param>
129- /// <param name="rowIndex">The row.</param>
130- /// <returns>The <see cref="Span{TPixel}"/></returns>
131- public static Span < TPixel > GetPixelRowSpan < TPixel > ( this ImageFrame < TPixel > source , int rowIndex )
132- where TPixel : unmanaged, IPixel < TPixel >
133- {
134- Guard . NotNull ( source , nameof ( source ) ) ;
135- Guard . MustBeGreaterThanOrEqualTo ( rowIndex , 0 , nameof ( rowIndex ) ) ;
136- Guard . MustBeLessThan ( rowIndex , source . Height , nameof ( rowIndex ) ) ;
137-
138- return source . PixelBuffer . GetRowSpan ( rowIndex ) ;
139- }
140-
141- /// <summary>
142- /// Gets the representation of the pixels as <see cref="Span{T}"/> of of contiguous memory
143- /// at row <paramref name="rowIndex"/> beginning from the the first pixel on that row.
144- /// </summary>
145- /// <typeparam name="TPixel">The type of the pixel.</typeparam>
146- /// <param name="source">The source.</param>
147- /// <param name="rowIndex">The row.</param>
148- /// <returns>The <see cref="Span{TPixel}"/></returns>
149- public static Span < TPixel > GetPixelRowSpan < TPixel > ( this Image < TPixel > source , int rowIndex )
150- where TPixel : unmanaged, IPixel < TPixel >
151- {
152- Guard . NotNull ( source , nameof ( source ) ) ;
153- Guard . MustBeGreaterThanOrEqualTo ( rowIndex , 0 , nameof ( rowIndex ) ) ;
154- Guard . MustBeLessThan ( rowIndex , source . Height , nameof ( rowIndex ) ) ;
155-
156- return source . Frames . RootFrame . PixelBuffer . GetRowSpan ( rowIndex ) ;
157- }
158-
15981 /// <summary>
16082 /// Gets the representation of the pixels as a <see cref="Span{T}"/> of contiguous memory
16183 /// at row <paramref name="rowIndex"/> beginning from the the first pixel on that row.
0 commit comments