コード例 #1
0
        //============================================================
        // <T>资源点击事件。</T>
        //============================================================
        private void qrsResourceList_ResourceClick(object sender, EventArgs e)
        {
            FRsResource resource = qrsResourceList.SelectedResource;

            if (null != resource)
            {
                // 打开资源
                resource.Open();
                // 显示资源
                SuspendLayout();
                qrsClipViewer.Visible    = false;
                qrsPictureViewer.Visible = false;
                // 显示动画
                if (resource is FRsResourceAnimation)
                {
                    FRsResourceAnimation animation = resource as FRsResourceAnimation;
                    FRsResourceClip      clip      = animation.FristClip;
                    qrsClipViewer.LoadClip(clip);
                    qrsClipViewer.DoPlay();
                    qrsClipViewer.Visible = true;
                }
                // 显示图片
                if (resource is FRsResourcePicture)
                {
                    FRsResourcePicture picture = resource as FRsResourcePicture;
                    qrsPictureViewer.LoadPicture(picture);
                    qrsPictureViewer.Visible = true;
                    labInfo.Text             = picture.Format();
                }
                ResumeLayout();
            }
        }
コード例 #2
0
        //============================================================
        public void LoadClip(FRsResourceClip clip)
        {
            chbReverse.CheckState    = CheckState.Unchecked;
            chbReverseDirection.Text = null;
            chbReverseCd.Text        = null;
            FRsResourcePicture pic = new FRsResourcePicture();

            _clip         = clip;
            _frameCurrent = 0;
            if (null != clip)
            {
                DirectionShow();
                int width  = (int)(_clip.ValidRectangle.Width * _clipScale);
                int height = (int)(_clip.ValidRectangle.Height * _clipScale);
                if (0 != width && 0 != height)
                {
                    ChangeSize(width, height);
                }
                pbxViewer.Visible = true;
            }
            else
            {
                pbxViewer.Visible = false;
            }
        }
コード例 #3
0
        //============================================================
        protected void LoadClipList()
        {
            // 加载方向
            for (int n = 0; n < (int)ERsDirection.Count; n++)
            {
                QDsResourceClipProperty clipViewer = _clipViewers[n];
                FRsResourceClip         clip       = _resourceAnimation.Clips[n];
                clipViewer.LoadClip(clip);
                //if (null != clip && clip.isShow) {
                if (clip != null)
                {
                    clipViewer.DoPlay();
                }
            }
            // 加载当前显示
            FRsResourceClip firstClip = _resourceAnimation.FristClip;

            qdsProperty.LoadClip(firstClip);
            if (null != firstClip)
            {
                QDsResourceClipProperty viewer = _clipViewers[(int)firstClip.DirectionCd];
                SelectClipViewer(viewer);
                InfoText(firstClip);
            }
        }
コード例 #4
0
        //============================================================
        // <T>合并压缩。</T>
        //
        // @autor DYWEN 20120712
        //============================================================
        public void tsbShowImage_Click(object sender, EventArgs e)
        {
            GetRectangle();
            SIntPoint2      sintp2  = GetAllRectangle(maxW, maxH);
            Bitmap          _bitmap = new Bitmap(sintp2.X, sintp2.Y);
            FRsResourceClip rcl     = _resourceAnimation.FristClip;
            Graphics        g       = Graphics.FromImage(_bitmap);

            for (int i = 0; i < rcl.FrameCount; i++)
            {
                Bitmap bmn = rcl.Frames.Items[i].Bitmap.Native;
                _fCutBitmap = new FBitmap(bmn);
                SIntRectangle rct = _fCutBitmap.TestValidRectangle(1);
                Bitmap        p   = bmn.Clone(new Rectangle(rct.Left, rct.Top, rct.Width, rct.Height), PixelFormat.Format32bppArgb);
                // 防止图片缩放问题
                g.DrawImage(p, i * maxW, 0, p.Width, p.Height);
            }
            QDsResourceViewForm sci = new QDsResourceViewForm();

            foreach (Control item in sci.Controls)
            {
                if (item is PictureBox)
                {
                    PictureBox picbox = item as PictureBox;
                    picbox.Width           = _bitmap.Width;
                    picbox.Height          = _bitmap.Height;
                    picbox.BackgroundImage = _bitmap;
                }
            }
            String mapInfo = "宽:" + _bitmap.Width + " " + "高:" + _bitmap.Height;

            sci.Text = mapInfo;
            g.Dispose();
            sci.Show();
        }
コード例 #5
0
ファイル: QClipMoveControl.cs プロジェクト: whztt07/MoCross
        //============================================================
        public void LoadInfomation(FRsResourceClip clip)
        {
            int freamCount = clip.FrameCount;

            for (int n = 0; n < freamCount; n++)
            {
                FRsResourceFrame fream = clip.Frames[n];
                CreateFream(fream, n + 1);
            }
        }
コード例 #6
0
        //============================================================
        // <T>获取合并以后资源的大小</T>
        //
        // @autor DYWEN 20120816
        //============================================================
        public SIntPoint2 GetAllRectangle(int maxW, int maxH)
        {
            SIntPoint2      sintp = new SIntPoint2();
            FRsResourceClip rcl   = _resourceAnimation.FristClip;
            int             count = rcl.FrameCount;

            sintp.X = count * maxW;
            sintp.Y = maxH;
            return(sintp);
        }
コード例 #7
0
 //============================================================
 protected void SelectClipViewer(QDsResourceClipProperty clipViewer)
 {
     _currentViewer = clipViewer;
     _currentClip   = clipViewer.Clip;
     if (null != _currentClip)
     {
         foreach (QDsResourceClipProperty viewer in _clipViewers)
         {
             viewer.BorderStyle = BorderStyle.FixedSingle;
             viewer.BackColor   = Color.Goldenrod;
         }
         clipViewer.BorderStyle = BorderStyle.Fixed3D;
         clipViewer.BackColor   = Color.Transparent;
         SelectClip(_currentClip);
     }
 }
コード例 #8
0
        //============================================================
        // <T>获取有效区域</T>
        //
        // @autor DYWEN 20120816
        //============================================================
        public void GetRectangle()
        {
            FRsResourceClip rcl = _resourceAnimation.FristClip;

            for (int i = 0; i < rcl.FrameCount; i++)
            {
                Bitmap        bmn     = rcl.Frames.Items[i].Bitmap.Native;
                FBitmap       fbitmap = new FBitmap(bmn);
                SIntRectangle rcthw   = fbitmap.TestValidRectangle(1);
                int           height  = rcthw.Height;
                if (maxH < height)
                {
                    maxH = height;
                }
                int width = rcthw.Width;
                if (maxW < width)
                {
                    maxW = width;
                }
            }
        }
コード例 #9
0
        //============================================================
        //<T>设置重心乘骑点血条位置。<T>
        //
        //============================================================
        private void InfoText(FRsResourceClip clp)
        {
            // 设置剪辑重心
            configX = clp.ValidBarycenter.X;
            configY = clp.ValidBarycenter.Y;
            qdsProperty.Barycenter.Set(configX, configY);
            txtbaryCenterX.Text = configX.ToString();
            txtbaryCenterY.Text = configY.ToString();
            // 设置乘骑点
            int pointX = clp.RidePoint.X;
            int pointY = clp.RidePoint.Y;

            txtRidePointX.Text = pointX.ToString();
            txtRidePointY.Text = pointY.ToString();
            ////pointX = pointX;
            ////pointY = pointY;
            qdsProperty.RidePoint.Set(pointX, pointY);
            //int wpointX = clp.WingPoint.X;
            //int wpointY = clp.WingPoint.Y;
            //txtWingPointX.Text = wpointX.ToString();
            //txtWingPointY.Text = wpointY.ToString();
            //qdsProperty.WingPoint.Set(wpointX, wpointY);
            // 设置血条位置
            if (_currentClip.Blood != null)
            {
                int bloodX = clp.Blood.X;
                int bloodY = clp.Blood.Y;
                BloodX.Text = bloodX.ToString();
                BloodY.Text = bloodY.ToString();
                qdsProperty.Blood.Set(bloodX, bloodY);
            }
            else
            {
                qdsProperty.Blood.Set(0, 0);
                BloodX.Text = 0.ToString();
                BloodY.Text = 0.ToString();
            }
        }
コード例 #10
0
 //============================================================
 // <T>选中当前方向的图像集合。</T>
 //
 // @autor
 //============================================================
 protected void SelectClip(FRsResourceClip clip)
 {
     _currentClip = clip;
     InfoText(_currentClip);
     // 设置帧信息
     txtFrameCount.Text      = clip.FrameCount.ToString();
     txtFrameWidth.Text      = clip.ValidRectangle.Width.ToString();
     txtFrameHeight.Text     = clip.ValidRectangle.Height.ToString();
     txtFramesPerSecond.Text = clip.FrameDelay.ToString();
     txtTotalTime.Text       = clip.FrameDelay.ToString();
     // 设置帧列表
     lvwFrames.Items.Clear();
     if (null != clip)
     {
         //if (clip._isCheckd == ERsIsCheckd.MODULE) {
         //   this.chkModule.Checked = true;
         //}
         //if (clip._isCheckd == ERsIsCheckd.SYSTEM) {
         //   this.chkSystem.Checked = true;
         //}
         foreach (FRsResourceFrame frame in clip.Frames)
         {
             ListViewItem qItem = new ListViewItem(frame.Index.ToString());
             qItem.SubItems.Add(frame.ValidBarycenter.ToString());
             qItem.SubItems.Add(frame.ValidRectangle.Width.ToString() + frame.ValidRectangle.Height.ToString());
             string name = frame.FileName;
             name = name.Substring(name.LastIndexOf("\\") + 1);
             qItem.SubItems.Add(name);
             lvwFrames.Items.Add(qItem);
         }
     }
     tbrModuleDelay.Clear();
     tbrModuleDelay.LoadInfomation(_currentClip);
     // 加载动画
     qdsProperty.LoadClip(clip);
     qdsProperty.DoPlay();
 }
コード例 #11
0
 //============================================================
 // <T>选择资源。</T>
 //
 // @param resource 资源
 //============================================================
 public void SelectResource(FRsResource resource)
 {
     // 打开资源
     resource.Open();
     // 显示资源
     qrsClipViewer.Visible    = false;
     qrsPictureViewer.Visible = false;
     // 显示动画
     if (resource is FRsResourceAnimation)
     {
         FRsResourceAnimation animation = resource as FRsResourceAnimation;
         FRsResourceClip      clip      = animation.FristClip;
         qrsClipViewer.LoadClip(clip);
         qrsClipViewer.DoPlay();
         qrsClipViewer.Visible = true;
     }
     // 显示动画
     if (resource is FRsResourcePicture)
     {
         FRsResourcePicture picture = resource as FRsResourcePicture;
         qrsPictureViewer.LoadPicture(picture);
         qrsPictureViewer.Visible = true;
     }
 }