/** * Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries */ public PngChunkTRNS CreateTRNSChunk() { PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo); QueueChunk(trns); return(trns); }
public PngChunkTRNS CreateTRNSChunk() { PngChunkTRNS pngChunkTRNS = new PngChunkTRNS(chunkList.imageInfo); QueueChunk(pngChunkTRNS); return(pngChunkTRNS); }
public override void CloneDataFromRead(PngChunk other) { PngChunkTRNS otherx = (PngChunkTRNS)other; gray = otherx.gray; red = otherx.red; green = otherx.green; blue = otherx.blue; if (otherx.paletteAlpha != null) { paletteAlpha = new int[otherx.paletteAlpha.Length]; System.Array.Copy(otherx.paletteAlpha, 0, paletteAlpha, 0, paletteAlpha.Length); } }
public override void CloneDataFromRead(PngChunk other) { PngChunkTRNS pngChunkTRNS = (PngChunkTRNS)other; gray = pngChunkTRNS.gray; red = pngChunkTRNS.red; green = pngChunkTRNS.red; blue = pngChunkTRNS.red; if (pngChunkTRNS.paletteAlpha != null) { paletteAlpha = new int[pngChunkTRNS.paletteAlpha.Length]; Array.Copy(pngChunkTRNS.paletteAlpha, 0, paletteAlpha, 0, paletteAlpha.Length); } }
public static int[] Palette2rgb( ImageLine line, PngChunkPLTE pal, PngChunkTRNS trns, int [] buf ) { bool isalpha = trns != null; int channels = isalpha ? 4 : 3; int nsamples = line.ImgInfo.Cols * channels; if ( buf == null || buf.Length < nsamples ) buf = new int [ nsamples ]; if ( !line.SamplesUnpacked ) line = line.unpackToNewImageLine (); bool isbyte = line.SampleType == Hjg.Pngcs.ImageLine.ESampleType.BYTE; int nindexesWithAlpha = trns != null ? trns.GetPalletteAlpha ().Length : 0; for ( int c = 0; c < line.ImgInfo.Cols; c++ ) { int index = isbyte ? ( line.ScanlineB [ c ] & 0xFF ) : line.Scanline [ c ]; pal.GetEntryRgb ( index, buf, c * channels ); if ( isalpha ) { int alpha = index < nindexesWithAlpha ? trns.GetPalletteAlpha () [ index ] : 255; buf [ c * channels + 3 ] = alpha; } } return buf; }
/** * Creates a new empty TRNS chunk, queues it for write and return it to the caller, who should fill its entries */ public PngChunkTRNS CreateTRNSChunk() { PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo); QueueChunk(trns); return trns; }