1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <vcl/virdev.hxx>
11 #include <ImageViewerDialog.hxx>
13 ImageViewerDialog::ImageViewerDialog(weld::Dialog
* pParent
, BitmapEx aBitmap
,
14 const OUString
& atitle
)
15 : GenericDialogController(pParent
, u
"cui/ui/imageviewer.ui"_ustr
, u
"ImageViewerDialog"_ustr
)
16 , m_xDisplayImage(m_xBuilder
->weld_image(u
"ImgVW_mainImage"_ustr
))
18 m_xDialog
->set_title(atitle
);
19 aBitmap
.Scale(Size(300, 300), BmpScaleFlag::Fast
);
20 ScopedVclPtr
<VirtualDevice
> m_pVirDev
= m_xDisplayImage
->create_virtual_device();
21 m_pVirDev
->SetOutputSizePixel(aBitmap
.GetSizePixel());
22 m_pVirDev
->DrawBitmapEx(Point(0, 0), aBitmap
);
23 m_xDisplayImage
->set_image(m_pVirDev
.get());
24 m_pVirDev
.disposeAndClear();