コード例 #1
0
ファイル: StciLoader.cs プロジェクト: egorovav/Ja2Project
        private StciIndexed LoadStciIndexed(BinaryReader aReader, Ja2Data.StciHeader aHeader)
        {
            StciIndexed _newStciIndexed = new StciIndexed();

            Ja2Data.StciIndexed _stciIndexed = new Ja2Data.StciIndexed(aHeader);
            _stciIndexed.Load(aReader);

            Ja2Data.StciIndexedHeader _subHeader = (Ja2Data.StciIndexedHeader)aHeader.SubHeader;

            _newStciIndexed.BlueDepth         = _subHeader.BlueDepth;
            _newStciIndexed.GreenDepth        = _subHeader.GreenDepth;
            _newStciIndexed.NumberOfColours   = _subHeader.NumberOfColous;
            _newStciIndexed.NumberOfSubImages = (int)_subHeader.NumberOfSubImages;
            _newStciIndexed.RedDepth          = _subHeader.RedDepth;
            _newStciIndexed.Unused            = _subHeader.Unused;

            _newStciIndexed.DateCreated = DateTime.Now;
            _newStciIndexed.UserId      = this.FUserId;

            _newStciIndexed.Palette = _stciIndexed.Palette;

            for (int i = 0; i < _subHeader.NumberOfSubImages; i++)
            {
                StciIndexedSubImage _subImage = this.LoadSubImage(_stciIndexed.Images[i]);
                _subImage.StciIndexed = _newStciIndexed;
                this.FSubImages.Add(_subImage);
            }

            return(_newStciIndexed);
        }
コード例 #2
0
ファイル: Ja2DataAccess.cs プロジェクト: egorovav/Ja2Project
        private byte[] DownloadStiIndexed(SlfRecordStci aStciRecord, int aDataLength)
        {
            Ja2Data.StciHeader _header = DownloadStciHeader(aStciRecord);

            StciIndexed _indexedRec = aStciRecord.StciIndexed.First();

            Ja2Data.StciIndexedHeader _subHeader = new Ja2Data.StciIndexedHeader((UInt16)_indexedRec.NumberOfSubImages);
            _subHeader.BlueDepth      = _indexedRec.BlueDepth;
            _subHeader.GreenDepth     = _indexedRec.GreenDepth;
            _subHeader.RedDepth       = _indexedRec.RedDepth;
            _subHeader.NumberOfColous = (uint)_indexedRec.NumberOfColours;

            _header.SubHeader = _subHeader;

            Ja2Data.StciSubImage[] _subImages = new Ja2Data.StciSubImage[_indexedRec.NumberOfSubImages];
            int i = 0;

            foreach (StciIndexedSubImage _subImage in _indexedRec.StciIndexedSubImage)
            {
                _subImages[i] = this.DownloadStciSubimage(_subImage);
                i++;
            }

            Ja2Data.StciIndexed _stciIndexed = new Ja2Data.StciIndexed(_header, _indexedRec.Palette, _subImages);

            byte[] _buffer = new byte[aDataLength];
            using (MemoryStream _ms = new MemoryStream(_buffer))
            {
                _stciIndexed.Save(_ms);
            }
            return(_buffer);
        }