/// Draws the most recently pushed layer to the drawing target with
/// the pushed opacity applied.
Draws the most recently pushed layer to the drawing target with
the pushed opacity applied.
Draws the most recently pushed layer to the drawing target with the pushed opacity applied .
pub fn pop_layer(&mut self) {
        let layer = self.layer_stack.pop().unwrap();
        let opacity = (layer.opacity * 255. + 0.5) as u8;
        // Allocating an entire mask just for the opacity is needlessly bad.
        // We should be able to fix it once the blitters work better.
        let mask = vec![opacity; (self.width * self.height) as usize];
        let size = layer.rect.size();
        let ctm = self.transform;
        self.transform = Transform::identity();
        let image = Source::Image(Image { width: size.width,
                                          height: size.height,
                                          data: &layer.buf},
                                  ExtendMode::Pad,
                                  Transform::create_translation(-layer.rect.min.x as f32,
                                                                -layer.rect.min.y as f32));
        self.composite(&image, &mask, layer.rect, BlendMode::SrcOver, 1.);
        self.transform = ctm;
    }
pub fn pop_layer ( & mut self ) { let layer = self . layer_stack . pop ( ) . unwrap ( ) ; let opacity = ( layer . opacity * 255. + 0.5 ) as u8 ; // Allocating an entire mask just for the opacity is needlessly bad. // We should be able to fix it once the blitters work better. let mask = vec ! [ opacity ( self width self height ) as usize ] ; let size = layer . rect . size ( ) ; let ctm = self . transform ; self . transform = Transform :: identity ( ) ; let image = Source :: Image ( Image { width : size . width , height : size . height , data : & layer . buf } , ExtendMode :: Pad , Transform :: create_translation ( - layer . rect . min . x as f32 , - layer . rect . min . y as f32 ) ) ; self . composite ( & image , & mask , layer . rect , BlendMode :: SrcOver , 1. ) ; self . transform = ctm ; }
Draws the most recently pushed layer to the drawing target with
the pushed opacity applied.
Draws the most recently pushed layer to the drawing target with the pushed opacity applied .
&mut self