mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 14:16:09 -06:00
42 lines
707 B
C++
42 lines
707 B
C++
#include "PictureBugTest.h"
|
|
|
|
|
|
|
|
PictureBugTest::PictureBugTest()
|
|
{
|
|
CtrlLayout(*this, "Window title");
|
|
Sizeable();
|
|
open <<= THISBACK(Open);
|
|
|
|
pict.KeepRatio();
|
|
}
|
|
|
|
void PictureBugTest::Open()
|
|
{
|
|
FileSelector fs;
|
|
fs
|
|
.Type(t_("Pictures (*.png; *.bmp; *.jpg)"), "*.png;*.bmp;*.jpg")
|
|
.AllFilesType()
|
|
;
|
|
if(!fs.ExecuteOpen())
|
|
return;
|
|
String filename = fs;
|
|
|
|
Image img = StreamRaster::LoadFileAny(filename);
|
|
if(img.IsEmpty())
|
|
{
|
|
Exclamation(t_("File is not an image file!"));
|
|
return;
|
|
}
|
|
|
|
DrawingDraw d( img.GetWidth(), img.GetHeight());
|
|
d.DrawImage(0,0, img.GetWidth(), img.GetHeight(), img);
|
|
pict.Set(d);
|
|
}
|
|
|
|
|
|
GUI_APP_MAIN
|
|
{
|
|
PictureBugTest().Run();
|
|
}
|
|
|