Пример #1
0
        private void RoundTimer_Tick(object sender, EventArgs e)
        {
            // 計算FPS
            _FPSTick--;
            bool refreshFPS = false;

            if (_FPSTick <= 0)
            {
                _FPSTick = 10;
                _FPSWatch.Restart();
                refreshFPS = true;
            }

            Round();

            // 計算FPS
            if (refreshFPS)
            {
                _FPSWatch.Stop();
                _FPSText = (TimeSpan.TicksPerSecond / _FPSWatch.Elapsed.Ticks).ToString();
            }

            // 清除繪圖物件
            if (DrawClearCount.IsFull)
            {
                DrawPool.ReleaseUseless();
                DrawClearCount.Value = 0;
            }
            DrawClearCount.Value++;
        }
Пример #2
0
            /// <summary>
            /// 返還畫筆和筆刷
            /// </summary>
            public void BackPenAndBrush()
            {
                if (Pen != null)
                {
                    DrawPool.BackPen(Pen);
                    Pen = null;
                }

                if (Brush != null)
                {
                    DrawPool.BackBrush(Brush);
                    Brush = null;
                }
            }
Пример #3
0
        /// <summary>
        /// 取得指定索引的色彩筆刷
        /// </summary>
        /// <param name="colorID">色彩索引</param>
        /// <returns>取得筆刷</returns>
        public SolidBrush GetBrush(string colorID)
        {
            DrawColor drawColor;

            if (_DrawColor.TryGetValue(colorID, out drawColor))
            {
                if (drawColor.Brush == null)
                {
                    Color brushColor = ColorFix.GetColor(drawColor.Color, Opacity, RFix, GFix, BFix);
                    drawColor.Brush = DrawPool.GetBrush(brushColor);
                }
                return(drawColor.Brush);
            }
            return(_BrushNull);
        }
Пример #4
0
        /// <summary>
        /// 取得指定索引的色彩畫筆
        /// </summary>
        /// <param name="colorID">色彩索引</param>
        /// <returns>取得畫筆</returns>
        public Pen GetPen(string colorID)
        {
            DrawColor drawColor;

            if (_DrawColor.TryGetValue(colorID, out drawColor))
            {
                if (drawColor.Pen == null)
                {
                    Color penColor = ColorFix.GetColor(drawColor.Color, Opacity, RFix, GFix, BFix);
                    drawColor.Pen = DrawPool.GetPen(penColor);
                }
                return(drawColor.Pen);
            }
            return(_PenNull);
        }