|
2 | 2 | // Licensed under the Six Labors Split License. |
3 | 3 |
|
4 | 4 | using Silk.NET.WebGPU; |
5 | | -using SixLabors.ImageSharp.Memory; |
6 | 5 | using SixLabors.ImageSharp.PixelFormats; |
7 | 6 |
|
8 | 7 | namespace SixLabors.ImageSharp.Drawing.Processing.Backends; |
@@ -167,74 +166,6 @@ public NativeCanvasFrame<TPixel> CreateFrame( |
167 | 166 | int height) |
168 | 167 | => new(CreateBounds(width, height), this.CreateSurface(textureHandle, textureViewHandle, format, width, height)); |
169 | 168 |
|
170 | | - /// <summary> |
171 | | - /// Creates a hybrid frame over an externally-owned WebGPU texture and a caller-provided CPU region. |
172 | | - /// </summary> |
173 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
174 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
175 | | - /// <param name="format">The texture format identifier.</param> |
176 | | - /// <param name="width">The frame width in pixels.</param> |
177 | | - /// <param name="height">The frame height in pixels.</param> |
178 | | - /// <param name="cpuRegion">The CPU region to expose alongside the native surface.</param> |
179 | | - /// <returns>A hybrid canvas frame.</returns> |
180 | | - public HybridCanvasFrame<TPixel> CreateHybridFrame( |
181 | | - nint textureHandle, |
182 | | - nint textureViewHandle, |
183 | | - WebGPUTextureFormatId format, |
184 | | - int width, |
185 | | - int height, |
186 | | - Buffer2DRegion<TPixel> cpuRegion) |
187 | | - => new(CreateBounds(width, height), cpuRegion, this.CreateSurface(textureHandle, textureViewHandle, format, width, height)); |
188 | | - |
189 | | - /// <summary> |
190 | | - /// Creates a hybrid frame over an externally-owned WebGPU texture and the root frame of a CPU image. |
191 | | - /// </summary> |
192 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
193 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
194 | | - /// <param name="format">The texture format identifier.</param> |
195 | | - /// <param name="image">The CPU image that backs the frame's CPU region.</param> |
196 | | - /// <returns>A hybrid canvas frame.</returns> |
197 | | - public HybridCanvasFrame<TPixel> CreateHybridFrame( |
198 | | - nint textureHandle, |
199 | | - nint textureViewHandle, |
200 | | - WebGPUTextureFormatId format, |
201 | | - Image<TPixel> image) |
202 | | - { |
203 | | - Guard.NotNull(image, nameof(image)); |
204 | | - return this.CreateHybridFrame( |
205 | | - textureHandle, |
206 | | - textureViewHandle, |
207 | | - format, |
208 | | - image.Width, |
209 | | - image.Height, |
210 | | - GetImageRegion(image)); |
211 | | - } |
212 | | - |
213 | | - /// <summary> |
214 | | - /// Creates a hybrid frame over an externally-owned WebGPU texture and a CPU image frame. |
215 | | - /// </summary> |
216 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
217 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
218 | | - /// <param name="format">The texture format identifier.</param> |
219 | | - /// <param name="imageFrame">The CPU image frame that backs the frame's CPU region.</param> |
220 | | - /// <returns>A hybrid canvas frame.</returns> |
221 | | - public HybridCanvasFrame<TPixel> CreateHybridFrame( |
222 | | - nint textureHandle, |
223 | | - nint textureViewHandle, |
224 | | - WebGPUTextureFormatId format, |
225 | | - ImageFrame<TPixel> imageFrame) |
226 | | - { |
227 | | - Guard.NotNull(imageFrame, nameof(imageFrame)); |
228 | | - Rectangle bounds = imageFrame.Bounds; |
229 | | - return this.CreateHybridFrame( |
230 | | - textureHandle, |
231 | | - textureViewHandle, |
232 | | - format, |
233 | | - bounds.Width, |
234 | | - bounds.Height, |
235 | | - GetImageRegion(imageFrame)); |
236 | | - } |
237 | | - |
238 | 169 | /// <summary> |
239 | 170 | /// Creates a drawing canvas over an externally-owned WebGPU texture. |
240 | 171 | /// </summary> |
@@ -271,110 +202,6 @@ public DrawingCanvas<TPixel> CreateCanvas( |
271 | 202 | DrawingOptions options) |
272 | 203 | => new(this.Configuration, this.Backend, this.CreateFrame(textureHandle, textureViewHandle, format, width, height), options); |
273 | 204 |
|
274 | | - /// <summary> |
275 | | - /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a caller-provided CPU region. |
276 | | - /// </summary> |
277 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
278 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
279 | | - /// <param name="format">The texture format identifier.</param> |
280 | | - /// <param name="width">The frame width in pixels.</param> |
281 | | - /// <param name="height">The frame height in pixels.</param> |
282 | | - /// <param name="cpuRegion">The CPU region to expose alongside the native surface.</param> |
283 | | - /// <returns>A drawing canvas targeting the external texture and CPU region.</returns> |
284 | | - public DrawingCanvas<TPixel> CreateHybridCanvas( |
285 | | - nint textureHandle, |
286 | | - nint textureViewHandle, |
287 | | - WebGPUTextureFormatId format, |
288 | | - int width, |
289 | | - int height, |
290 | | - Buffer2DRegion<TPixel> cpuRegion) |
291 | | - => new(this.Configuration, this.Backend, this.CreateHybridFrame(textureHandle, textureViewHandle, format, width, height, cpuRegion), new DrawingOptions()); |
292 | | - |
293 | | - /// <summary> |
294 | | - /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a caller-provided CPU region. |
295 | | - /// </summary> |
296 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
297 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
298 | | - /// <param name="format">The texture format identifier.</param> |
299 | | - /// <param name="width">The frame width in pixels.</param> |
300 | | - /// <param name="height">The frame height in pixels.</param> |
301 | | - /// <param name="cpuRegion">The CPU region to expose alongside the native surface.</param> |
302 | | - /// <param name="options">The initial drawing options.</param> |
303 | | - /// <returns>A drawing canvas targeting the external texture and CPU region.</returns> |
304 | | - public DrawingCanvas<TPixel> CreateHybridCanvas( |
305 | | - nint textureHandle, |
306 | | - nint textureViewHandle, |
307 | | - WebGPUTextureFormatId format, |
308 | | - int width, |
309 | | - int height, |
310 | | - Buffer2DRegion<TPixel> cpuRegion, |
311 | | - DrawingOptions options) |
312 | | - => new(this.Configuration, this.Backend, this.CreateHybridFrame(textureHandle, textureViewHandle, format, width, height, cpuRegion), options); |
313 | | - |
314 | | - /// <summary> |
315 | | - /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and the root frame of a CPU image. |
316 | | - /// </summary> |
317 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
318 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
319 | | - /// <param name="format">The texture format identifier.</param> |
320 | | - /// <param name="image">The CPU image that backs the frame's CPU region.</param> |
321 | | - /// <returns>A drawing canvas targeting the external texture and CPU image.</returns> |
322 | | - public DrawingCanvas<TPixel> CreateHybridCanvas( |
323 | | - nint textureHandle, |
324 | | - nint textureViewHandle, |
325 | | - WebGPUTextureFormatId format, |
326 | | - Image<TPixel> image) |
327 | | - => new(this.Configuration, this.Backend, this.CreateHybridFrame(textureHandle, textureViewHandle, format, image), new DrawingOptions()); |
328 | | - |
329 | | - /// <summary> |
330 | | - /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a CPU image frame. |
331 | | - /// </summary> |
332 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
333 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
334 | | - /// <param name="format">The texture format identifier.</param> |
335 | | - /// <param name="imageFrame">The CPU image frame that backs the frame's CPU region.</param> |
336 | | - /// <returns>A drawing canvas targeting the external texture and CPU image frame.</returns> |
337 | | - public DrawingCanvas<TPixel> CreateHybridCanvas( |
338 | | - nint textureHandle, |
339 | | - nint textureViewHandle, |
340 | | - WebGPUTextureFormatId format, |
341 | | - ImageFrame<TPixel> imageFrame) |
342 | | - => new(this.Configuration, this.Backend, this.CreateHybridFrame(textureHandle, textureViewHandle, format, imageFrame), new DrawingOptions()); |
343 | | - |
344 | | - /// <summary> |
345 | | - /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and the root frame of a CPU image. |
346 | | - /// </summary> |
347 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
348 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
349 | | - /// <param name="format">The texture format identifier.</param> |
350 | | - /// <param name="image">The CPU image that backs the frame's CPU region.</param> |
351 | | - /// <param name="options">The initial drawing options.</param> |
352 | | - /// <returns>A drawing canvas targeting the external texture and CPU image.</returns> |
353 | | - public DrawingCanvas<TPixel> CreateHybridCanvas( |
354 | | - nint textureHandle, |
355 | | - nint textureViewHandle, |
356 | | - WebGPUTextureFormatId format, |
357 | | - Image<TPixel> image, |
358 | | - DrawingOptions options) |
359 | | - => new(this.Configuration, this.Backend, this.CreateHybridFrame(textureHandle, textureViewHandle, format, image), options); |
360 | | - |
361 | | - /// <summary> |
362 | | - /// Creates a hybrid drawing canvas over an externally-owned WebGPU texture and a CPU image frame. |
363 | | - /// </summary> |
364 | | - /// <param name="textureHandle">The opaque <c>WGPUTexture*</c> handle.</param> |
365 | | - /// <param name="textureViewHandle">The opaque <c>WGPUTextureView*</c> handle.</param> |
366 | | - /// <param name="format">The texture format identifier.</param> |
367 | | - /// <param name="imageFrame">The CPU image frame that backs the frame's CPU region.</param> |
368 | | - /// <param name="options">The initial drawing options.</param> |
369 | | - /// <returns>A drawing canvas targeting the external texture and CPU image frame.</returns> |
370 | | - public DrawingCanvas<TPixel> CreateHybridCanvas( |
371 | | - nint textureHandle, |
372 | | - nint textureViewHandle, |
373 | | - WebGPUTextureFormatId format, |
374 | | - ImageFrame<TPixel> imageFrame, |
375 | | - DrawingOptions options) |
376 | | - => new(this.Configuration, this.Backend, this.CreateHybridFrame(textureHandle, textureViewHandle, format, imageFrame), options); |
377 | | - |
378 | 205 | /// <summary> |
379 | 206 | /// Disposes the drawing backend owned by this context. |
380 | 207 | /// </summary> |
@@ -446,10 +273,4 @@ private static Rectangle CreateBounds(int width, int height) |
446 | 273 |
|
447 | 274 | return new Rectangle(0, 0, width, height); |
448 | 275 | } |
449 | | - |
450 | | - private static Buffer2DRegion<TPixel> GetImageRegion(Image<TPixel> image) |
451 | | - => new(image.Frames.RootFrame.PixelBuffer, image.Bounds); |
452 | | - |
453 | | - private static Buffer2DRegion<TPixel> GetImageRegion(ImageFrame<TPixel> imageFrame) |
454 | | - => new(imageFrame.PixelBuffer, imageFrame.Bounds); |
455 | 276 | } |
0 commit comments