libretro / libretro/RetroArch

Feature Request: Enables cores to influence scaling and cropping

Open
#10,930 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

For some 2D cores it would useful to be able to request that their output is scaled in specific ways.
Values in the "scaleHints" object could be:

  • "interpoaltion"
    -- "default": no preference
    -- "enbaled": use bilinear (or better) interpolation
    -- "disaled": use neares neighbor scaling
    -- "down": like "enabled" when source is larger than target, like "disabled" otherwise

  • "imageFit"
    -- "default": no preference
    -- "contain": current non-integer behavior (respect AR, maxium size without overflow, centered)
    -- "cover": respect AR, minimumsize covering the entirescreen, centered, crop overflow (this may not have use-cases here)
    -- "stretch": fill screen exactly, ignoring aspect ratio
    -- "integerHeight"/"integerWidth": like "contain", but scale factor of height/witdh is reduced until it is integer and the one of the other dimension is adapted to keep the aspect ratio
    -- "pixelPerfect": like "integerHeight"/"integerWidth", but both scale factors are reduced to the nearest integer, ignoring aspect ratio

When both source and target have a pixel aspect ratio of 1 "integerHeight", "integerWidth" & "pixelPerfect" produce the same result.

  • "crop"/"softCrop"
    -- "top", "bottom", "left", "right": Specifies an amoutnt of source pixel rows or columns to be ignored when scaling. This basicly reduces the dimension of the source from the four sides. The difference is that "crop" means the cropped edges should never be visible, even when they are on screen due to "imageFit" settings, while for "soft-crop" they should be visible in that case.

  • "backgroundColor": The color used where no source is visisble, i.e. around centered sources due to "imageFit". This could be one color or multiple ones for qudrants or gradients.

This will need refining, but I tink it could be quite usefull, especially if it can be changed during runtime.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue does not name implementation files, tests, or entry points. Start by refining the proposed scaleHints schema and its runtime behavior for interpolation, image fitting, cropping, and background colors. Define concrete acceptance cases for each option before locating the frontend scaling and cropping code.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.