use Alignment;
use Draw;
use DrawContext;
use HorizontalAlignment;
use widgets::image;
#[inline]
pub fn draw<D: ?Sized + Draw>(draw: &DrawContext<D>, empty: &D::ImageResource,
full: &D::ImageResource, progress: f32,
progress_direction: &HorizontalAlignment, alignment: &Alignment)
{
let draw = draw.animation_stop();
let ratio = draw.draw().get_image_width_per_height(empty);
stretch(&draw.enforce_aspect_ratio_downscale(ratio, alignment), empty, full, progress,
progress_direction)
}
pub fn stretch<D: ?Sized + Draw>(draw: &DrawContext<D>, empty: &D::ImageResource,
full: &D::ImageResource, progress: f32,
progress_direction: &HorizontalAlignment)
{
assert!(progress >= 0.0);
assert!(progress <= 1.0);
image::stretch(draw, empty);
let draw = draw.horizontal_rescale(progress, progress_direction);
draw.draw().draw_image_uv(full, &draw.matrix(), [0.0, 1.0], [progress, 1.0], [progress, 0.0],
[0.0, 0.0]);
}