public static Bitmap CreateAutoSizedBitmap( DxfModel model, DxfLayout layout, ICollection <DxfViewport> viewports, Matrix4D transform, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode, System.Drawing.Color backColor, Size maxSize) { BoundsCalculator boundsCalculator = new BoundsCalculator(graphicsConfig); boundsCalculator.GetBounds(model, layout, viewports, transform); Bounds3D bounds = boundsCalculator.Bounds; if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap(backColor, maxSize.Width, maxSize.Height)); } int num1 = maxSize.Width - 4; int num2 = maxSize.Height - 4; Matrix4D scaleTransform = DxfUtil.GetScaleTransform(bounds.Corner1, bounds.Corner2, new WW.Math.Point3D(bounds.Corner1.X, bounds.Corner2.Y, 0.0), new WW.Math.Point3D(0.0, (double)num2, 0.0), new WW.Math.Point3D((double)num1, 0.0, 0.0), new WW.Math.Point3D(2.0, 2.0, 0.0)); Matrix4D to2DTransform = scaleTransform * transform; WW.Math.Vector3D vector3D = scaleTransform.Transform(bounds.Corner2) - scaleTransform.Transform(bounds.Corner1); int width = System.Math.Min(maxSize.Width, (int)System.Math.Ceiling(System.Math.Abs(vector3D.X)) + 4); int height = System.Math.Min(maxSize.Height, (int)System.Math.Ceiling(System.Math.Abs(vector3D.Y)) + 4); return(ImageExporter.CreateBitmap(model, layout, viewports, graphicsConfig, smoothingMode, backColor, to2DTransform, width, height)); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, GDIGraphics3D cadGraphics, SmoothingMode smoothingMode, Matrix4D transform, System.Drawing.Color backColor, Size maxSize) { cadGraphics.CreateDrawables(model); Bounds3D bounds = new Bounds3D(); cadGraphics.BoundingBox(bounds, transform); int num1 = maxSize.Width - 4; int num2 = maxSize.Height - 4; Matrix4D transform1 = DxfUtil.GetScaleTransform(bounds.Corner1, bounds.Corner2, new WW.Math.Point3D(bounds.Corner1.X, bounds.Corner2.Y, 0.0), new WW.Math.Point3D(0.0, (double)num2, 0.0), new WW.Math.Point3D((double)num1, 0.0, 0.0), new WW.Math.Point3D(2.0, 2.0, 0.0)) * transform; bounds.Reset(); cadGraphics.BoundingBox(bounds, transform1); if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap(backColor, maxSize.Width, maxSize.Height)); } WW.Math.Vector3D delta = bounds.Delta; int width = System.Math.Min(maxSize.Width, (int)System.Math.Ceiling(delta.X) + 4); int height = System.Math.Min(maxSize.Height, (int)System.Math.Ceiling(delta.Y) + 4); return(ImageExporter.CreateBitmap(cadGraphics, smoothingMode, transform1, backColor, width, height)); }
public static Bitmap CreateAutoSizedBitmap( GDIGraphics3D cadGraphics, SmoothingMode smoothingMode, Matrix4D transform, System.Drawing.Color backColor) { transform = Transformation4D.Translation(2.0, 2.0, 0.0) * transform; Bounds3D bounds = new Bounds3D(); cadGraphics.BoundingBox(bounds, transform); if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap(backColor, 1, 1)); } WW.Math.Vector3D delta = bounds.Delta; Matrix4D transform1 = DxfUtil.GetScaleTransform(bounds.Min, bounds.Max, new WW.Math.Point3D(2.0, delta.Y + 2.0, 0.0), new WW.Math.Point3D(delta.X + 2.0, 2.0, 0.0)) * transform; int width = (int)System.Math.Ceiling(delta.X) + 4; int height = (int)System.Math.Ceiling(delta.Y) + 4; return(ImageExporter.CreateBitmap(cadGraphics, smoothingMode, transform1, backColor, width, height)); }
public static Bitmap CreateAutoSizedBitmap( DxfModel model, Matrix4D transform, GraphicsConfig graphicsConfig, SmoothingMode smoothingMode) { BoundsCalculator boundsCalculator = new BoundsCalculator(graphicsConfig); boundsCalculator.GetBounds(model, transform); Bounds3D bounds = boundsCalculator.Bounds; if (!bounds.Initialized) { return(ImageExporter.CreateEmptyBitmap((System.Drawing.Color)graphicsConfig.BackColor, 1, 1)); } WW.Math.Vector3D delta = bounds.Delta; Matrix4D transform1 = DxfUtil.GetScaleTransform(bounds.Min, bounds.Max, new WW.Math.Point3D(2.0, delta.Y + 2.0, 0.0), new WW.Math.Point3D(delta.X + 2.0, 2.0, 0.0)) * transform; int width = (int)System.Math.Ceiling(delta.X) + 4; int height = (int)System.Math.Ceiling(delta.Y) + 4; return(ImageExporter.CreateBitmap(model, transform1, graphicsConfig, smoothingMode, width, height)); }