mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:25:07 +00:00
QuickShow: Rotate image left and right, flip vertical and horizontal
This commit is contained in:
parent
2689fdf1d8
commit
d79c81a179
3 changed files with 65 additions and 0 deletions
|
@ -42,6 +42,22 @@ QSWidget::~QSWidget()
|
|||
{
|
||||
}
|
||||
|
||||
void QSWidget::flip(Gfx::Orientation orientation)
|
||||
{
|
||||
m_bitmap = m_bitmap->flipped(orientation);
|
||||
set_scale(m_scale);
|
||||
|
||||
resize_window();
|
||||
}
|
||||
|
||||
void QSWidget::rotate(Gfx::RotationDirection rotation_direction)
|
||||
{
|
||||
m_bitmap = m_bitmap->rotated(rotation_direction);
|
||||
set_scale(m_scale);
|
||||
|
||||
resize_window();
|
||||
}
|
||||
|
||||
void QSWidget::navigate(Directions direction)
|
||||
{
|
||||
if (m_path == nullptr)
|
||||
|
@ -211,3 +227,22 @@ void QSWidget::drop_event(GUI::DropEvent& event)
|
|||
if (on_drop)
|
||||
on_drop(event);
|
||||
}
|
||||
|
||||
void QSWidget::resize_window()
|
||||
{
|
||||
if (window()->is_fullscreen())
|
||||
return;
|
||||
|
||||
if (!m_bitmap)
|
||||
return;
|
||||
|
||||
auto new_size = m_bitmap->size();
|
||||
|
||||
if (new_size.width() < 300)
|
||||
new_size.set_width(300);
|
||||
if (new_size.height() < 200)
|
||||
new_size.set_height(200);
|
||||
|
||||
new_size.set_height(new_size.height());
|
||||
window()->resize(new_size);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue