modified resizeMask and gravity value accordingly and added get_window_size function