UMD.HCIL.Piccolo.PNode.ScaleAndDraw C# (CSharp) Method

ScaleAndDraw() protected method

Scale the Graphics so that this node's full bounds fit in displayRect and then render into the given Graphics context.
protected ScaleAndDraw ( Graphics g, RectangleF displayRect ) : void
g System.Drawing.Graphics The Graphics context to use when rendering the node.
displayRect System.Drawing.RectangleF The imageable area.
return void
		protected virtual void ScaleAndDraw(Graphics g, RectangleF displayRect) {
			RectangleF bounds = FullBounds;
			g.TranslateTransform(displayRect.X, displayRect.Y);

			// scale the graphics so node's full bounds fit in the imageable bounds.
			float scale = displayRect.Width / bounds.Width;
			if (displayRect.Height / bounds.Height < scale) {
				scale = displayRect.Height / bounds.Height;
			}
		
			g.ScaleTransform(scale, scale);
			g.TranslateTransform(-bounds.X, -bounds.Y);
		
			PPaintContext pc = new PPaintContext(g, null);
			pc.RenderQuality = RenderQuality.HighQuality;
			FullPaint(pc);
		}
		#endregion