Codec di casa al posto di SkiaSharp (C1, passo 5)
SkiaSharp e SkiaSharp.NativeAssets.Linux.NoDependencies escono da Directory.Packages.props e da ogni progetto, per la regola «niente componenti esterni». Tutto ciò che leggeva, ridimensionava o disegnava immagini con Skia ora usa codice scritto in casa sulla BCL: - ImageResampler: Lanczos3 separabile o media per area, alfa premoltiplicata, luce lineare facoltativa; ImageGray per l'impronta. - Il lettore JPEG decodifica ridotto a 1/2, 1/4, 1/8; le miniature chiedono almeno il doppio del lato lungo, così l'ultimo passo resta a Lanczos e la miniatura resta uguale alla lettura intera. - ImageOrientation applica l'EXIF in un punto solo (miniature, impronte, anteprime, dimensioni mostrate). - ImageConverter cambia formato fra JPEG, PNG e WebP portando EXIF, ICC, XMP e testi, con l'etichetta d'orientamento e i pixel non ruotati; PngEncoder scrive anche i testi (tEXt o iTXt). - Febe.Core.Drawing: rasterizzatore con antialiasing (tracciati, riempimenti, tratti, gradienti) per icona, immagini dimostrative, riquadro neutro dei video, foto del sito di prova e prove. Febe.ico rigenerata. - ThumbnailStore legge anche i BMP a 24 bit, come quelli del decoder video del ramo funzione/decoder-h264. Le impronte salvate restano confrontabili (390 su 393 campioni identiche, le altre a distanza 2, soglia 6): nessun ricalcolo. Un PNG o JPEG troncato ora non ha miniatura né impronta. Documenti, elenco dei componenti della pagina «Informazioni» e decisioni aggiornati; nuove prove per ridimensionamento, orientamento, lettura ridotta, conversione con metadati, testi PNG e rasterizzatore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b4383a6110
commit
d6a6a68496
47 files changed
+3391
-562
No files matched your search
@@ -49,6 +49,23 @@ public static class JpegDecoder
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decodes a JPEG reduced by 2^<paramref name="reduction"/> in each direction (0 full size, 1 half, 2 quarter,
|
||||
/// 3 eighth; sizes rounded up), with what <see cref="Identify"/> returns (the full size): each 8×8 block gives the
|
||||
/// means of its squares of samples, which saves memory and, at an eighth, the whole inverse transform. Lossless
|
||||
/// files are always decoded at full size: check the size of the result.
|
||||
/// </summary>
|
||||
public static RgbaImage DecodeReduced(ReadOnlyMemory<byte> data, int reduction, out ImageInfo info, ImageLimits? limits = null, bool pooled = false)
|
||||
{
|
||||
ArgumentOutOfRangeException.ThrowIfNegative(reduction);
|
||||
ArgumentOutOfRangeException.ThrowIfGreaterThan(reduction, 3);
|
||||
using var file = new JpegFile(data, limits ?? ImageLimits.Default, JpegFile.Mode.Pixels, readMetadata: true) { ScaleShift = reduction };
|
||||
file.Run();
|
||||
var image = file.Render(pooled);
|
||||
info = file.ToInfo();
|
||||
return image;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The quantized DCT coefficients of every block of a DCT-based JPEG, as they stand after the last scan, with the
|
||||
/// frame parameters: what tests compare between encodings of the same image (sequential, progressive, restart).
|
||||
|
||||
Reference in new issue
Block a user