新增图集类,DX11映射函数
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
#include "pixel.h"
|
||||
#include "misc/mapped_file/mapped_file.h"
|
||||
#include "stb_image_loader.h"
|
||||
#include "render/texture2d.h"
|
||||
#include "texture/texture2d.h"
|
||||
#include "widget/widget_new.h"
|
||||
#include "widget/leaf_widget/mimage.h"
|
||||
|
||||
@@ -17,18 +17,8 @@ int main(int argc, char* argv[]) {
|
||||
mirage_app::get().init();
|
||||
|
||||
|
||||
auto i = std::make_shared<texture2d>();
|
||||
auto ii = std::make_shared<texture2d>();
|
||||
|
||||
{
|
||||
auto file = mapped_file::create();
|
||||
file->map_file(L"Z:/Root/Local/NanakoDisk/涩图/可爱偷猴计划/蕾米莉亚 & 芙兰朵露/1708702057588.jpg");
|
||||
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 file = mapped_file::create();
|
||||
file->map_file(L"Z:/Root/Local/NanakoDisk/涩图/可爱偷猴计划/蕾米莉亚 & 芙兰朵露/1712938522333.jpg");
|
||||
@@ -36,11 +26,18 @@ int main(int argc, char* argv[]) {
|
||||
image_loader.init(file->get_data(), file->get_size());
|
||||
const auto& heap = image_loader.load();
|
||||
|
||||
ii->create(heap->data, { heap->info.width, heap->info.height }, heap->info.get_pixel_format());
|
||||
texture2d_data data;
|
||||
data.pixel_format = heap->info.get_pixel_format();
|
||||
data.size = { heap->info.width, heap->info.height };
|
||||
data.data_ptr = heap->data;
|
||||
|
||||
ii->create(data);
|
||||
}
|
||||
{
|
||||
auto map = ii->map(texture_map_type::read);
|
||||
map->read_only;
|
||||
}
|
||||
|
||||
auto image = std::make_shared<mimage>();
|
||||
image->set_image(i);
|
||||
auto image2 = std::make_shared<mimage>();
|
||||
image2->set_image(ii);
|
||||
image2->set_sampler(sampler_type::linear_clamp);
|
||||
@@ -49,15 +46,6 @@ int main(int argc, char* argv[]) {
|
||||
window->set_content(
|
||||
mnew(mh_box)
|
||||
|
||||
mslot(mh_box)
|
||||
[
|
||||
mnew(mborder)
|
||||
[
|
||||
image
|
||||
]
|
||||
.margin({ 5 })
|
||||
]
|
||||
|
||||
mslot(mh_box)
|
||||
[
|
||||
image2
|
||||
|
||||
Reference in New Issue
Block a user