MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ copy_into()

bool MayaFlux::Kakshya::TextureCollection::copy_into ( const std::shared_ptr< Core::VKImage > &  image,
const std::shared_ptr< Core::VKImage > &  target 
)
private

Definition at line 88 of file TextureCollection.cpp.

91{
92 auto& loom = TextureLoom::instance();
93
94 if (!m_blank) {
95 const std::vector<uint8_t> zeros(byte_size(), 0);
96 m_blank = loom.create_2d(get_width(), get_height(), get_format(), zeros.data());
97 if (!m_blank)
98 return false;
99 }
100
101 const bool same_extent = image->get_width() == get_width() && image->get_height() == get_height();
102 const auto filter = same_extent || !loom.can_blit(image, target, FilterMode::LINEAR)
103 ? FilterMode::NEAREST
104 : FilterMode::LINEAR;
105
106 if (!loom.can_blit(image, target, filter)) {
108 "TextureCollection::append cannot blit {} into {}",
109 vk::to_string(image->get_format()), vk::to_string(target->get_format()));
110 return false;
111 }
112
113 if (same_extent)
114 return loom.blit_layer(image, target, { .filter = filter });
115
116 return loom.blit_layer(m_blank, target, { .filter = FilterMode::NEAREST })
117 && loom.blit_layer(image, target,
118 { .dst = fitted(image->get_width(), image->get_height(), get_width(), get_height()), .filter = filter });
119}
#define MF_ERROR(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:47
std::shared_ptr< Core::VKImage > m_blank
size_t byte_size() const
Total byte count of the pixel buffer.
@ ContainerProcessing
Container operations (Kakshya - file/stream/region processing)
@ Kakshya
Containers[Signalsource, Stream, File], Regions, DataProcessors.

References MayaFlux::Kakshya::TextureContainer::byte_size(), MayaFlux::Journal::ContainerProcessing, MayaFlux::Kakshya::TextureContainer::get_format(), MayaFlux::Kakshya::TextureContainer::get_height(), MayaFlux::Kakshya::TextureContainer::get_width(), image, MayaFlux::Portal::Graphics::TextureLoom::instance(), MayaFlux::Journal::Kakshya, m_blank, and MF_ERROR.

Referenced by append().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: