Example #1
0
 public void  paint(System.Drawing.Graphics g, System.Windows.Forms.Control c)
 {
     //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Graphics.getFont' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
     System.Drawing.Font font    = SupportClass.GraphicsManager.manager.GetFont(g);
     System.Drawing.Font metrics = SupportClass.GraphicsManager.manager.GetFont(g);
     //UPGRADE_TODO: Class 'java.awt.font.FontRenderContext' was converted to 'System.Windows.Forms.Control' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'"
     //UPGRADE_ISSUE: Constructor 'java.awt.font.FontRenderContext.FontRenderContext' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javaawtfontFontRenderContextFontRenderContext_javaawtgeomAffineTransform_boolean_boolean'"
     System.Drawing.Text.TextRenderingHint frc = TextRenderingHint.AntiAlias; //  new FontRenderContext(null, false, false);
     System.Drawing.Size size = c.Size;
     SupportClass.GraphicsManager.manager.SetColor(g, c.BackColor);
     g.FillRectangle(SupportClass.GraphicsManager.manager.GetPaint(g), 0, 0, size.Width, size.Height);
     SupportClass.GraphicsManager.manager.SetColor(g, c.ForeColor);
     g.DrawRectangle(SupportClass.GraphicsManager.manager.GetPen(g), 0, 0, size.Width - 1, size.Height - 1);
     if (strs != null)
     {
         int y = 0;
         for (int i = 0; i < strs.Length; i++)
         {
             // TODO: use render hint? frc
             y += (int)g.MeasureString(strs[i], font).Height + 2;
             //UPGRADE_TODO: Method 'java.awt.Graphics.drawString' was converted to 'System.Drawing.Graphics.DrawString' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtGraphicsdrawString_javalangString_int_int'"
             g.DrawString(strs[i], SupportClass.GraphicsManager.manager.GetFont(g), SupportClass.GraphicsManager.manager.GetBrush(g), 3, y - SupportClass.GraphicsManager.manager.GetFont(g).GetHeight());
             //g.drawString(strs[i],3,(metrics.getHeight())*(i+1));
         }
     }
 }
Example #2
0
 private void Initialize(System.Drawing.Font font, IGraphicsDeviceService gds, System.Drawing.Text.TextRenderingHint trh)
 {
     this.font = font;
     this.GDS = gds;
     this.textRenderingHint = trh;
     if (brush == null)
     {
         brush = Brushes.White;
         tempBp = new Bitmap(1, 1);
         tempGr = System.Drawing.Graphics.FromImage(tempBp);
         strm = new MemoryStream();
     }
     this.CharTiles = new Dictionary<char, CharTile>();
     this.Tex2ds = new List<Texture2D>();
     this.newTex();
 }
Example #3
0
 protected unsafe void AddTex(char chr)
 {
     lock (this.lockObj)
     {
         if (!this.CharTiles.ContainsKey(chr))
         {
             string text = chr.ToString();
             this.sizef = tempGr.MeasureString(text, this.Font, PointF.Empty, StringFormat.GenericTypographic);
             if (this.sizef.Width <= 0f)
             {
                 this.sizef.Width = this.sizef.Height / 2f;
             }
             if (((this.bitmap == null) || (((int)Math.Ceiling((double)this.sizef.Width)) != this.bitmap.Width)) || (((int)Math.Ceiling((double)this.sizef.Height)) != this.bitmap.Height))
             {
                 this.bitmap = new Bitmap((int)Math.Ceiling((double)this.sizef.Width), (int)Math.Ceiling((double)this.sizef.Height), System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                 this.gr = System.Drawing.Graphics.FromImage(this.bitmap);
             }
             else
             {
                 this.gr.Clear(System.Drawing.Color.Empty);
             }
             this.gr.TextRenderingHint = this.textRenderingHint;
             this.gr.DrawString(text, this.Font, brush, 0f, 0f, StringFormat.GenericTypographic);
             if (this.bitmap.Height > this.CurrentMaxHeight)
             {
                 this.CurrentMaxHeight = this.bitmap.Height;
             }
             if (((this.CurrentLeft + this.bitmap.Width) + 1) > this.CurrentTex2d.Width)
             {
                 this.CurrentTop += this.CurrentMaxHeight + 1;
                 this.CurrentLeft = 0;
             }
             if ((this.CurrentTop + this.CurrentMaxHeight) > this.CurrentTex2d.Height)
             {
                 this.newTex();
             }
             CharTile tile = new CharTile(this.CurrentTex2d, new Rectangle(this.CurrentLeft, this.CurrentTop, this.bitmap.Width, this.bitmap.Height));
             this.CharTiles.Add(chr, tile);
             int[] numArray = new int[this.bitmap.Width * this.bitmap.Height];
             System.Drawing.Imaging.BitmapData bitmapdata = this.bitmap.LockBits(new System.Drawing.Rectangle(0, 0, this.bitmap.Width, this.bitmap.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
             int* numPtr = (int*)bitmapdata.Scan0;
             for (int i = 0; i < numArray.Length; i++)
             {
                 if (numPtr[0] != 0)
                 {
                     numArray[i] = numPtr[0];
                 }
                 numPtr++;
             }
             this.bitmap.UnlockBits(bitmapdata);
             this.GDS.GraphicsDevice.Textures[0] = null;
             this.CurrentTex2d.SetData<int>(0, new Rectangle?(tile.Rectangle), numArray, 0, numArray.Length);
             this.CurrentLeft += tile.Rectangle.Width + 1;
         }
     }
 }
Example #4
0
 public SvgDocument()
 {
     this.styleElements = new ArrayList();
     this.recordanim = true;
     this.playAnim = false;
     this.controltime = 0;
     this.filename = "���";
     this.update = true;
     this.undoStack = new UndoStack();
     this.xmlreader = null;
     this.preelement = null;
     this.elements = new ArrayList(0x10);
     this.infos = new Hashtable(0x10);
     this.groups = new ArrayList(0x10);
     this.undoGroup = new ArrayList(0x10);
     this.errorinfos = new ArrayList(0x10);
     this.selectCollection = new SvgElementCollection();
     this.oldSelect = new SvgElementCollection();
     this.root = null;
     this.serialize = null;
     this.editRoots = new SvgElementCollection();
     //this.styleSheetList = null;
     this.ChangeElements = new SvgElementCollection();
     this.NumberOfUndoOperations = 1;
     this.ValidPath = new GraphicsPath();
     this.firstload = false;
     this.FilePath = string.Empty;
     this.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     this.TextRenderingHint = System.Drawing.Text.TextRenderingHint.SystemDefault;
     this.Changed = false;
     this.SelectChanged = false;
     this.OnlyShowCurrent = false;
     this.DefsChanged = true;
     this.OldControlTime = 0;
     this.PlayAnimChanged = false;
     this.AutoShowAnim = false;
     this.XmlParserContext = null;
     XmlNamespaceManager manager1 = new XmlNamespaceManager(base.NameTable);
     manager1.PushScope();
     manager1.AddNamespace("svg", SvgDocument.SvgNamespace);
     manager1.AddNamespace("xlink", SvgDocument.XLinkNamespace);
     manager1.AddNamespace("a", SvgDocument.AudioNamespace);
     manager1.AddNamespace("tonli", SvgDocument.TonliNamespace);
     base.NodeChanged += new XmlNodeChangedEventHandler(this.ChangeNode);
     base.NodeInserted += new XmlNodeChangedEventHandler(this.ChangeNode);
     base.NodeRemoved += new XmlNodeChangedEventHandler(this.ChangeNode);
     this.XmlParserContext = new System.Xml.XmlParserContext(base.NameTable, manager1, "", "svg", "-//W3C//DTD SVG 1.1//EN", "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd", this.BaseURI, "zh", XmlSpace.None, Encoding.UTF8);
     this.selectCollection.NotifyEvent = true;
     this.selectCollection.OnCollectionChangedEvent += new OnCollectionChangedEventHandler(this.ChangeSelect);
     this.serialize = new SerializeDocument(this);
     this.AddStyleElement(SvgDocument.SvgNamespace, "style");
     this.SvgdataUid=string.Empty;
     layers =new SvgElementCollection();
 }