pub fn trans_selection(&self, selection: Rect, cod: &str, a: f32, b:i32){
        //first prepare for undo 
        self.undo_save();
        
        let mut width = selection.width;
        let mut height = selection.height;
        let x = selection.x;
        let y = selection.y;
        let mut image = if self.mask_flag.get() {self.mask.borrow_mut()}else{self.image.borrow_mut()};
        let image_selection = image.copy_selection(x, y, width, height);
        let new_image = self.trans_image(image_selection, cod,a,b);
        //clear only under selection
        if self.mask_flag.get(){
            image.rect(x,y,width,height,Color::rgba(255,255,255,25));
            image.rect(x,y,width,height,Color::rgba(0,0,0,25));
            }else{image.rect(x,y,width,height,Color::rgba(255,255,255,255))}; 
        
        if cod == "resize" {
            width = a as u32;
            height = b as u32;
        }
        if cod == "rotate90" {
            image.image(x, y, height, width, &new_image[..]);
        }else{
            image.image(x,y, width, height, &new_image[..]);
        }
    }
///apply some transformations to canvas selection (in place)
apply some transformations to canvas selection (in place)
apply some transformations to canvas selection ( in place )
pub fn trans_selection(&self, selection: Rect, cod: &str, a: f32, b:i32){
        //first prepare for undo 
        self.undo_save();
        let mut width = selection.width;
        let mut height = selection.height;
        let x = selection.x;
        let y = selection.y;
        let mut image = if self.mask_flag.get() {self.mask.borrow_mut()}else{self.image.borrow_mut()};
        let image_selection = image.copy_selection(x, y, width, height);
        let new_image = self.trans_image(image_selection, cod,a,b);
        //clear only under selection
        if self.mask_flag.get(){
            image.rect(x,y,width,height,Color::rgba(255,255,255,25));
            image.rect(x,y,width,height,Color::rgba(0,0,0,25));
            }else{image.rect(x,y,width,height,Color::rgba(255,255,255,255))}; 
        if cod == "resize" {
            width = a as u32;
            height = b as u32;
        }
        if cod == "rotate90" {
            image.image(x, y, height, width, &new_image[..]);
        }else{
            image.image(x,y, width, height, &new_image[..]);
        }
    }
pub fn trans_selection ( & self , selection : Rect , cod : & str , a : f32 , b : i32 ) { //first prepare for undo  self . undo_save ( ) ; let mut width = selection . width ; let mut height = selection . height ; let x = selection . x ; let y = selection . y ; let mut image = if self . mask_flag . get ( ) { self . mask . borrow_mut ( ) } else { self . image . borrow_mut ( ) } ; let image_selection = image . copy_selection ( x , y , width , height ) ; let new_image = self . trans_image ( image_selection , cod , a , b ) ; //clear only under selection if self . mask_flag . get ( ) { image . rect ( x , y , width , height , Color :: rgba ( 255 , 255 , 255 , 25 ) ) ; image . rect ( x , y , width , height , Color :: rgba ( 0 , 0 , 0 , 25 ) ) ; } else { image . rect ( x , y , width , height , Color :: rgba ( 255 , 255 , 255 , 255 ) ) } ; if cod == " " { width = a as u32 ; height = b as u32 ; } if cod == " " { image . image ( x , y , height , width , & new_image [ .. ] ) ; } else { image . image ( x , y , width , height , & new_image [ .. ] ) ; } }
apply some transformations to canvas selection (in place)
apply some transformations to canvas selection ( in place )
&self
selection
Rect
cod
&str
a
f32
b
i32
&self
selection
Rect
cod
&str
a
f32
b
i32