public static AbstractImage GetPalettedImage(bool is4bpp, string name, int width, int height, string fileName, int fileSize, Enum sector,
                                              PatcherLib.Iso.KnownPosition graphicsPosition, PatcherLib.Iso.KnownPosition palettePosition, bool isEffect = false, int effectIndex = 0)
 {
     if (is4bpp)
     {
         PalettedImage4bpp image = new PalettedImage4bpp(name, width, height, 32, Palette.ColorDepth._16bit, graphicsPosition, palettePosition);
         image.PaletteCount     = 16;
         image.DefaultPalette   = 0;
         image.CurrentPalette   = 0;
         image.OriginalFilename = fileName;
         image.Filesize         = fileSize;
         image.Sector           = sector;
         image.IsEffect         = isEffect;
         image.EffectIndex      = effectIndex;
         return(image);
     }
     else
     {
         PalettedImage8bpp image = new PalettedImage8bpp(name, width, height, 1, Palette.ColorDepth._16bit, graphicsPosition, palettePosition);
         image.PaletteCount     = 0;
         image.DefaultPalette   = 0;
         image.CurrentPalette   = 0;
         image.OriginalFilename = fileName;
         image.Filesize         = fileSize;
         image.Sector           = sector;
         image.IsEffect         = isEffect;
         image.EffectIndex      = effectIndex;
         return(image);
     }
 }
示例#2
0
        protected virtual PalettedImage8bpp Get8BitPalettedBitmap()
        {
            PatcherLib.Iso.KnownPosition newPalettePosition = palettePosition.AddOffset(CurrentPalette * palettePosition.Length, palettePosition.Length * 15);
            PalettedImage8bpp            image = new PalettedImage8bpp(Name, Width, Height, NumPalettes, depth, position, newPalettePosition, true);

            image.ImportFilename = ImportFilename;
            return(image);
        }
        protected virtual PalettedImage8bpp Get8BitPalettedBitmap()
        {
            int numRemainingPalettes = PaletteCount - CurrentPalette;

            PatcherLib.Iso.KnownPosition newPalettePosition = palettePosition.AddOffset(CurrentPalette * palettePosition.Length, palettePosition.Length * Math.Min((numRemainingPalettes - 1), 15));
            PalettedImage8bpp            image = new PalettedImage8bpp(Name, Width, Height, NumPalettes, depth, position, newPalettePosition, true);

            image.ImportFilename = ImportFilename;
            return(image);
        }
        protected void SaveImage8bpp(System.IO.Stream iso, System.IO.Stream output, PalettedImage8bpp image8bpp = null)
        {
            if (image8bpp == null)
            {
                image8bpp = Get8BitPalettedBitmap();
            }

            //image8bpp.SaveImageSpecific(iso, output, GetImageFromIso(iso), true);
            //image8bpp.SaveImageSpecific(iso, output, true);
            image8bpp.SaveImageSpecific(iso, output, true, GetIsoBytes(iso));
        }
示例#5
0
        public static PalettedImage8bpp ConstructFromXml(XmlNode node)
        {
            ImageInfo info = GetImageInfo(node);

            var palPos = GetPalettePositionFromImageNode(info.Sector, node);
            var pos    = GetPositionFromImageNode(info.Sector, node);
            var depth  = GetColorDepth(node);

            PalettedImage8bpp image = new PalettedImage8bpp(info.Name, info.Width, info.Height, 1, depth, pos, palPos);

            image.PaletteCount     = info.PaletteCount;
            image.DefaultPalette   = info.DefaultPalette;
            image.CurrentPalette   = info.CurrentPalette;
            image.OriginalFilename = info.OriginalFilename;
            image.Filesize         = info.Filesize;
            image.Sector           = info.Sector;

            return(image);
        }
        protected void WriteImageToIsoInner8bpp(System.IO.Stream iso, System.Drawing.Image image, PalettedImage8bpp image8bpp = null)
        {
            if (image8bpp == null)
            {
                image8bpp = Get8BitPalettedBitmap();
            }

            image8bpp.WriteImageToIsoInnerSpecific(iso, image, true);
        }
示例#7
0
        public static PalettedImage8bpp ConstructFromXml( XmlNode node )
        {
            ImageInfo info = GetImageInfo(node);

            var palPos = GetPalettePositionFromImageNode(info.Sector, node);
            var pos = GetPositionFromImageNode(info.Sector, node);
            var depth = GetColorDepth(node);

            PalettedImage8bpp image = new PalettedImage8bpp(info.Name, info.Width, info.Height, 1, depth, pos, palPos);
            image.PaletteCount = info.PaletteCount;
            image.DefaultPalette = info.DefaultPalette;
            image.CurrentPalette = info.CurrentPalette;
            image.OriginalFilename = info.OriginalFilename;
            image.Filesize = info.Filesize;
            image.Sector = info.Sector;

            return image;
        }
示例#8
0
        protected void WriteImageToIsoInner8bpp(System.IO.Stream iso, System.Drawing.Image image, PalettedImage8bpp image8bpp = null)
        {
            if (image8bpp == null)
                image8bpp = Get8BitPalettedBitmap();

            image8bpp.WriteImageToIsoInnerSpecific(iso, image, true);
        }
示例#9
0
        protected void SaveImage8bpp(System.IO.Stream iso, System.IO.Stream output, PalettedImage8bpp image8bpp = null)
        {
            if (image8bpp == null)
                image8bpp = Get8BitPalettedBitmap();

            //image8bpp.SaveImageSpecific(iso, output, GetImageFromIso(iso), true);
            //image8bpp.SaveImageSpecific(iso, output, true);
            image8bpp.SaveImageSpecific(iso, output, true, GetIsoBytes(iso));
        }
示例#10
0
 protected virtual PalettedImage8bpp Get8BitPalettedBitmap()
 {
     PatcherLib.Iso.KnownPosition newPalettePosition = palettePosition.AddOffset(CurrentPalette * palettePosition.Length, palettePosition.Length * 15);
     PalettedImage8bpp image = new PalettedImage8bpp(Name, Width, Height, NumPalettes, depth, position, newPalettePosition, true);
     image.ImportFilename = ImportFilename;
     return image;
 }