Example #1
0
        private void UpdateTokenBuffer(int width, int height, GraphicsId sz)
        {
            if (!tokenmap.ContainsKey(sz))
            {
                //System.Diagnostics.Debug.WriteLine("Buffering Token " + width + ", " + height);

                Bitmap   b1 = new Bitmap(width + 1, height + 1);
                Graphics g1 = Graphics.FromImage(b1);
                Bitmap   b2 = new Bitmap(width + 1, height + 1);
                Graphics g2 = Graphics.FromImage(b2);

                DoDrawTokens(g1, g2, 0, 0, width, height);
                g1.Dispose(); g2.Dispose();

                tokenmap.Add(sz, b1);
                seltokenmap.Add(sz, b2);
            }
        }
Example #2
0
        protected void DrawTokens(Graphics g, Graphics gsel, int left, int top, int width, int height)
        {
            //System.Diagnostics.Debug.WriteLine("Tokens " + width + ", " + height);
            if (!usetokenbuffer)
            {
                DoDrawTokens(g, gsel, left, top, width, height);
                return;
            }

            GraphicsId sz = new GraphicsId(width, height, SelectedColor);

            UpdateTokenBuffer(width, height, sz);

            Image i  = tokenmap[sz];
            Image si = seltokenmap[sz];

            g.DrawImageUnscaled(i, left, top);
            gsel.DrawImageUnscaled(si, left, top);
        }
Example #3
0
            public override bool Equals(object obj)
            {
                GraphicsId id = obj as GraphicsId;

                if (id != null)
                {
                    if (id.wd != wd)
                    {
                        return(false);
                    }
                    if (id.hg != hg)
                    {
                        return(false);
                    }
                    if (id.cl != cl)
                    {
                        return(false);
                    }
                    return(true);
                }
                return(base.Equals(obj));
            }