Skip to content

bkentel/bktga

Repository files navigation

BKTGA travis-ci.org Build status codecov.io

A c++14 header only TGA file parsing and conversion library.

Overview

A minimal, but fully TGA 2.0 standard compliant parser.

Examples

#include <bktga/tga.hpp>
#include <vector>
#include <iostream>

int main() {
    namespace tga = ::bktga;

    std::vector<std::string> const files {
        "./test/tc-rgb16a1-128x128-rle.tga"
      , "./tga.hpp"
      , "./non-existant-file.none"
    };

    for (auto const& file : files) {
        auto result = tga::detect(tga::read_from_file, file);
        if (!result) {
            std::cerr << "Cannot open \"" << file << "\" as TGA: " << result.error() << '\n';
            continue;
        }

        auto const data = tga::decode(result);
        std::cout << "Okay" << std::endl;
        // use data...
    }

    return 0;
}
Okay
Cannot open "./tga.hpp" as TGA: unknown reserved image type
Cannot open "./non-existant-file.none" as TGA: The system cannot find the file specified.

Compiler Support

Other compiler + standard library version combinations might work, but the following have been tested.

  • ⭕ MSVC 2015 Update 1 (_MSC_FULLVER 190023506)
  • ⭕ GCC 4.9
  • ❌ GCC 4.8 (no digit separators; lack of standard library features in libstdc++)
  • ⭕ Clang 3.6
  • ❗ Clang 3.5 (with GCC 4.9, or with libc++)
  • ⭕ Xcode 6.4

About

Header only TGA image loader

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published