Draws movie scaled to target width/height (calculates scaleX/Y from dimensions, uses b2dSetScale+b2dDrawMovie).
Takes handle (movie handle from b2dLoadMovie, integer), x (screen X position in pixels), y (screen Y position in pixels), width (target width in pixels, desired rendered width), height (target height in pixels, desired rendered height).
Returns nothing.
2D Overlay
Parameters & Returns
Parameters
handleInt
xInt
yInt
widthInt
heightInt
Returns
Void
Quick Summary
Draws movie scaled to target width/height (calculates scaleX/Y from dimensions, uses b2dSetScale+b2dDrawMovie).
Takes handle (movie handle from b2dLoadMovie, integer), x (screen X position in pixels), y (screen Y position in pixels), width (target width in pixels, desired rendered width), height (target height in pixels, desired rendered height).
Returns nothing.
Technical Exegesis...
Draws movie scaled to target width/height (calculates scaleX/Y from dimensions, uses b2dSetScale+b2dDrawMovie). Takes handle (movie handle from b2dLoadMovie, integer), x (screen X position in pixels), y (screen Y position in pixels), width (target width in pixels, desired rendered width), height (target height in pixels, desired rendered height). Returns nothing.
Draws movie scaled to target width/height (calculates scaleX/Y from dimensions, uses b2dSetScale+b2dDrawMovie). Takes handle (movie handle from b2dLoadMovie, integer), x (screen X position in pixels), y (screen Y position in pixels), width (target width in pixels, desired rendered width), height (target height in pixels, desired rendered height). Returns nothing. Calculates scale factors (scaleX = width / movie->width, scaleY = height / movie->height), applies scale (b2dSetScale(scaleX, scaleY) sets global 2D scale state), draws movie (b2dDrawMovie(handle, x, y) renders with applied scale), resets scale (b2dSetScale(1.0, 1.0) restores default scale after draw). Use to fit movie to screen size (scale to fill area), letterbox/pillarbox video (scale maintaining aspect ratio with bars), or resize video dynamically (stretch/squash to arbitrary dimensions). Scale calculation: scaleX (width / movie->width, horizontal scale factor), scaleY (height / movie->height, vertical scale factor), independent scaling (can produce non-uniform scaling, stretching or squashing if aspect ratios differ), applied via global state (b2dSetScale affects all subsequent draws until reset). Use cases: (1) Fullscreen video (b2dDrawMovieScaled(movie,0,0,screenW,screenH) fill entire screen), (2) Maintain aspect (aspect=movieW/movieH: targetH=targetW/aspect: b2dDrawMovieScaled(movie,x,y,targetW,targetH) preserve aspect ratio), (3) Picture-in-picture (b2dDrawMovieScaled(movie,pipX,pipY,pipW,pipH) small inset video), (4) Dynamic resize (b2dDrawMovieScaled(movie,x,y,animW,animH) animated resize effect). Common patterns: fullscreen = b2dDrawMovieScaled(movie,0,0,screenW,screenH) fill screen; fit width = scale to screen width, calculate height from aspect; fit height = scale to screen height, calculate width from aspect. Aspect ratio handling: stretch (use arbitrary width/height, may distort video), maintain aspect fit-width (targetH = targetW / (movieW/movieH), scales to fit width), maintain aspect fit-height (targetW = targetH x (movieW/movieH), scales to fit height), maintain aspect contain (calculate scale to fit inside target rect without cropping). State management: scale applied (b2dSetScale sets global 2D state before draw), scale reset (b2dSetScale(1.0,1.0) restores after draw, prevents affecting other draws), scoped effect (scale only applies to this movie draw, not subsequent draws). Performance: same as b2dDrawMovie (scale applied via GPU transform matrix, negligible cost ~0.01-0.1ms), filtering quality (GPU bilinear filtering for smooth scaling, no artifacts for most scale factors), no additional memory (scaling done by GPU, no CPU-side resize). Validation: silently ignores if handle<=0 or not found (negative, zero, or invalid handle), safe with zero width/height (produces zero or infinite scale, may cause no draw or full screen fill), calculates scale even if movie->width/height==0 (division by zero risk if invalid movie, but header validation prevents this). Related: b2dDrawScaledMovie draws with scale factors (alternative using scaleX/scaleY floats instead of target dimensions), b2dDrawMovie draws unscaled (original movie dimensions), b2dMovieWidth/Height query dimensions (use to calculate target width/height maintaining aspect), b2dSetScale sets global scale (manually control scaling without helper function).