|
24 | 24 |
|
25 | 25 | namespace UglyToad.PdfPig.Rendering.Skia.Helpers
|
26 | 26 | {
|
27 |
| - internal static class SkiaImageExtensions |
| 27 | + /// <summary> |
| 28 | + /// SkiaSharp image extensions. |
| 29 | + /// </summary> |
| 30 | + public static class SkiaImageExtensions |
28 | 31 | {
|
29 | 32 | private static bool IsValidColorSpace(IPdfImage pdfImage)
|
30 | 33 | {
|
@@ -56,7 +59,7 @@ private static bool HasAlphaChannel(this IPdfImage pdfImage)
|
56 | 59 | return pdfImage.MaskImage is not null || pdfImage.ImageDictionary.ContainsKey(NameToken.Mask);
|
57 | 60 | }
|
58 | 61 |
|
59 |
| - public static int GetRasterSize(this IPdfImage pdfImage) |
| 62 | + internal static int GetRasterSize(this IPdfImage pdfImage) |
60 | 63 | {
|
61 | 64 | int width = pdfImage.WidthInSamples;
|
62 | 65 | int height = pdfImage.HeightInSamples;
|
@@ -379,6 +382,19 @@ private static bool TryGetGray8Bitmap(int width, int height, ReadOnlySpan<byte>
|
379 | 382 | return false;
|
380 | 383 | }
|
381 | 384 |
|
| 385 | + /// <summary> |
| 386 | + /// Converts the specified <see cref="IPdfImage"/> to an <see cref="SKImage"/> instance. |
| 387 | + /// </summary> |
| 388 | + /// <param name="pdfImage">The PDF image to convert.</param> |
| 389 | + /// <returns> |
| 390 | + /// An <see cref="SKImage"/> representation of the provided <paramref name="pdfImage"/>. |
| 391 | + /// If the conversion fails, a fallback mechanism is used to create the image from raw bytes. |
| 392 | + /// </returns> |
| 393 | + /// <exception cref="ArgumentNullException">Thrown if <paramref name="pdfImage"/> is <c>null</c>.</exception> |
| 394 | + /// <remarks> |
| 395 | + /// This method attempts to generate an <see cref="SKImage"/> using the image's data and color space. |
| 396 | + /// If the generation fails, it falls back to creating the image using encoded or raw byte data. |
| 397 | + /// </remarks> |
382 | 398 | public static SKImage GetSKImage(this IPdfImage pdfImage)
|
383 | 399 | {
|
384 | 400 | if (pdfImage.TryGenerate(out var bitmap))
|
|
0 commit comments