Esempio n. 1
0
File: png.cs Progetto: bsv798/p3fes
        public PngClass(RawImgClass p3img)
        {
            this.p3img = p3img;

            png = new sdr.Bitmap(p3img.Width, p3img.Height, p3img.PixelFormat);
            SetParams();
            ConvertFromRawImg();

            rawMs = new sio.MemoryStream();
            png.Save(rawMs, sdr.Imaging.ImageFormat.Png);

            CalcMd5();
        }
Esempio n. 2
0
File: png.cs Progetto: bsv798/p3fes
 public PngClass(string fileName, RawImgClass p3img)
     : this(fileName)
 {
     this.p3img = p3img;
     ConvertToRawImg(fileName);
 }
Esempio n. 3
0
File: png.cs Progetto: bsv798/p3fes
        private static void SetImageDataToRawImg(sdr.Bitmap png, RawImgClass p3img)
        {
            sdr.Imaging.BitmapData bmpData;

            p3img.imgData = new byte[(int)(p3img.Width * p3img.Height * ((float)p3img.BitCount / 8))];
            bmpData = png.LockBits(new sdr.Rectangle(0, 0, png.Width, png.Height), sdr.Imaging.ImageLockMode.ReadOnly, png.PixelFormat);
            sirs.Marshal.Copy(bmpData.Scan0, p3img.imgData, 0, p3img.imgData.Length);
            png.UnlockBits(bmpData);
        }
Esempio n. 4
0
File: png.cs Progetto: bsv798/p3fes
        private static void SetPaletteToRawImg(sdr.Bitmap png, RawImgClass p3img)
        {
            int palPtr;
            sdr.Color[] cols;

            p3img.palData = new byte[png.Palette.Entries.Length << 0x2];
            cols = png.Palette.Entries; //effects performance VERY HEAVILY

            palPtr = 0;
            for (int i = 0; i < cols.Length; i++)
            {
                p3img.palData[palPtr++] = cols[i].A;
                p3img.palData[palPtr++] = cols[i].R;
                p3img.palData[palPtr++] = cols[i].G;
                p3img.palData[palPtr++] = cols[i].B;
            }
        }
Esempio n. 5
0
File: list.cs Progetto: bsv798/p3fes
 public ImgListItem(string imgDir, string fileName, RawImgClass img)
 {
     type = (int)img.Type;
     bitCount = img.BitCount;
     width = img.Width;
     height = img.Height;
     name = img.name;
     if (name.Length == 0)
         pngAlias = sio.Path.GetFileNameWithoutExtension(fileName) + ".png";
     else
         pngAlias = name + ".png";
     fullName = fileName.Replace(imgDir, "");
     img.CalcMd5();
     md5bytes = img.md5bytes;
 }