public void saveGraphics(NetGraphics netG) { if (netG == null ) { return; } if (netG.g != null ) { this.Transform = netG.g.Transform; this.Clip = netG.g.Clip; this.SmoothingMode = netG.g.SmoothingMode; this.PixelOffsetMode = netG.g.PixelOffsetMode; this.TextRenderingHint = netG.g.TextRenderingHint; this.InterpolationMode = netG.g.InterpolationMode; this.CompositingMode = netG.g.CompositingMode; savedGraphics = true; } if (netG.pen != null && netG.brush != null) { pen = (Pen)netG.pen.Clone(); brush = (Brush)netG.brush.Clone(); } }
public void restoreGraphics(NetGraphics netG) { if (netG == null) { return; } if (netG.g != null) { if (savedGraphics) { netG.g.Transform = Transform; netG.g.Clip = Clip; netG.g.SmoothingMode = SmoothingMode; netG.g.PixelOffsetMode = PixelOffsetMode; netG.g.TextRenderingHint = TextRenderingHint; netG.g.InterpolationMode = InterpolationMode; netG.g.CompositingMode = CompositingMode; } else { // default values that Java used netG.g.InterpolationMode = InterpolationMode.NearestNeighbor; } } if ( pen != null && brush != null ) { netG.pen = (Pen)pen.Clone(); netG.brush = (Brush)brush.Clone(); } else { netG.pen = new Pen(netG.color); netG.brush = new SolidBrush(netG.color); netG.setRenderingHint(java.awt.RenderingHints.KEY_TEXT_ANTIALIASING, java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT); } }
public NetGraphicsState( NetGraphics netG ) { saveGraphics(netG); }