pub fn release_layer_handle(&mut self, layer_handle: LayerHandle) -> Layer {
        // Swap in an old layer for the new layer
        let LayerHandle(layer_idx)  = layer_handle;
        let mut old_layer           = Layer {
            render_order:       vec![RenderEntity::SetTransform(canvas::Transform2D::identity())],
            state:              LayerState {
                is_sprite:          false,
                fill_color:         FillState::Color(render::Rgba8([0, 0, 0, 255])),
                winding_rule:       FillRule::NonZero,
                stroke_settings:    StrokeSettings::new(),
                current_matrix:     canvas::Transform2D::identity(),
                sprite_matrix:      canvas::Transform2D::identity(),
                scale_factor:       1.0,
                blend_mode:         canvas::BlendMode::SourceOver,
                restore_point:      None
            },
            stored_states:      vec![]
        };

        mem::swap(&mut old_layer, &mut self.layer_definitions[layer_idx as usize]);

        // Add the handle to the list of free layer handles
        self.free_layers.push(layer_handle);

        // Result is the layer that was released
        old_layer
    }
///
/// Releases a layer from the core (returning the layer that had this handle)
///
Releases a layer from the core (returning the layer that had this handle)
Releases a layer from the core ( returning the layer that had this handle )
pub fn release_layer_handle(&mut self, layer_handle: LayerHandle) -> Layer {
        // Swap in an old layer for the new layer
        let LayerHandle(layer_idx)  = layer_handle;
        let mut old_layer           = Layer {
            render_order:       vec![RenderEntity::SetTransform(canvas::Transform2D::identity())],
            state:              LayerState {
                is_sprite:          false,
                fill_color:         FillState::Color(render::Rgba8([0, 0, 0, 255])),
                winding_rule:       FillRule::NonZero,
                stroke_settings:    StrokeSettings::new(),
                current_matrix:     canvas::Transform2D::identity(),
                sprite_matrix:      canvas::Transform2D::identity(),
                scale_factor:       1.0,
                blend_mode:         canvas::BlendMode::SourceOver,
                restore_point:      None
            },
            stored_states:      vec![]
        };
        mem::swap(&mut old_layer, &mut self.layer_definitions[layer_idx as usize]);
        // Add the handle to the list of free layer handles
        self.free_layers.push(layer_handle);
        // Result is the layer that was released
        old_layer
    }
pub fn release_layer_handle ( & mut self , layer_handle : LayerHandle ) -> Layer { // Swap in an old layer for the new layer let LayerHandle ( layer_idx ) = layer_handle ; let mut old_layer = Layer { render_order : vec ! [ RenderEntity SetTransform ( canvas Transform2D identity ( ) ) ] , state : LayerState { is_sprite : false , fill_color : FillState :: Color ( render :: Rgba8 ( [ 0 , 0 , 0 , 255 ] ) ) , winding_rule : FillRule :: NonZero , stroke_settings : StrokeSettings :: new ( ) , current_matrix : canvas :: Transform2D :: identity ( ) , sprite_matrix : canvas :: Transform2D :: identity ( ) , scale_factor : 1.0 , blend_mode : canvas :: BlendMode :: SourceOver , restore_point : None } , stored_states : vec ! [ ] } ; mem :: swap ( & mut old_layer , & mut self . layer_definitions [ layer_idx as usize ] ) ; // Add the handle to the list of free layer handles self . free_layers . push ( layer_handle ) ; // Result is the layer that was released old_layer }
Releases a layer from the core (returning the layer that had this handle)
Releases a layer from the core ( returning the layer that had this handle )
&mut self
layer_handle
LayerHandle