Пример #1
0
        /**
         * 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);
        }
Пример #2
0
        public PngChunkTRNS CreateTRNSChunk()
        {
            PngChunkTRNS pngChunkTRNS = new PngChunkTRNS(chunkList.imageInfo);

            QueueChunk(pngChunkTRNS);
            return(pngChunkTRNS);
        }
Пример #3
0
        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);
            }
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
 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;
 }
Пример #6
0
 /**
  * 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;
 }