Skip to main content

ss_player_fit_into

Function ss_player_fit_into 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn ss_player_fit_into( handle: *mut SsPlayer, width: f32, height: f32, placement: *const SsPlacement, out: *mut SsPlaced, ) -> i32
Expand description

Fit the animation into a width x height box and place it there, as ss_player_set_transform would.

out may be null; when it is not, it receives the transform that was written, so a host can read back the scale it got.

Returns SS_OK, or SS_ERROR_INVALID_ARGUMENT when the handle or placement is null or fit / align is not one of the constants. A collapsed box and an animation that is not set up are not errors: both place the player centred and unscaled, which is what a host laying out a box that has not been measured yet should get.

The size is in pixels of the render target, so call this again when that box changes — on a resize, and after ss_player_set_animation when the canvas differs.

§Safety

handle must be a live handle or null; placement must point at a readable ss_placement_t; out must be null or point at a writable ss_placed_t.