INNER CODE UNIT · C++

buffer

symphony-of-empires/symphony-of-empires · eng3d/eng3d/binary_image.cpp:53

        buffer = std::make_unique<uint16_t[]>(width * height);
    else if(bpp == 8)
        buffer = std::make_unique<uint8_t[]>(width * height);*/
}

Eng3D::BinaryImage::BinaryImage(const Eng3D::BinaryImage& tex)
    : Eng3D::BinaryImage(tex.width, tex.height, tex.bpp)
{
    if(tex.bpp != this->bpp && this->bpp != 32)
        CXX_THROW(BinaryImageException, "internal", "Can't do 16-bit/8-bit copies");
    std::memcpy(buffer.get(), tex.buffer.get(), sizeof(uint32_t) * (width * height));
}

void Eng3D::BinaryImage::from_file(const Eng3D::IO::Path& path) {
    // stbi can do the conversion to RGBA for us ;)
    int i_width, i_height, i_channels;
    auto* c_buffer = stbi_load(path.str.c_str(), &i_width, &i_height, &i_channels, 4);
    if(c_buffer == nullptr)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…