Skip to content

Preserve report page aspect ratio in PNG wireframe rendering - #39

Draft
NatVanG with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-png-wireframe-aspect-ratio
Draft

Preserve report page aspect ratio in PNG wireframe rendering#39
NatVanG with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-png-wireframe-aspect-ratio

Conversation

Copilot AI commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

PNG wireframes were always rendered at a fixed 16:9 size, which distorted report pages that use custom dimensions. This change keeps the rendered height fixed at 720 while deriving the output width and visual layout from each page’s actual aspect ratio.

  • Renderer input

    • Extend wireframe rendering to receive the inspected report path so page metadata can be resolved from the source report definition.
  • Page-size aware scaling

    • Read each page’s width and height from page.json.
    • Compute a uniform scale factor from the source page height to the fixed rendered height.
    • Apply that scale factor to:
      • output page width
      • visual x / y
      • visual width / height
  • Cross-library parity

    • Apply the same scaling behavior in both:
      • FabInspector.ImageLibrary
      • FabInspector.WinImageLibrary
  • Regression coverage

    • Add coverage for a non-16:9 page fixture to verify the generated PNG dimensions reflect the source page aspect ratio.
    • Update PNG writer tests/stubs for the renderer signature change.
var sourcePageSize = GetPageSize(pageName, pageSizes);
var scale = (decimal)DefaultPageHeight / sourcePageSize.Height;

var pageSize = new ReportPage.PageSize
{
    Height = DefaultPageHeight,
    Width = (int)Math.Round(sourcePageSize.Width * scale)
};

var x = ScaleValue(f["x"]!.GetValue<decimal>(), scale);
var y = ScaleValue(f["y"]!.GetValue<decimal>(), scale);
var width = ScaleValue(f["width"]!.GetValue<decimal>(), scale);
var height = ScaleValue(f["height"]!.GetValue<decimal>(), scale);

Copilot AI changed the title [WIP] Fix PNG wireframe generation to match custom aspect ratio Preserve report page aspect ratio in PNG wireframe rendering Jun 18, 2026
Copilot AI requested a review from NatVanG June 18, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants