Пример #1
0
        public GraphicTile(int Width, int Height, GraphicTileMode Mode, ColorSettings Color)
        {
            this.Width  = Width;
            this.Height = Height;
            this.Mode   = Mode;
            Colors      = Color;

            Data  = new ByteBuffer((uint)Lookup.NumBytes(Width, Height, Mode));
            Image = new GR.Image.MemoryImage(Width, Height, GR.Drawing.PixelFormat.Format32bppRgb);
        }
Пример #2
0
 public GraphicTile(GraphicTile OtherTile)
 {
     Width                 = OtherTile.Width;
     Height                = OtherTile.Height;
     Mode                  = OtherTile.Mode;
     Colors                = OtherTile.Colors;
     CustomColor           = OtherTile.CustomColor;
     TransparentColorIndex = OtherTile.TransparentColorIndex;
     Data                  = new ByteBuffer(OtherTile.Data);
     Image                 = new GR.Image.MemoryImage(OtherTile.Image);
 }
        public ColorSettings(ColorSettings OtherSettings)
        {
            BackgroundColor = OtherSettings.BackgroundColor;
            MultiColor1     = OtherSettings.MultiColor1;
            MultiColor2     = OtherSettings.MultiColor2;
            BGColor4        = OtherSettings.BGColor4;

            Palettes = new List <Palette>();
            foreach (var pal in OtherSettings.Palettes)
            {
                Palettes.Add(new Palette(pal));
            }
            ActivePalette = OtherSettings.ActivePalette;
        }
Пример #4
0
        public bool GetFromClipboard()
        {
            IDataObject dataObj = Clipboard.GetDataObject();

            if (dataObj == null)
            {
                return(false);
            }
            if (!dataObj.GetDataPresent("C64Studio.ImageList"))
            {
                return(false);
            }
            System.IO.MemoryStream ms = (System.IO.MemoryStream)dataObj.GetData("C64Studio.ImageList");

            GR.Memory.ByteBuffer spriteData = new GR.Memory.ByteBuffer((uint)ms.Length);
            ms.Read(spriteData.Data(), 0, (int)ms.Length);
            GR.IO.MemoryReader memIn = spriteData.MemoryReader();

            int numEntries = memIn.ReadInt32();

            ColumnBased = (memIn.ReadInt32() > 0) ? true : false;

            var incomingColorSettings = new ColorSettings();

            incomingColorSettings.BackgroundColor = memIn.ReadInt32();
            incomingColorSettings.MultiColor1     = memIn.ReadInt32();
            incomingColorSettings.MultiColor2     = memIn.ReadInt32();
            incomingColorSettings.BGColor4        = memIn.ReadInt32();

            incomingColorSettings.Palettes.Clear();
            int numPalettes = memIn.ReadInt32();

            for (int j = 0; j < numPalettes; ++j)
            {
                int numPaletteEntries = memIn.ReadInt32();
                var pal = new Palette(numPaletteEntries);
                for (int i = 0; i < numPaletteEntries; ++i)
                {
                    pal.ColorValues[i] = memIn.ReadUInt32();
                }
                pal.CreateBrushes();
                incomingColorSettings.Palettes.Add(pal);
            }

            for (int i = 0; i < numEntries; ++i)
            {
                var entry = new Entry();

                entry.Index = memIn.ReadInt32();

                entry.Tile.Mode        = (GraphicTileMode)memIn.ReadInt32();
                entry.Tile.CustomColor = memIn.ReadInt32();
                int palIndex = memIn.ReadInt32();
                entry.Tile.Width  = memIn.ReadInt32();
                entry.Tile.Height = memIn.ReadInt32();
                uint dataLength = memIn.ReadUInt32();
                entry.Tile.Data = new GR.Memory.ByteBuffer();
                memIn.ReadBlock(entry.Tile.Data, dataLength);

                entry.Tile.Colors = new ColorSettings(incomingColorSettings);
                entry.Tile.Colors.ActivePalette = palIndex;

                int originalIndex = memIn.ReadInt32();

                Entries.Add(entry);
            }
            return(true);
        }