예제 #1
0
파일: SVSGif.cs 프로젝트: 13438120136/SVDU
        public void fromBin(GifBin bin, byte[] picBuffer)
        {
            this.Location = new Point(bin.rect.sX, bin.rect.sY);
            this.Width    = bin.rect.eX - bin.rect.sX;
            this.Height   = bin.rect.eY - bin.rect.sY;

            List <Bitmap> bitList = new List <Bitmap>();

            for (int i = 0; i < (bin.type + 1); i++)
            {
                SVPixmapFile file   = new SVPixmapFile();
                Bitmap       bitmap = file.getFromFile(picBuffer, bin.imageOffset[i]);
                bitList.Add(bitmap);
            }

            Int32 index = 0;

            _timer.Tick += new EventHandler((sender, e) =>
            {
                this.BackgroundImage = bitList[index];
                index++;

                if (index == bin.type + 1)
                {
                    index = 0;
                }
            });
        }
예제 #2
0
        public void make(ref PageArrayBin pageArrayBin, ref SVSerialize serialize)
        {
            UInt32 pageCount = pageArrayBin.pageCount;
            UInt32 gifCount  = pageArrayBin.pageArray[pageCount].gif_num++;

            if (pageArrayBin.pageArray[pageCount].m_gif == null)
            {
                pageArrayBin.pageArray[pageCount].m_gif = new GifBin[SVLimit.PAGE_GIF_MAXNUM];
            }

            GifBin gifBin = pageArrayBin.pageArray[pageCount].m_gif[gifCount];

            gifBin.addOffset = new UInt32[8];
            gifBin.varType   = new Byte[8];

            gifBin.id      = ID;
            gifBin.rect.sX = (UInt16)Rect.X;
            gifBin.rect.sY = (UInt16)Rect.Y;
            gifBin.rect.eX = (UInt16)(Rect.Width + gifBin.rect.sX);
            gifBin.rect.eY = (UInt16)(Rect.Height + gifBin.rect.sY);

            ///图片数组地址
            gifBin.imageOffset = new UInt32[8];

            ///保存所有图片数据
            List <SVBitmap> list = _pic.imageArray();

            for (int i = 0; i < list.Count; i++)
            {
                var address = list[i];
                gifBin.imageOffset[i] = (UInt32)serialize.ToArray().Length;
                serialize.pack(address.bitmap8Data(Rect.Width, Rect.Height));
            }

            ///写入当前错误图片数据
            var errorAddress = PicError.bitmap8Data(Rect.Width, Rect.Height);

            if (errorAddress != null)
            {
                gifBin.iamgeOffsetErr = (UInt32)serialize.ToArray().Length;
                serialize.pack(errorAddress);
            }

            ///根据名称来获取地址
            var varInstance = SVVaribleType.instance();

            for (int i = 0; i < _var.Count; i++)
            {
                gifBin.addOffset[i] = varInstance.strToAddress(_var[i], _varType[i]);
                gifBin.varType[i]   = (Byte)varInstance.strToType(_var[i], _varType[i]);
            }

            ///变量个数
            gifBin.type = Convert.ToByte(_var.Count);

            pageArrayBin.pageArray[pageCount].m_gif[gifCount] = gifBin;
        }