Capture Viewport To Bitmap

Hi,

I belive there is a bug in display pipeline.DrawToBitmap and RhinoView.CaptureToBitmap functions (probably both calls to the same source function)

Setting a 1000x1000 resolution the result is ok (Color is good):

but setting a wide ratio (2000x1000) the result looks white

This is the exemple code:

 protected override Result RunCommand(RhinoDoc doc, RunMode mode)
    {
        var circle = new Circle(Plane.WorldXY, 10).ToNurbsCurve();
        var hatches = Hatch.Create(circle, 0, 0, 1, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);

        var attr = RhinoDoc.ActiveDoc.CreateDefaultAttributes();
        attr.ColorSource = ObjectColorSource.ColorFromObject;
        attr.ObjectColor = Color.Crimson;

        foreach (var hatch in hatches)
            RhinoDoc.ActiveDoc.Objects.AddHatch(hatch, attr.Duplicate());

        var pathDesktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

        var bm1 = DisplayPipeline.DrawToBitmap(RhinoDoc.ActiveDoc.Views.ActiveView.ActiveViewport, 2000, 1000);
        bm1.Save(Path.Combine(pathDesktop, "2000x1000LooksGray.jpg"));

        var bm2 = RhinoDoc.ActiveDoc.Views.ActiveView.CaptureToBitmap(new Size(1000, 1000));
        bm2.Save(Path.Combine(pathDesktop, "1000x1000LooksOK.jpg"));

        return Result.Success;
    }

Could you let me know if there is an other way to capture the bitmap in wide snapshot?

Thanks and Best Regards

Hi @henrydm,

I am not seeing this on my system running the Rhino 6.1 release candidate. Here is what I used to test

TestDrawToBitmap.py (999 Bytes)

Are you seeing this on other systems? What video card does your system have? (Help > System Informaton)?

– Dale

Hi Dale,

I tested it in a Nvidia Quadro K600, Nvidia GTX 970 and Intel HD Graphics 4600, I did it, using your python script and the c# code I provided with the same result.

Best Regards.

Make sure to disable any custom plugins when testing just to make sure that you and Dale are really performing the same test. Does that make any difference?

Hello Steve,

I tested it in safe mode, enabling only the example plugin, you can see it here:

The code is the same but the behavior is different, (the first example was made using Rhino Beta) but there is still a problem width the 2000x1000 picture and any other wide resolution.

Best Regards