public void updatesvg(XmlTextWriter doc) { Bitmap bitmap = new Bitmap(this.nx, this.ny, PixelFormat.Format24bppRgb); int num4 = this.nx - 1; for (int i = 0; i <= num4; i++) { int num3 = this.ny - 1; for (int j = 0; j <= num3; j++) { bitmap.SetPixel((this.nx - 1) - i, j, this.cellarray[i, j]); } } MemoryStream stream = new MemoryStream(); PNGMaker.Convert((Image)bitmap, (Stream)stream); stream.Close(); doc.WriteStartElement("image"); doc.WriteAttributeString("x", (this.mycontext.fx(Convert.ToDouble(decimal.Compare(this.p.X, this.r.X) < 0 ? this.p.X : this.r.X))).ToString()); doc.WriteAttributeString("y", (this.mycontext.fy(Convert.ToDouble(decimal.Compare(this.p.Y, this.q.Y) > 0 ? this.p.Y : this.q.Y))).ToString()); double introduced6 = Convert.ToDouble(this.p.X); double introduced7 = Convert.ToDouble(this.r.X); doc.WriteAttributeString("width", (this.mycontext.fscale(Math2.Distance(introduced6, Convert.ToDouble(this.p.Y), introduced7, Convert.ToDouble(this.r.Y)))).ToString()); double introduced8 = Convert.ToDouble(this.r.X); double introduced9 = Convert.ToDouble(this.q.X); doc.WriteAttributeString("height", (this.mycontext.fscale(Math2.Distance(introduced8, Convert.ToDouble(this.r.Y), introduced9, Convert.ToDouble(this.q.Y)))).ToString()); doc.WriteAttributeString("href", "http://www.w3.org/1999/xlink", "data:;base64," + Convert.ToBase64String(stream.ToArray())); if (this.mycontext.isClip & !String.IsNullOrEmpty(mycontext.CurrClipID)) //if (this.mycontext.isClip & (StringType.StrCmp(this.mycontext.CurrClipID, "", false) != 0)) { doc.WriteAttributeString("clip-path", "url(#" + this.mycontext.CurrClipID + ")"); } doc.WriteEndElement(); }
public void UpdateSVG(XmlTextWriter doc, SVGContext mycontext) { TIFFMaker maker = new TIFFMaker(); int num8 = this.Tiles.Count - 1; for (int i = 0; i <= num8; i++) { MemoryStream stream; BitMapMaker maker2 = default(BitMapMaker); MemoryStream stream3; int colorPrecision; MemoryStream s = new MemoryStream(); maker.T6Data = (byte[])this.Tiles[i]; maker.ImageWidth = this.TileSize.Width; maker.ImageHeight = this.TileSize.Height; switch (this.cmprType) { case 2: if (!this.isBitonal) { break; } maker.ImageWidth = (this.TileSize.Width + 7) & -8; maker.ProduceBilevel((Stream)s); goto Label_00B6; case 5: stream3 = new MemoryStream((byte[])this.Tiles[i]); colorPrecision = this.colorPrecision; if (colorPrecision != 8) { goto Label_0116; } maker2 = new BitMapMaker(stream3, this.TileSize.Width, this.TileSize.Height, PixelFormat.Format24bppRgb); goto Label_0148; case 7: //s = new MemoryStream((byte[])this.Tiles[i], this.SDRLen, Information.UBound((byte[])this.Tiles[i], 1) - (this.SDRLen - 1)); // s.set_Position(0L); goto Label_01BE; default: goto Label_01BE; } maker.ProduceContonal(s); Label_00B6: // s.set_Position(0L); goto Label_01BE; Label_0116: switch (colorPrecision) { case 0x10: maker2 = new BitMapMaker(stream3, this.TileSize.Width, this.TileSize.Height, PixelFormat.Format48bppRgb); break; } Label_0148: maker2.CreateImage(); s = (MemoryStream)maker2.GetFinalStream(); // s.set_Position(0L); Label_01BE: stream = new MemoryStream(); PNGMaker.Convert((Stream)s, (Stream)stream); s.Close(); stream.Close(); int num2 = i % this.NumberTiles.Width; int num3 = i / this.NumberTiles.Width; double num4 = mycontext.fx(Convert.ToDouble(this.Position.X)) + (num2 * mycontext.fscale((double)(((float)this.TileSize.Width) / this.PointSize.Width))); double num5 = mycontext.fy(Convert.ToDouble(this.Position.Y)) + (num3 * mycontext.fscale((double)(((float)this.TileSize.Height) / this.PointSize.Height))); doc.WriteStartElement("image"); doc.WriteAttributeString("x", Math.Floor((double)num4).ToString()); doc.WriteAttributeString("y", Math.Floor((double)num5).ToString()); doc.WriteAttributeString("width", (Math.Floor(mycontext.fscale((double)(((float)this.TileSize.Width) / this.PointSize.Width)))).ToString()); doc.WriteAttributeString("height", (Math.Ceiling(mycontext.fscale((double)(((float)this.TileSize.Height) / this.PointSize.Height)))).ToString()); doc.WriteAttributeString("href", "http://www.w3.org/1999/xlink", "data:;base64," + Convert.ToBase64String(stream.ToArray())); doc.WriteEndElement(); } }