public PartiallyVisiblePalettedImage4bpp(
            string name,
            int width, int height,
            int numPalettes,
            Rectangle visiblePortion,
            FFTPatcher.SpriteEditor.Palette.ColorDepth depth,
            PatcherLib.Iso.KnownPosition imagePosition,
            PatcherLib.Iso.KnownPosition palettePosition)
            : base(name, visiblePortion.Width, visiblePortion.Height)
        {
            VisiblePortion       = visiblePortion;
            FullSize             = new Size(width, height);
            this.position        = imagePosition;
            this.palettePosition = palettePosition;
            this.depth           = depth;

            System.Diagnostics.Debug.Assert(palettePosition.Length == 8 * (int)depth * 2);
            if (position is PatcherLib.Iso.PsxIso.KnownPosition)
            {
                var pos = position as PatcherLib.Iso.PsxIso.KnownPosition;
                saveFileName = string.Format("{0}_{1}.png", pos.Sector, pos.StartLocation);
            }
            else if (position is PatcherLib.Iso.PspIso.KnownPosition)
            {
                var pos = position as PatcherLib.Iso.PspIso.KnownPosition;
                saveFileName = string.Format("{0}_{1}.png", pos.SectorEnum, pos.StartLocation);
            }
        }
        public static PalettedImage4bpp ConstructFromXml(XmlNode node)
        {
            ImageInfo info   = GetImageInfo(node);
            var       palPos = GetPalettePositionFromImageNode(info.Sector, node);
            var       pos    = GetPositionFromImageNode(info.Sector, node);

            FFTPatcher.SpriteEditor.Palette.ColorDepth depth = Palette.ColorDepth._16bit;

            var cdNode = node.SelectSingleNode("ColorDepth");

            if (cdNode != null)
            {
                depth = (Palette.ColorDepth)Enum.Parse(typeof(Palette.ColorDepth), cdNode.InnerText);
            }

            PalettedImage4bpp image = new PalettedImage4bpp(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);
        }
示例#3
0
        public PalettedImage8bpp( 
            string name, 
            int width, int height, 
            int numPalettes, Palette.ColorDepth depth,
            PatcherLib.Iso.KnownPosition imagePosition, 
            PatcherLib.Iso.KnownPosition palettePosition,
            bool ignoreAssert = false)
            : base(name, width, height)
        {
            this.position = imagePosition;
            this.palettePosition = palettePosition;
            this.depth = depth;

            if (!ignoreAssert)
            {
                System.Diagnostics.Debug.Assert(palettePosition.Length == 256 * (int)depth * numPalettes);
            }

            if ( position is PatcherLib.Iso.PsxIso.KnownPosition )
            {
                var pos = position as PatcherLib.Iso.PsxIso.KnownPosition;
                saveFileName = string.Format( "{0}_{1}_{2}.bmp", pos.Sector, pos.StartLocation, pos.Length );
            }
            else if ( position is PatcherLib.Iso.PspIso.KnownPosition )
            {
                var pos = position as PatcherLib.Iso.PspIso.KnownPosition;
                saveFileName = string.Format( "{0}_{1}_{2}.bmp", pos.SectorEnum, pos.StartLocation, pos.Length );
            }
        }
 public PalettedImage4bpp(
     string name,
     int width, int height,
     int numPalettes,
     FFTPatcher.SpriteEditor.Palette.ColorDepth depth,
     PatcherLib.Iso.KnownPosition imagePosition,
     PatcherLib.Iso.KnownPosition palettePosition)
     : base(name, width, height)
 {
     this.position        = imagePosition;
     this.palettePosition = palettePosition;
     this.depth           = depth;
     System.Diagnostics.Debug.Assert(palettePosition.Length == 8 * (int)depth * 2);
     if (position is PatcherLib.Iso.PsxIso.KnownPosition)
     {
         var pos = position as PatcherLib.Iso.PsxIso.KnownPosition;
         saveFileName = string.Format("{0}_{1}_{2}.bmp", pos.Sector, pos.StartLocation, pos.Length);
     }
     else if (position is PatcherLib.Iso.PspIso.KnownPosition)
     {
         var pos = position as PatcherLib.Iso.PspIso.KnownPosition;
         saveFileName = string.Format("{0}_{1}_{2}.bmp", pos.SectorEnum, pos.StartLocation, pos.Length);
     }
 }