Skip to main content

System.Drawing.Managed and Cross-Platform Rendering

A TopologyImageRenderer turns the same topology model into PNG bytes with no Wisej control and no session involved: a Bitmap, a Graphics over it, pens, brushes and a GraphicsPath, a font resolved through a fallback chain, and Application.Download handing the bytes to the browser. The three remaining Module 1 surfaces - Label + ProgressBar, a Wisej.Web.Canvas and an off-screen Bitmap in a PictureBox - stay on the operations page under the gauges, so the same reading can still be compared across surfaces. Surface 2, the inline Paint handler, is now the TelemetryGauge control itself.

This folder is the complete application at this point in the course, with its own solution and port.

Run it​

cd "Drawing and Painting Course/Module 6/VisualOperationsStudio"
dotnet run -f net10.0 --urls http://localhost:6006

Open http://localhost:6006, press Plant topology, then Export PNG.

What to try​

ActionExpected result
Export PNGThe browser downloads plant-topology.png. The status line reports the size, the time, how many objects were drawn and which font family was actually resolved.
Export twiceThe first call is slower (JIT and the font probe); after that it settles. Both numbers are recorded in CrossPlatform.md.
Drag a node, then exportThe image follows the model, because the export renders the model again — it never screenshots the Canvas.
Empty the scene (TopologyScene.CreatePlant returning no nodes)A readable image saying "No nodes to display", not a blank file.
Drop a .ttf into a Fonts/ folder beside the application and exportThe status line names that family instead of the runtime fallback.
Ask for 4000 × 3000 in btnExport_ClickThe renderer clamps each side to 200–2000 rather than allocating ~48 MB.
Open VisualOperationsStudio.csprojOne drawing implementation: Wisej-4 brings Managed.System.Drawing, and there is no direct System.Drawing.Common reference.