v4l2_rect_scale(9)
π v4l2_rect_scale β the kernel API manual, bestie edition π
okay so this is v4l2_rect_scale(9), straight out of the Kernel API Manual, and honestly? it's a little icon and it deserves your attention. it does exactly one thing and it does it slayfully. let's get into it β¨
πΈ NAME πΈ
v4l2_rect_scale β scales rect r by to/from
likeβ¦ that's it. that's the whole vibe. it takes a rect and scales it using a from rect and a to rect. no cap. π
β¨ SYNOPSIS β¨
void v4l2_rect_scale (struct v4l2_rect *r , const struct v4l2_rect *from
, const struct v4l2_rect *to );
look at that signature. three pointers, one of them mutable, two of them const because they're just here for the vibes and not to be touched. respect the const, bestie. π«Ά
π¦ ARGUMENTS π¦
rβ rect to be scaled. this is the main character, the one that actually gets changed. the glow-up happens in place, so she better be pointing somewhere real. πfromβ from rectangle. the "before" picture. the origin story. πΈtoβ to rectangle. the "after" picture. the dream. the goal. the future she's manifesting. π
π DESCRIPTION π
so here's the tea β β this function scales rectangle r horizontally by to->width / from->width and vertically by to->height / from->height.
read that again. horizontal scaling = to->width / from->width. vertical scaling = to->height / from->height. those exact ratios, no substitutions, iykyk. π₯
typically r is a rectangle inside from, and you want the rectangle as it would appear after scaling from from to to. so the resulting r will be the scaled rectangle inside to. it's giving "same energy, new dimensions" and honestly? obsessed. π
so like, if you're picturing a little box living inside the from rect, this hands you back where that box ends up once everything gets resized into the to rect. the box stays in the same relative spot, it just gets the proportional glow-up. β¨
heads up bestie: r gets written to directly β she's the destination. from and to are const, so they're strictly read-only. don't come for them. π
π SEE ALSO π
- kernel file
./include/media/v4l2-rect.h v4l2_rect_set_size_to(9)v4l2_rect_set_min_size(9)v4l2_rect_set_max_size(9)v4l2_rect_map_inside(9)v4l2_rect_same_size(9)v4l2_rect_same_position(9)v4l2_rect_equal(9)v4l2_rect_intersect(9)v4l2_rect_overlap(9)v4l2_rect_enclosed(9)
the whole rect friend group, fr fr. go say hi to all of them. π«Άπ
and that's the page!! π§ source: ./include/media, dated October 2026, version v4l2_rect_scale(9). mwah, stan this little rect scaler, and remember β scale responsibly. πΈπ
β
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms