图片绘制
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
#include "pixel.h"
|
||||
#include "misc/mapped_file/mapped_file.h"
|
||||
#include "stb_image_loader.h"
|
||||
#include "render/render_image.h"
|
||||
#include "render/texture2d.h"
|
||||
#include "widget/leaf_widget/mimage.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
mirage_app::get().init();
|
||||
@@ -17,17 +18,21 @@ int main(int argc, char* argv[]) {
|
||||
auto file = mapped_file::create();
|
||||
file->map_file(L"Z:/Root/Local/NanakoDisk/涩图/可爱偷猴计划/东风谷早苗/57092520_p1.jpg");
|
||||
|
||||
stb_image_loader image;
|
||||
image.init(file->get_data(), file->get_size());
|
||||
const auto& heap = image.load();
|
||||
auto i = std::make_shared<texture2d>();
|
||||
|
||||
render_image i;
|
||||
i.create(heap->data, { heap->info.width, heap->info.height }, heap->info.get_pixel_format());
|
||||
{
|
||||
stb_image_loader image_loader;
|
||||
image_loader.init(file->get_data(), file->get_size());
|
||||
const auto& heap = image_loader.load();
|
||||
|
||||
i->create(heap->data, { heap->info.width, heap->info.height }, heap->info.get_pixel_format());
|
||||
}
|
||||
|
||||
auto image = std::make_shared<mimage>();
|
||||
image->set_image(i);
|
||||
|
||||
const auto& window = mwindow::create({ 800, 600 }, L"Hello, World!");
|
||||
window->set_content(
|
||||
std::make_shared<mbutton>()
|
||||
);
|
||||
window->set_content(image);
|
||||
|
||||
mirage_app::get().run();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user