viewport — GFX2D camera op

• Data kinds: rgb → rgb

• Call: import fullseye as fs; fs.ledger.viewport(img, x, y, width, height, scale=1.0, interp='bilinear') (implementation को सीधे call करना हो तो import gfx2d; gfx2d.viewport(img, x, y, width, height, scale=1.0, interp='bilinear'), registry से लेना हो तो opsgfx2d.get("viewport"))

उपयोग

(x, y, width, height) पर rectangle crop करता है और उसे scale से resample करता है।

> नीचे का विस्तृत विवरण मूल text में है — सारांश और headings का अनुवाद हो चुका है।

Accepts rgb or rgba (straight alpha; the crop is a copy, so no premultiplication is involved) and returns the same channel count.

Out-of-bounds raises, unlike sprite_blit, which clips. The asymmetry is the point: a sprite leaving the screen is the normal case, while a camera asking for rows the image does not have is arithmetic that has already gone wrong somewhere upstream, and returning a partly black frame would let it keep going.

scale=1 with integer bounds returns an exact sub-array copy — no interpolation touches it.

संदर्भ (sample data, साहित्य)

• Sample data catalog (DL URL / license) — 2-D के लिए skimage.data (BSD/public) + synthetic, 3-D के लिए real data sources (Stanford/PDS आदि) के DL URL।

• Operators का स्रोत और संदर्भ — इस op family के मूल research/methods के स्रोत।

• Algorithm का मानक स्रोत (लेखक, वर्ष) और उपयोग ऊपर की family usage guide में दिए गए हैं।

चलाए जा सकने वाले उदाहरण (verified samples जो सच में यह op call करते हैं)

• gfx2d_scene — py -3.11 examples/gfx2d_scene.py

वे अगले ops जिनसे type जुड़ता है (rgb को input के रूप में लेते हैं)

srgb_to_linear · linear_to_srgb · blend_mode · light_mask · normal_map_decode · bloom · vignette · chromatic_aberration

इसी category के (camera)

—


*Provenance: gfx2d.py — GFX2D operator registry. यह per-op note tools/opdocs.py md से अपने-आप generate होता है (हाथ से edit न करें)।*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.